[Libvir] dumpxml define not idempotent due to <bootlader/> tag

Guido Guenther agx at sigxcpu.org
Thu Feb 7 11:38:07 UTC 2008


Hi,
when using "virsh dumpxml <domain> > xmlfile" on a running paravirt xen
domain that has no bootloader entry whatsoever I get:

...
  <bootloader/>
  <os>
    <type>linux</type>
    <kernel>/boot/vmlinuz-vm</kernel>
    <initrd>/boot/initrd.img-vm</initrd>
    <cmdline>root=/dev/sda1 ro </cmdline>
  </os>
...

reimporting this via "virsh define xmlfile" and then dumping again gives
something like:
...
  <bootloader/>
  <os>
    <type>linux</type>
  </os>
...
since a bootloader tag is found the kernel and initrd entries are being
dropped. My hack is to ignore empty bootloader statements for the
moment:

diff --git a/src/xend_internal.c b/src/xend_internal.c
index fd38a61..5428cd7 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -1438,9 +1438,6 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root,
         if (tmp != NULL) {
             bootloader = 1;
             virBufferVSprintf(&buf, "  <bootloader>%s</bootloader>\n", tmp);
-        } else if (sexpr_has(root, "domain/bootloader")) {
-            bootloader = 1;
-            virBufferVSprintf(&buf, "  <bootloader/>\n");
         }
         tmp = sexpr_node(root, "domain/bootloader_args");
         if (tmp != NULL && bootloader) {

Would that be the right place to fix this?
Cheers,
 -- Guido




More information about the libvir-list mailing list