Re: PATCH: Support network interface model in Xen and QEMU driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 29, 2008 at 06:20:01PM +0100, Daniel P. Berrange wrote:
> This patch finishes off the work from Rich / Soren to support network
> interface model in both Xen and QEMU drivers, and adds test cases for
> the new syntax

Here is a re-diff following Jim's   xmlFree cleanups.

Dan.

Index: tests/qemuxml2argvtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/qemuxml2argvtest.c,v
retrieving revision 1.15
diff -u -p -r1.15 qemuxml2argvtest.c
--- tests/qemuxml2argvtest.c	25 Apr 2008 20:46:13 -0000	1.15
+++ tests/qemuxml2argvtest.c	29 Apr 2008 20:46:07 -0000
@@ -146,6 +146,7 @@ main(int argc, char **argv)
     DO_TEST("misc-acpi");
     DO_TEST("misc-no-reboot");
     DO_TEST("net-user");
+    DO_TEST("net-virtio");
 
     DO_TEST("serial-vc");
     DO_TEST("serial-pty");
Index: tests/qemuxml2xmltest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/qemuxml2xmltest.c,v
retrieving revision 1.13
diff -u -p -r1.13 qemuxml2xmltest.c
--- tests/qemuxml2xmltest.c	25 Apr 2008 20:46:13 -0000	1.13
+++ tests/qemuxml2xmltest.c	29 Apr 2008 20:46:07 -0000
@@ -109,6 +109,7 @@ main(int argc, char **argv)
     DO_TEST("misc-acpi");
     DO_TEST("misc-no-reboot");
     DO_TEST("net-user");
+    DO_TEST("net-virtio");
 
     DO_TEST("serial-vc");
     DO_TEST("serial-pty");
Index: tests/sexpr2xmltest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/sexpr2xmltest.c,v
retrieving revision 1.26
diff -u -p -r1.26 sexpr2xmltest.c
--- tests/sexpr2xmltest.c	26 Apr 2008 14:22:02 -0000	1.26
+++ tests/sexpr2xmltest.c	29 Apr 2008 20:46:07 -0000
@@ -116,6 +116,7 @@ main(int argc, char **argv)
     DO_TEST("curmem", "curmem", 1);
     DO_TEST("net-routed", "net-routed", 2);
     DO_TEST("net-bridged", "net-bridged", 2);
+    DO_TEST("net-e1000", "net-e1000", 2);
     DO_TEST("no-source-cdrom", "no-source-cdrom", 1);
 
     DO_TEST("fv-utc", "fv-utc", 1);
Index: tests/testutils.c
===================================================================
RCS file: /data/cvs/libvirt/tests/testutils.c,v
retrieving revision 1.12
diff -u -p -r1.12 testutils.c
--- tests/testutils.c	18 Apr 2008 15:05:29 -0000	1.12
+++ tests/testutils.c	29 Apr 2008 20:46:07 -0000
@@ -23,6 +23,7 @@
 #include <fcntl.h>
 #include <limits.h>
 #include "testutils.h"
+#include "internal.h"
 
 #ifdef HAVE_PATHS_H
 #include <paths.h>
