+Thu Jun 7 15:48:30 CEST 2007 Daniel Veillard <veillard@redhat.com>
+
+ * src/xend_internal.c src/xm_internal.c src/xml.c: add support
+ for arguments to bootloader, patch from Hugh Brock
+ * tests/sexpr2xmltest.c tests/xml2sexprtest.c
+ tests/sexpr2xmldata/sexpr2xml-pv-bootloader.sexpr
+ tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml
+ tests/xml2sexprdata/xml2sexpr-pv-bootloader.sexpr
+ tests/xml2sexprdata/xml2sexpr-pv-bootloader.xml: add specific
+ regression tests
+
Thu Jun 7 15:02:44 CEST 2007 Daniel Veillard <veillard@redhat.com>
* src/libvirt.c: do not die if the daemon is not running on a Xen
bootloader = 1;
virBufferVSprintf(&buf, " <bootloader>%s</bootloader>\n", tmp);
}
+ tmp = sexpr_node(root, "domain/bootloader_args");
+ if (tmp != NULL && bootloader) {
+ /*
+ * Only insert bootloader_args if there is also a bootloader param
+ */
+ virBufferVSprintf(&buf, " <bootloader_args>%s</bootloader_args>\n", tmp);
+ }
if (domid != 0) {
if (sexpr_lookup(root, "domain/image")) {
if (xenXMConfigGetString(conf, "bootloader", &str) == 0)
virBufferVSprintf(buf, " <bootloader>%s</bootloader>\n", str);
+ if (xenXMConfigGetString(conf, "bootargs", &str) == 0)
+ virBufferVSprintf(buf, " <bootloader_args>%s</bootloader_args>\n", str);
if (xenXMConfigGetString(conf, "kernel", &str) == 0) {
virBufferAdd(buf, " <os>\n", -1);
virBufferAdd(buf, " <type>linux</type>\n", -1);
if (xenXMConfigSetStringFromXPath(conn, conf, ctxt, "bootloader", "string(/domain/bootloader)", 1,
"cannot set the bootloader parameter") < 0)
goto error;
+ if (xenXMConfigSetStringFromXPath(conn, conf, ctxt, "bootargs", "string(/domain/bootloader_args)", 1,
+ "cannot set the bootloader_args parameter") < 0)
+ goto error;
if (xenXMConfigSetStringFromXPath(conn, conf, ctxt, "kernel", "string(/domain/os/kernel)", 1,
"cannot set the kernel parameter") < 0)
goto error;
if (str != NULL) {
virBufferVSprintf(&buf, "(bootloader '%s')", str);
/*
- * if using pygrub, the kernel and initrd strings are not
+ * if using a bootloader, the kernel and initrd strings are not
* significant and should be discarded
*/
- if (strstr(str, "pygrub"))
- bootloader = 2;
- else
- bootloader = 1;
+ bootloader = 1;
+ free(str);
+ }
+
+ str = virXPathString("string(/domain/bootloader_args[1])", ctxt);
+ if (str != NULL && bootloader) {
+ /*
+ * ignore the bootloader_args value unless a bootloader was specified
+ */
+ virBufferVSprintf(&buf, "(bootloader_args '%s')", str);
free(str);
}
free(str);
}
- if (bootloader != 2) {
+ if (!bootloader) {
if ((node = virXPathNode("/domain/os[1]", ctxt)) != NULL) {
/* Analyze of the os description, based on HVM or PV. */
- str = virXPathString("string(/domain/os/type[1])", ctxt);
+ str = virXPathString("string(/domain/os/type[1])", ctxt);
if ((str == NULL) || (strcmp(str, "hvm"))) {
res = virDomainParseXMLOSDescPV(conn, node,
if (res != 0)
goto error;
- } else if (bootloader == 0) {
+ } else {
virXMLError(conn, VIR_ERR_NO_OS, nam, 0);
goto error;
}
--- /dev/null
+(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(bootloader '/usr/bin/pypxeboot')(bootloader_args 'mac=AA:00:86:e2:35:72')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
\ No newline at end of file
--- /dev/null
+<domain type='xen' id='6'>
+ <name>pvtest</name>
+ <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+ <bootloader>/usr/bin/pypxeboot</bootloader>
+ <bootloader_args>mac=AA:00:86:e2:35:72</bootloader_args>
+ <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>
+ </devices>
+</domain>
2);
}
+static int testComparePVBootloader(void *data ATTRIBUTE_UNUSED) {
+ return testCompareFiles("sexpr2xmldata/sexpr2xml-pv-bootloader.xml",
+ "sexpr2xmldata/sexpr2xml-pv-bootloader.sexpr",
+ 2);
+}
+
static int testCompareDiskFile(void *data ATTRIBUTE_UNUSED) {
return testCompareFiles("sexpr2xmldata/sexpr2xml-disk-file.xml",
"sexpr2xmldata/sexpr2xml-disk-file.sexpr",
1, testCompareFVversion2, NULL) != 0)
ret = -1;
+ if (virtTestRun("SEXPR-2-XML PV config bootloader",
+ 1, testComparePVBootloader, NULL) != 0)
+ ret = -1;
+
if (virtTestRun("SEXPR-2-XML Disk File config",
1, testCompareDiskFile, NULL) != 0)
ret = -1;
--- /dev/null
+(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(bootloader '/usr/bin/pypxeboot')(bootloader_args 'mac=AA:00:86:e2:35:72')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
\ No newline at end of file
--- /dev/null
+<domain type='xen' id='15'>
+ <name>pvtest</name>
+ <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+ <bootloader>/usr/bin/pypxeboot</bootloader>
+ <bootloader_args>mac=AA:00:86:e2:35:72</bootloader_args>
+ <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>
+ <console tty='/dev/pts/4'/>
+ </devices>
+</domain>
+
3);
}
+static int testComparePVBootloader(void *data ATTRIBUTE_UNUSED) {
+ return testCompareFiles("xml2sexprdata/xml2sexpr-pv-bootloader.xml",
+ "xml2sexprdata/xml2sexpr-pv-bootloader.sexpr",
+ "pvtest",
+ 1);
+}
+
static int testCompareDiskFile(void *data ATTRIBUTE_UNUSED) {
return testCompareFiles("xml2sexprdata/xml2sexpr-disk-file.xml",
"xml2sexprdata/xml2sexpr-disk-file.sexpr",
1, testComparePVNewVFB, NULL) != 0)
ret = -1;
+ if (virtTestRun("XML-2-SEXPR PV config with bootloader",
+ 1, testComparePVBootloader, NULL) != 0)
+ ret = -1;
+
if (virtTestRun("XML-2-SEXPR Disk File",
1, testCompareDiskFile, NULL) != 0)
ret = -1;