mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
edd1295e1d
A new element is introduced to XML that allows to control state of virtual network interfaces in hypervisors. Live modification of the link state allows networking tools propagate topology changes to guest OS or testing of scenarios in complex (virtual) networks. This patch adds elements to XML grammars and parsing and generating code.
227 lines
6.9 KiB
XML
227 lines
6.9 KiB
XML
<?xml version="1.0"?>
|
|
<!-- A Relax NG schema for the libvirt network XML format -->
|
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
|
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
|
<start>
|
|
<ref name="network"/>
|
|
</start>
|
|
|
|
<include href='basictypes.rng'/>
|
|
<include href='networkcommon.rng'/>
|
|
|
|
<define name="network">
|
|
|
|
<element name="network">
|
|
<interleave>
|
|
|
|
<!-- The name of the network, used to refer to it through the API
|
|
and in virsh -->
|
|
<element name="name">
|
|
<text/>
|
|
</element>
|
|
|
|
<!-- <uuid> element -->
|
|
<optional>
|
|
<element name="uuid"><ref name="UUID"/></element>
|
|
</optional>
|
|
|
|
<!-- <bridge> element -->
|
|
<optional>
|
|
<!-- The name of the network to be set up; this will back
|
|
the network on the host -->
|
|
<element name="bridge">
|
|
<optional>
|
|
<attribute name="name">
|
|
<ref name="deviceName"/>
|
|
</attribute>
|
|
</optional>
|
|
|
|
<optional>
|
|
<attribute name="stp">
|
|
<choice>
|
|
<value>on</value>
|
|
<value>off</value>
|
|
</choice>
|
|
</attribute>
|
|
</optional>
|
|
|
|
<optional>
|
|
<attribute name="delay">
|
|
<data type="integer"/>
|
|
</attribute>
|
|
</optional>
|
|
|
|
</element>
|
|
</optional>
|
|
|
|
<!-- <mac> element -->
|
|
<optional>
|
|
<element name="mac">
|
|
<attribute name="address"><ref name="macAddr"/></attribute>
|
|
<empty/>
|
|
</element>
|
|
</optional>
|
|
|
|
<!-- <forward> element -->
|
|
<optional>
|
|
<!-- The device through which the bridge is connected to the
|
|
rest of the network -->
|
|
<element name="forward">
|
|
<optional>
|
|
<attribute name="dev">
|
|
<ref name="deviceName"/>
|
|
</attribute>
|
|
</optional>
|
|
|
|
<optional>
|
|
<attribute name="mode">
|
|
<choice>
|
|
<value>nat</value>
|
|
<value>route</value>
|
|
<value>bridge</value>
|
|
<value>passthrough</value>
|
|
<value>private</value>
|
|
<value>vepa</value>
|
|
</choice>
|
|
</attribute>
|
|
</optional>
|
|
<zeroOrMore>
|
|
<element name='interface'>
|
|
<attribute name='dev'>
|
|
<ref name='deviceName'/>
|
|
</attribute>
|
|
</element>
|
|
</zeroOrMore>
|
|
</element>
|
|
</optional>
|
|
|
|
<!-- <virtualport> element -->
|
|
<optional>
|
|
<ref name="virtualPortProfile"/>
|
|
</optional>
|
|
|
|
<!-- <portgroup> elements -->
|
|
<zeroOrMore>
|
|
<element name="portgroup">
|
|
<attribute name="name">
|
|
<ref name="deviceName"/>
|
|
</attribute>
|
|
<optional>
|
|
<attribute name="default">
|
|
<choice>
|
|
<value>yes</value>
|
|
<value>no</value>
|
|
</choice>
|
|
</attribute>
|
|
</optional>
|
|
<optional>
|
|
<ref name="virtualPortProfile"/>
|
|
</optional>
|
|
</element>
|
|
</zeroOrMore>
|
|
|
|
<!-- <domain> element -->
|
|
<optional>
|
|
<element name="domain">
|
|
<attribute name="name"><ref name="dnsName"/></attribute>
|
|
</element>
|
|
</optional>
|
|
|
|
<!-- Define the DNS related elements like TXT records
|
|
and other features in the <dns> element -->
|
|
<optional>
|
|
<element name="dns">
|
|
<zeroOrMore>
|
|
<element name="txt">
|
|
<attribute name="name"><ref name="dnsName"/></attribute>
|
|
<attribute name="value"><text/></attribute>
|
|
</element>
|
|
</zeroOrMore>
|
|
<zeroOrMore>
|
|
<element name="host">
|
|
<attribute name="ip"><ref name="ipv4Addr"/></attribute>
|
|
<oneOrMore>
|
|
<element name="hostname"><ref name="dnsName"/></element>
|
|
</oneOrMore>
|
|
</element>
|
|
</zeroOrMore>
|
|
</element>
|
|
</optional>
|
|
<optional>
|
|
<ref name="bandwidth"/>
|
|
</optional>
|
|
<optional>
|
|
<element name="link">
|
|
<attribute name="state">
|
|
<choice>
|
|
<value>up</value>
|
|
<value>down</value>
|
|
</choice>
|
|
</attribute>
|
|
<empty/>
|
|
</element>
|
|
</optional>
|
|
|
|
<!-- <ip> element -->
|
|
<zeroOrMore>
|
|
<!-- The IP element sets up NAT'ing and an optional DHCP server
|
|
local to the host. -->
|
|
<element name="ip">
|
|
<optional>
|
|
<attribute name="address"><ref name="ipAddr"/></attribute>
|
|
</optional>
|
|
<optional>
|
|
<choice>
|
|
<attribute name="netmask"><ref name="ipv4Addr"/></attribute>
|
|
<attribute name="prefix"><ref name="ipPrefix"/></attribute>
|
|
</choice>
|
|
</optional>
|
|
<optional>
|
|
<attribute name="family"><ref name="addr-family"/></attribute>
|
|
</optional>
|
|
<optional>
|
|
<element name="tftp">
|
|
<attribute name="root"><text/></attribute>
|
|
</element>
|
|
</optional>
|
|
<optional>
|
|
<!-- Define the range(s) of IP addresses that the DHCP
|
|
server should hand out -->
|
|
<element name="dhcp">
|
|
<zeroOrMore>
|
|
<element name="range">
|
|
<attribute name="start"><ref name="ipv4Addr"/></attribute>
|
|
<attribute name="end"><ref name="ipv4Addr"/></attribute>
|
|
</element>
|
|
</zeroOrMore>
|
|
<zeroOrMore>
|
|
<element name="host">
|
|
<attribute name="mac"><ref name="macAddr"/></attribute>
|
|
<attribute name="name"><text/></attribute>
|
|
<attribute name="ip"><ref name="ipv4Addr"/></attribute>
|
|
</element>
|
|
</zeroOrMore>
|
|
<optional>
|
|
<element name="bootp">
|
|
<attribute name="file"><ref name="filePath"/></attribute>
|
|
<optional>
|
|
<attribute name="server"><ref name="dnsName"/></attribute>
|
|
</optional>
|
|
</element>
|
|
</optional>
|
|
</element>
|
|
</optional>
|
|
</element>
|
|
</zeroOrMore>
|
|
</interleave>
|
|
</element>
|
|
</define>
|
|
|
|
<define name='addr-family'>
|
|
<data type='string'>
|
|
<param name="pattern">(ipv4)|(ipv6)</param>
|
|
</data>
|
|
</define>
|
|
|
|
</grammar>
|