On 2012年01月17日 16:51, Daniel Veillard wrote:
On Mon, Jan 16, 2012 at 10:08:07PM +0800, Osier Yang wrote:
> We support<interface> of type "mcast", "server", and
"client",
> but the RNG schema for them are missed. Attribute "address" is
> optional for "server" type. And these 3 types support
> <mac address='MAC'/>, too.
> ---
> docs/formatdomain.html.in | 3 +
> docs/schemas/domaincommon.rng | 53 ++++++++++++++++++++
> .../qemuxml2argvdata/qemuxml2argv-net-client.args | 5 ++
> tests/qemuxml2argvdata/qemuxml2argv-net-client.xml | 29 +++++++++++
> tests/qemuxml2argvdata/qemuxml2argv-net-mcast.args | 5 ++
> tests/qemuxml2argvdata/qemuxml2argv-net-mcast.xml | 29 +++++++++++
> .../qemuxml2argvdata/qemuxml2argv-net-server.args | 5 ++
> tests/qemuxml2argvdata/qemuxml2argv-net-server.xml | 29 +++++++++++
> tests/qemuxml2argvtest.c | 3 +
> 9 files changed, 161 insertions(+), 0 deletions(-)
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-client.args
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-client.xml
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-mcast.args
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-mcast.xml
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-server.args
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-server.xml
>
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index faf42df..6b06723 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -2189,6 +2189,7 @@
> <pre>
> ...
> <devices>
> +<mac address='52:54:00:6d:90:01'>
> <interface type='mcast'>
> <source address='230.0.0.1' port='5558'/>
> </interface>
> @@ -2210,10 +2211,12 @@
> ...
> <devices>
> <interface type='server'>
> +<mac address='52:54:00:22:c9:42'>
> <source address='192.168.0.1' port='5558'/>
> </interface>
> ...
> <interface type='client'>
> +<mac address='52:54:00:8b:c9:51'>
> <source address='192.168.0.1' port='5558'/>
> </interface>
> </devices>
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 6d265f3..7a23525 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -1308,6 +1308,59 @@
> <ref name="interface-options"/>
> </interleave>
> </group>
> +<group>
> +<attribute name="type">
> +<choice>
> +<value>mcast</value>
> +<value>client</value>
> +</choice>
> +</attribute>
> +<interleave>
> +<element name="source">
> +<attribute name="address">
> +<ref name="ipv4Addr"/>
> +</attribute>
> +<attribute name="port">
> +<ref name="PortNumber"/>
> +</attribute>
> +<empty/>
> +</element>
> +<optional>
> +<element name="mac">
> +<attribute name="address">
> +<ref name="macAddr"/>
> +</attribute>
> +<empty/>
> +</element>
> +</optional>
> +</interleave>
> +</group>
> +<group>
> +<attribute name="type">
> +<value>server</value>
> +</attribute>
> +<interleave>
> +<element name="source">
> +<optional>
> +<attribute name="address">
> +<ref name="ipv4Addr"/>
> +</attribute>
> +</optional>
> +<attribute name="port">
> +<ref name="PortNumber"/>
> +</attribute>
> +<empty/>
> +</element>
> +<optional>
> +<element name="mac">
> +<attribute name="address">
> +<ref name="macAddr"/>
> +</attribute>
> +<empty/>
> +</element>
> +</optional>
> +</interleave>
> +</group>
> </choice>
> </element>
> </define>
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-client.args
b/tests/qemuxml2argvdata/qemuxml2argv-net-client.args
> new file mode 100644
> index 0000000..f8853ac
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-client.args
> @@ -0,0 +1,5 @@
> +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
> +pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
> +-no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,\
> +macaddr=52:54:00:8c:b9:05,vlan=0 -net socket,connect=192.168.0.1:5558,vlan=0 \
> +-serial none -parallel none -usb
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-client.xml
b/tests/qemuxml2argvdata/qemuxml2argv-net-client.xml
> new file mode 100644
> index 0000000..b4cca6e
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-client.xml
> @@ -0,0 +1,29 @@
> +<domain type='qemu'>
> +<name>QEMUGuest1</name>
> +<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
> +<memory>219136</memory>
> +<currentMemory>219136</currentMemory>
> +<vcpu>1</vcpu>
> +<os>
> +<type arch='i686' machine='pc'>hvm</type>
> +<boot dev='hd'/>
> +</os>
> +<clock offset='utc'/>
> +<on_poweroff>destroy</on_poweroff>
> +<on_reboot>restart</on_reboot>
> +<on_crash>destroy</on_crash>
> +<devices>
> +<emulator>/usr/bin/qemu</emulator>
> +<disk type='block' device='disk'>
> +<source dev='/dev/HostVG/QEMUGuest1'/>
> +<target dev='hda' bus='ide'/>
> +<address type='drive' controller='0' bus='0'
unit='0'/>
> +</disk>
> +<controller type='ide' index='0'/>
> +<interface type='client'>
> +<mac address='52:54:00:8c:b9:05'/>
> +<source address='192.168.0.1' port='5558'/>
> +</interface>
> +<memballoon model='virtio'/>
> +</devices>
> +</domain>
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-mcast.args
b/tests/qemuxml2argvdata/qemuxml2argv-net-mcast.args
> new file mode 100644
> index 0000000..bb4a042
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-mcast.args
> @@ -0,0 +1,5 @@
> +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
> +pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
> +-no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,\
> +macaddr=52:54:00:8c:b9:05,vlan=0 -net socket,mcast=192.0.0.1:5558,vlan=0 \
> +-serial none -parallel none -usb
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-mcast.xml
b/tests/qemuxml2argvdata/qemuxml2argv-net-mcast.xml
> new file mode 100644
> index 0000000..a3929a5
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-mcast.xml
> @@ -0,0 +1,29 @@
> +<domain type='qemu'>
> +<name>QEMUGuest1</name>
> +<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
> +<memory>219136</memory>
> +<currentMemory>219136</currentMemory>
> +<vcpu>1</vcpu>
> +<os>
> +<type arch='i686' machine='pc'>hvm</type>
> +<boot dev='hd'/>
> +</os>
> +<clock offset='utc'/>
> +<on_poweroff>destroy</on_poweroff>
> +<on_reboot>restart</on_reboot>
> +<on_crash>destroy</on_crash>
> +<devices>
> +<emulator>/usr/bin/qemu</emulator>
> +<disk type='block' device='disk'>
> +<source dev='/dev/HostVG/QEMUGuest1'/>
> +<target dev='hda' bus='ide'/>
> +<address type='drive' controller='0' bus='0'
unit='0'/>
> +</disk>
> +<controller type='ide' index='0'/>
> +<interface type='mcast'>
> +<mac address='52:54:00:8c:b9:05'/>
> +<source address='192.0.0.1' port='5558'/>
> +</interface>
> +<memballoon model='virtio'/>
> +</devices>
> +</domain>
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-server.args
b/tests/qemuxml2argvdata/qemuxml2argv-net-server.args
> new file mode 100644
> index 0000000..1451e32
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-server.args
> @@ -0,0 +1,5 @@
> +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
> +pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
> +-no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,\
> +macaddr=52:54:00:8c:b9:05,vlan=0 -net socket,listen=192.168.0.1:5558,vlan=0 \
> +-serial none -parallel none -usb
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-server.xml
b/tests/qemuxml2argvdata/qemuxml2argv-net-server.xml
> new file mode 100644
> index 0000000..eca440d
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-server.xml
> @@ -0,0 +1,29 @@
> +<domain type='qemu'>
> +<name>QEMUGuest1</name>
> +<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
> +<memory>219136</memory>
> +<currentMemory>219136</currentMemory>
> +<vcpu>1</vcpu>
> +<os>
> +<type arch='i686' machine='pc'>hvm</type>
> +<boot dev='hd'/>
> +</os>
> +<clock offset='utc'/>
> +<on_poweroff>destroy</on_poweroff>
> +<on_reboot>restart</on_reboot>
> +<on_crash>destroy</on_crash>
> +<devices>
> +<emulator>/usr/bin/qemu</emulator>
> +<disk type='block' device='disk'>
> +<source dev='/dev/HostVG/QEMUGuest1'/>
> +<target dev='hda' bus='ide'/>
> +<address type='drive' controller='0' bus='0'
unit='0'/>
> +</disk>
> +<controller type='ide' index='0'/>
> +<interface type='server'>
> +<mac address='52:54:00:8c:b9:05'/>
> +<source address='192.168.0.1' port='5558'/>
> +</interface>
> +<memballoon model='virtio'/>
> +</devices>
> +</domain>
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index 7beaa4b..fd3c9bb 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -519,6 +519,9 @@ mymain(void)
> DO_TEST("net-eth", false, NONE);
> DO_TEST("net-eth-ifname", false, NONE);
> DO_TEST("net-eth-names", false, QEMU_CAPS_NET_NAME);
> + DO_TEST("net-client", false, NONE);
> + DO_TEST("net-server", false, NONE);
> + DO_TEST("net-mcast", false, NONE);
>
> DO_TEST("serial-vc", false, NONE);
> DO_TEST("serial-pty", false, NONE);
Looks good to me, ACK
Daniel
Thanks, pushed.
Osier