@@ -231,23 +232,27 @@ int virtTestDifference(FILE *stream,
     const char *expectEnd = expect + (strlen(expect)-1);
     const char *actualStart = actual;
     const char *actualEnd = actual + (strlen(actual)-1);
+    const char *debug;
 
-    if (getenv("DEBUG_TESTS") == NULL)
+    if ((debug = getenv("DEBUG_TESTS")) == NULL)
         return 0;
 
-    /* Skip to first character where they differ */
-    while (*expectStart && *actualStart &&
-           *actualStart == *expectStart) {
-        actualStart++;
-        expectStart++;
-    }
+    if (STREQ(debug, "") ||
+        STREQ(debug, "1")) {
+        /* Skip to first character where they differ */
+        while (*expectStart && *actualStart &&
+               *actualStart == *expectStart) {
+            actualStart++;
+            expectStart++;
+        }
 
-    /* Work backwards to last character where they differ */
-    while (actualEnd > actualStart &&
-           expectEnd > expectStart &&
-           *actualEnd == *expectEnd) {
-        actualEnd--;
-        expectEnd--;
+        /* Work backwards to last character where they differ */
+        while (actualEnd > actualStart &&
+               expectEnd > expectStart &&
+               *actualEnd == *expectEnd) {
+            actualEnd--;
+            expectEnd--;
+        }
     }
 
     /* Show the trimmed differences */
Index: tests/xmconfigtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/xmconfigtest.c,v
retrieving revision 1.15
diff -u -p -r1.15 xmconfigtest.c
--- tests/xmconfigtest.c	26 Apr 2008 14:22:02 -0000	1.15
+++ tests/xmconfigtest.c	29 Apr 2008 20:46:07 -0000
@@ -202,6 +202,7 @@ main(int argc, char **argv)
 
     DO_TEST("paravirt-old-pvfb", 2);
     DO_TEST("paravirt-new-pvfb", 3);
+    DO_TEST("paravirt-net-e1000", 3);
     DO_TEST("fullvirt-old-cdrom", 1);
     DO_TEST("fullvirt-new-cdrom", 2);
     DO_TEST("fullvirt-utc", 2);
Index: tests/xml2sexprtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprtest.c,v
retrieving revision 1.25
diff -u -p -r1.25 xml2sexprtest.c
--- tests/xml2sexprtest.c	26 Apr 2008 14:22:02 -0000	1.25
+++ tests/xml2sexprtest.c	29 Apr 2008 20:46:07 -0000
@@ -123,6 +123,7 @@ main(int argc, char **argv)
     DO_TEST("curmem", "curmem", "rhel5", 2);
     DO_TEST("net-routed", "net-routed", "pvtest", 2);
     DO_TEST("net-bridged", "net-bridged", "pvtest", 2);
+    DO_TEST("net-e1000", "net-e1000", "pvtest", 2);
     DO_TEST("no-source-cdrom", "no-source-cdrom", "test", 2);
 
     DO_TEST("fv-utc", "fv-utc", "fvtest", 1);
Index: tests/qemuxml2argvdata/qemuxml2argv-net-virtio.args
===================================================================
RCS file: tests/qemuxml2argvdata/qemuxml2argv-net-virtio.args
diff -N tests/qemuxml2argvdata/qemuxml2argv-net-virtio.args
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/qemuxml2argvdata/qemuxml2argv-net-virtio.args	29 Apr 2008 20:46:07 -0000
@@ -0,0 +1 @@
+/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,macaddr=00:11:22:33:44:55,vlan=0,model=virtio -net user,vlan=0 -serial none -parallel none -usb
\ No newline at end of file
Index: tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml
===================================================================
RCS file: tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml
diff -N tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml	29 Apr 2008 20:46:07 -0000
@@ -0,0 +1,26 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory>219200</memory>
+  <currentMemory>219200</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'/>
+    </disk>
+    <interface type='user'>
+      <mac address='00:11:22:33:44:55'/>
+      <model type='virtio'/>
+    </interface>
+  </devices>
+</domain>
Index: tests/sexpr2xmldata/sexpr2xml-net-e1000.sexpr
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-net-e1000.sexpr
diff -N tests/sexpr2xmldata/sexpr2xml-net-e1000.sexpr
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/sexpr2xmldata/sexpr2xml-net-e1000.sexpr	29 Apr 2008 20:46:07 -0000
@@ -0,0 +1,2 @@
+(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vif (mac '00:11:22:33:44:55')(bridge 'xenbr2')(script 'vif-bridge')(model 'e1000'))))
+
Index: tests/sexpr2xmldata/sexpr2xml-net-e1000.xml
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-net-e1000.xml
diff -N tests/sexpr2xmldata/sexpr2xml-net-e1000.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/sexpr2xmldata/sexpr2xml-net-e1000.xml	29 Apr 2008 20:46:07 -0000
@@ -0,0 +1,32 @@
+<domain type='xen' id='6'>
+  <name>pvtest</name>
+  <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+  <os>
+    <type>linux</type>
+    <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+    <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+    <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
+  </os>
+  <memory>430080</memory>
+  <vcpu>2</vcpu>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>destroy</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <disk type='file' device='disk'>
+      <driver name='file'/>
+      <source file='/root/some.img'/>
+      <target dev='xvda'/>
+    </disk>
+    <interface type='bridge'>
+      <source bridge='xenbr2'/>
+      <target dev='vif6.0'/>
+      <mac address='00:11:22:33:44:55'/>
+      <script path='vif-bridge'/>
+      <model type='e1000'/>
+    </interface>
+    <console type='pty'>
+      <target port='0'/>
+    </console>
+  </devices>
+</domain>
Index: tests/xmconfigdata/test-paravirt-net-e1000.cfg
===================================================================
RCS file: tests/xmconfigdata/test-paravirt-net-e1000.cfg
diff -N tests/xmconfigdata/test-paravirt-net-e1000.cfg
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/xmconfigdata/test-paravirt-net-e1000.cfg	29 Apr 2008 20:46:07 -0000
@@ -0,0 +1,12 @@
+name = "XenGuest1"
+uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+bootloader = "/usr/bin/pygrub"
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+vfb = [ "type=vnc,vncunused=1,vnclisten=127.0.0.1,vncpasswd=123poi" ]
+disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
+vif = [ "mac=00:16:3E:66:94:9C,model=e1000,ip=192.168.0.9" ]
Index: tests/xmconfigdata/test-paravirt-net-e1000.xml
===================================================================
RCS file: tests/xmconfigdata/test-paravirt-net-e1000.xml
diff -N tests/xmconfigdata/test-paravirt-net-e1000.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/xmconfigdata/test-paravirt-net-e1000.xml	29 Apr 2008 20:46:07 -0000
@@ -0,0 +1,28 @@
+<domain type='xen'>
+  <name>XenGuest1</name>
+  <uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
+  <bootloader>/usr/bin/pygrub</bootloader>
+  <currentMemory>403456</currentMemory>
+  <memory>592896</memory>
+  <vcpu>1</vcpu>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <disk type='block' device='disk'>
+      <driver name='phy'/>
+      <source dev='/dev/HostVG/XenGuest1'/>
+      <target dev='xvda'/>
+    </disk>
+    <interface type='bridge'>
+      <mac address='00:16:3E:66:94:9C'/>
+      <ip address='192.168.0.9'/>
+      <model type='e1000'/>
+    </interface>
+    <input type='mouse' bus='xen'/>
+    <graphics type='vnc' port='-1' listen='127.0.0.1' passwd='123poi'/>
+    <console type='pty'>
+      <target port='0'/>
+    </console>
+  </devices>
+</domain>
Index: tests/xml2sexprdata/xml2sexpr-net-e1000.sexpr
===================================================================
RCS file: tests/xml2sexprdata/xml2sexpr-net-e1000.sexpr
diff -N tests/xml2sexprdata/xml2sexpr-net-e1000.sexpr
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/xml2sexprdata/xml2sexpr-net-e1000.sexpr	29 Apr 2008 20:46:07 -0000
@@ -0,0 +1 @@
+(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vif (mac '00:11:22:33:44:55')(bridge 'xenbr2')(script 'vif-bridge')(model 'e1000'))))
\ No newline at end of file
Index: tests/xml2sexprdata/xml2sexpr-net-e1000.xml
===================================================================
RCS file: tests/xml2sexprdata/xml2sexpr-net-e1000.xml
diff -N tests/xml2sexprdata/xml2sexpr-net-e1000.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/xml2sexprdata/xml2sexpr-net-e1000.xml	29 Apr 2008 20:46:07 -0000
@@ -0,0 +1,30 @@
+<domain type='xen' id='15'>
+  <name>pvtest</name>
+  <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+  <os>
+    <type>linux</type>
+    <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+    <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+    <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os  </cmdline>
+  </os>
+  <memory>430080</memory>
+  <vcpu>2</vcpu>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>destroy</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <disk type='file' device='disk'>
+      <source file='/root/some.img'/>
+      <target dev='xvda'/>
+    </disk>
+    <interface type="bridge">
+      <mac address="00:11:22:33:44:55"/>
+      <source bridge="xenbr2"/>
+      <script path="vif-bridge"/>
+      <model type='e1000'/>
+      <target dev="vif4.0"/>
+    </interface>
+    <console tty='/dev/pts/4'/>
+  </devices>
+</domain>
+



-- 
|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]