diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index 72322a7bc7d3e51256c8725a06903f5a116b491b..15eaf1863bff5cf61331c1104c526d827189c327 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -125,6 +125,12 @@ xenParseSxprOS(const struct sexpr *node, STREQ(def->os.kernel, def->os.loader)) { VIR_FREE(def->os.kernel); } + /* Drop kernel argument that has no value */ + if (hvm && + def->os.kernel && *def->os.kernel == '\0' && + def->os.loader) { + VIR_FREE(def->os.kernel); + } if (!def->os.kernel && hvm) { diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.sexpr b/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.sexpr new file mode 100644 index 0000000000000000000000000000000000000000..ded668c7016586fa6137425c99ff83e259900d7c --- /dev/null +++ b/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.sexpr @@ -0,0 +1,9 @@ +(domain (domid 3)(name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)\ +(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')\ +(on_reboot 'restart')(on_crash 'restart')\ +(image (hvm (loader /usr/lib/xen/boot/hvmloader)(kernel '')\ +(device_model '/usr/lib64/xen/bin/qemu-dm')(boot d)(cdrom '/root/boot.iso')\ +(acpi 1)(vnc 1)(keymap ja)))(device (vbd (dev 'ioemu:hda')\ +(uname 'file:/root/foo.img')(mode 'w')))\ +(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')\ +(script 'vif-bridge')(type ioemu)))) diff --git a/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml b/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml new file mode 100644 index 0000000000000000000000000000000000000000..2c1c75683d70e9b9d1777621efad5da54c6a7929 --- /dev/null +++ b/tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml @@ -0,0 +1,41 @@ + + fvtest + b5d70dd2-75cd-aca5-1776-9660b059d8bc + 409600 + 409600 + 1 + + hvm + /usr/lib/xen/boot/hvmloader + + + + + + + destroy + restart + restart + + /usr/lib64/xen/bin/qemu-dm + + + + + + + + + + + + + + +