mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-14 08:35:15 +00:00
Support network boot for HVM guests in libxl
The libxl driver ignored boot devices in the domain config, preventing PXE booting HVM domains. This patch accounts for user-specified boot devices when building the libxl domain configuration.
This commit is contained in:
parent
32bef82a2d
commit
f6b5ed5ef0
@ -438,6 +438,8 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_config *d_config)
|
|||||||
b_info->max_memkb = def->mem.max_balloon;
|
b_info->max_memkb = def->mem.max_balloon;
|
||||||
b_info->target_memkb = def->mem.cur_balloon;
|
b_info->target_memkb = def->mem.cur_balloon;
|
||||||
if (hvm) {
|
if (hvm) {
|
||||||
|
char bootorder[VIR_DOMAIN_BOOT_LAST + 1];
|
||||||
|
|
||||||
libxl_defbool_set(&b_info->u.hvm.pae,
|
libxl_defbool_set(&b_info->u.hvm.pae,
|
||||||
def->features & (1 << VIR_DOMAIN_FEATURE_PAE));
|
def->features & (1 << VIR_DOMAIN_FEATURE_PAE));
|
||||||
libxl_defbool_set(&b_info->u.hvm.apic,
|
libxl_defbool_set(&b_info->u.hvm.apic,
|
||||||
@ -450,6 +452,34 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_config *d_config)
|
|||||||
libxl_defbool_set(&b_info->u.hvm.hpet, 1);
|
libxl_defbool_set(&b_info->u.hvm.hpet, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (i = 0 ; i < def->os.nBootDevs ; i++) {
|
||||||
|
switch (def->os.bootDevs[i]) {
|
||||||
|
case VIR_DOMAIN_BOOT_FLOPPY:
|
||||||
|
bootorder[i] = 'a';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case VIR_DOMAIN_BOOT_DISK:
|
||||||
|
bootorder[i] = 'c';
|
||||||
|
break;
|
||||||
|
case VIR_DOMAIN_BOOT_CDROM:
|
||||||
|
bootorder[i] = 'd';
|
||||||
|
break;
|
||||||
|
case VIR_DOMAIN_BOOT_NET:
|
||||||
|
bootorder[i] = 'n';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (def->os.nBootDevs == 0) {
|
||||||
|
bootorder[0] = 'c';
|
||||||
|
bootorder[1] = '\0';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bootorder[def->os.nBootDevs] = '\0';
|
||||||
|
}
|
||||||
|
if ((b_info->u.hvm.boot = strdup(bootorder)) == NULL) {
|
||||||
|
virReportOOMError();
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following comment and calculation were taken directly from
|
* The following comment and calculation were taken directly from
|
||||||
|
Loading…
x
Reference in New Issue
Block a user