In xl config, hvmloader is implied for hvm guests.  It is not
specified with the "kernel" option like xm config.  The "kernel"
option, along with "ramdisk" and "extra", is used for HVM direct
kernel boot.  Instead of using "kernel" option to populate
virDomainDef object's os.loader->path, use hvmloader discovered
when gathering capabilities.

This change required fixing initialization of capabilities in
the test utils and removing 'kernel = "/usr/lib/xen/boot/hvmloader"'
from the test config files.

Signed-off-by: Jim Fehlig <jfeh...@suse.com>
---
 src/xenconfig/xen_xl.c                        | 20 +++++++++++---------
 tests/testutilsxen.c                          |  8 +++++---
 tests/xlconfigdata/test-fullvirt-multiusb.cfg |  1 -
 tests/xlconfigdata/test-new-disk.cfg          |  1 -
 tests/xlconfigdata/test-spice.cfg             |  1 -
 5 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 1af162a..12050f3 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -59,16 +59,22 @@ extern int xlu_disk_parse(XLU_Config *cfg,
 #endif
 
 static int
-xenParseXLOS(virConfPtr conf, virDomainDefPtr def)
+xenParseXLOS(virConfPtr conf, virDomainDefPtr def, virCapsPtr caps)
 {
     size_t i;
 
     if (STREQ(def->os.type, "hvm")) {
         const char *boot;
 
-        if (VIR_ALLOC(def->os.loader) < 0 ||
-            xenConfigCopyString(conf, "kernel", &def->os.loader->path) < 0)
-            return -1;
+        for (i = 0; i < caps->nguests; i++) {
+            if (STREQ(caps->guests[i]->ostype, "hvm") &&
+                caps->guests[i]->arch.id == def->os.arch) {
+                if (VIR_ALLOC(def->os.loader) < 0 ||
+                    VIR_STRDUP(def->os.loader->path,
+                               caps->guests[i]->arch.defaultInfo.loader) < 0)
+                    return -1;
+            }
+        }
 
         if (xenConfigGetString(conf, "boot", &boot, "c") < 0)
             return -1;
@@ -423,7 +429,7 @@ xenParseXL(virConfPtr conf, virCapsPtr caps, int 
xendConfigVersion)
     if (xenParseConfigCommon(conf, def, caps, xendConfigVersion) < 0)
         goto cleanup;
 
-    if (xenParseXLOS(conf, def) < 0)
+    if (xenParseXLOS(conf, def, caps) < 0)
         goto cleanup;
 
     if (xenParseXLDisk(conf, def) < 0)
@@ -453,10 +459,6 @@ xenFormatXLOS(virConfPtr conf, virDomainDefPtr def)
         if (xenConfigSetString(conf, "builder", "hvm") < 0)
             return -1;
 
-        if (def->os.loader && def->os.loader->path &&
-            xenConfigSetString(conf, "kernel", def->os.loader->path) < 0)
-            return -1;
-
         for (i = 0; i < def->os.nBootDevs; i++) {
             switch (def->os.bootDevs[i]) {
             case VIR_DOMAIN_BOOT_FLOPPY:
diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c
index df1d124..c60e324 100644
--- a/tests/testutilsxen.c
+++ b/tests/testutilsxen.c
@@ -92,7 +92,8 @@ testXLInitCaps(void)
     if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == 
NULL)
         goto cleanup;
     if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_X86_64,
-                                         "/usr/lib/xen/bin/qemu-dm", NULL,
+                                         "/usr/lib/xen/bin/qemu-system-i386",
+                                         "/usr/lib/xen/boot/hvmloader",
                                          nmachines, machines)) == NULL)
         goto cleanup;
     machines = NULL;
@@ -104,8 +105,9 @@ testXLInitCaps(void)
         goto cleanup;
 
     if ((guest = virCapabilitiesAddGuest(caps, "xen", VIR_ARCH_X86_64,
-                                        "/usr/lib/xen/bin/qemu-dm", NULL,
-                                        nmachines, machines)) == NULL)
+                                         "/usr/lib/xen/bin/qemu-system-i386",
+                                         NULL,
+                                         nmachines, machines)) == NULL)
         goto cleanup;
     machines = NULL;
 
diff --git a/tests/xlconfigdata/test-fullvirt-multiusb.cfg 
b/tests/xlconfigdata/test-fullvirt-multiusb.cfg
index b9e1b0a..68a2614 100755
--- a/tests/xlconfigdata/test-fullvirt-multiusb.cfg
+++ b/tests/xlconfigdata/test-fullvirt-multiusb.cfg
@@ -22,7 +22,6 @@ vif = [ 
"mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=
 parallel = "none"
 serial = "none"
 builder = "hvm"
-kernel = "/usr/lib/xen/boot/hvmloader"
 boot = "d"
 disk = [ "/dev/HostVG/XenGuest2,raw,hda,w,backendtype=phy", 
"/root/boot.iso,raw,hdc,r,backendtype=qdisk,devtype=cdrom" ]
 usb = 1
diff --git a/tests/xlconfigdata/test-new-disk.cfg 
b/tests/xlconfigdata/test-new-disk.cfg
index 180ce92..9e9f106 100644
--- a/tests/xlconfigdata/test-new-disk.cfg
+++ b/tests/xlconfigdata/test-new-disk.cfg
@@ -21,6 +21,5 @@ vif = [ 
"mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=
 parallel = "none"
 serial = "none"
 builder = "hvm"
-kernel = "/usr/lib/xen/boot/hvmloader"
 boot = "d"
 disk = [ "/dev/HostVG/XenGuest2,raw,hda,w,backendtype=phy", 
"/var/lib/libvirt/images/XenGuest2-home,qcow2,hdb,w,backendtype=qdisk", 
"/root/boot.iso,raw,hdc,r,backendtype=qdisk,devtype=cdrom" ]
diff --git a/tests/xlconfigdata/test-spice.cfg 
b/tests/xlconfigdata/test-spice.cfg
index a97cd20..21f0e55 100644
--- a/tests/xlconfigdata/test-spice.cfg
+++ b/tests/xlconfigdata/test-spice.cfg
@@ -17,7 +17,6 @@ vif = [ 
"mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=
 parallel = "none"
 serial = "none"
 builder = "hvm"
-kernel = "/usr/lib/xen/boot/hvmloader"
 boot = "d"
 disk = [ "/dev/HostVG/XenGuest2,raw,hda,w,backendtype=phy", 
"/root/boot.iso,raw,hdc,r,backendtype=qdisk,devtype=cdrom" ]
 sdl = 0
-- 
1.8.4.5

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

Reply via email to