[Libvir] PATCH: Fix KVM / QEMU pxe boot config

Daniel P. Berrange berrange at redhat.com
Wed Sep 12 03:17:26 UTC 2007


The XML config for PXE boot is being parsed/formatted incorrectly by the
KVM tools. It is using 'net' instead of 'network' for the <boot> tag. I
had even made this mistake in the test suite :-) Patch is simple - also
fixed a flaw in the test suite code

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
-------------- next part --------------
Index: src/qemu_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_conf.c,v
retrieving revision 1.12
diff -u -p -r1.12 qemu_conf.c
--- src/qemu_conf.c	14 Aug 2007 01:28:47 -0000	1.12
+++ src/qemu_conf.c	12 Sep 2007 02:58:49 -0000
@@ -1180,7 +1180,7 @@ static struct qemud_vm_def *qemudParseXM
                 def->os.bootDevs[def->os.nBootDevs++] = QEMUD_BOOT_FLOPPY;
             } else if (!strcmp((char *)prop, "cdrom")) {
                 def->os.bootDevs[def->os.nBootDevs++] = QEMUD_BOOT_CDROM;
-            } else if (!strcmp((char *)prop, "net")) {
+            } else if (!strcmp((char *)prop, "network")) {
                 def->os.bootDevs[def->os.nBootDevs++] = QEMUD_BOOT_NET;
             } else {
                 goto error;
@@ -2819,7 +2819,7 @@ char *qemudGenerateXML(virConnectPtr con
             boottype = "cdrom";
             break;
         case QEMUD_BOOT_NET:
-            boottype = "net";
+            boottype = "network";
             break;
         }
         if (virBufferVSprintf(buf, "    <boot dev='%s'/>\n", boottype) < 0)
Index: tests/qemuxml2argvtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/qemuxml2argvtest.c,v
retrieving revision 1.3
diff -u -p -r1.3 qemuxml2argvtest.c
--- tests/qemuxml2argvtest.c	31 Jul 2007 14:27:12 -0000	1.3
+++ tests/qemuxml2argvtest.c	12 Sep 2007 02:58:53 -0000
@@ -79,8 +79,8 @@ static int testCompareXMLToArgvFiles(con
         }
         free(argv);
     }
-
-    qemudFreeVMDef(vmdef);
+    if (vmdef)
+        qemudFreeVMDef(vmdef);
     return ret;
 }
 
Index: tests/qemuxml2xmltest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/qemuxml2xmltest.c,v
retrieving revision 1.3
diff -u -p -r1.3 qemuxml2xmltest.c
--- tests/qemuxml2xmltest.c	31 Jul 2007 14:27:12 -0000	1.3
+++ tests/qemuxml2xmltest.c	12 Sep 2007 02:58:53 -0000
@@ -48,7 +48,8 @@ static int testCompareXMLToXMLFiles(cons
 
  fail:
     free(actual);
-    qemudFreeVMDef(vmdef);
+    if (vmdef)
+        qemudFreeVMDef(vmdef);
     return ret;
 }
 
Index: tests/qemuxml2argvdata/qemuxml2argv-boot-network.xml
===================================================================
RCS file: /data/cvs/libvirt/tests/qemuxml2argvdata/qemuxml2argv-boot-network.xml,v
retrieving revision 1.1
diff -u -p -r1.1 qemuxml2argv-boot-network.xml
--- tests/qemuxml2argvdata/qemuxml2argv-boot-network.xml	18 Jul 2007 21:34:22 -0000	1.1
+++ tests/qemuxml2argvdata/qemuxml2argv-boot-network.xml	12 Sep 2007 02:58:53 -0000
@@ -6,7 +6,7 @@
   <vcpu>1</vcpu>
   <os>
     <type arch='i686' machine='pc'>hvm</type>
-    <boot dev='net'/>
+    <boot dev='network'/>
   </os>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>


More information about the libvir-list mailing list