mirror of https://gitee.com/openkylin/libvirt.git
xenconfig: don't use "kernel" for hvmloader
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.
This commit is contained in:
parent
717a92513d
commit
0fe504f15a
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" ]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue