mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
qemu: Introduce qemuDomainDefBootPostParse()
Move all the boot related parts of qemuDomainDefPostParse() to a separate helper. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
7e12610387
commit
79e7d2c602
@ -4425,6 +4425,29 @@ qemuDomainRecheckInternalPaths(virDomainDef *def,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainDefBootPostParse(virDomainDef *def,
|
||||
virQEMUDriverConfig *cfg)
|
||||
{
|
||||
if (def->os.bootloader || def->os.bootloaderArgs) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("bootloader is not supported by QEMU"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainDefHasOldStyleROUEFI(def) &&
|
||||
!def->os.loader->nvram &&
|
||||
def->os.loader->stateless != VIR_TRISTATE_BOOL_YES) {
|
||||
def->os.loader->nvram = virStorageSourceNew();
|
||||
def->os.loader->nvram->type = VIR_STORAGE_TYPE_FILE;
|
||||
def->os.loader->nvram->format = VIR_STORAGE_FILE_RAW;
|
||||
qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram->path);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainDefMachinePostParse(virDomainDef *def,
|
||||
virQEMUCaps *qemuCaps)
|
||||
@ -4795,20 +4818,8 @@ qemuDomainDefPostParse(virDomainDef *def,
|
||||
if (qemuDomainDefMachinePostParse(def, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
if (def->os.bootloader || def->os.bootloaderArgs) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("bootloader is not supported by QEMU"));
|
||||
if (qemuDomainDefBootPostParse(def, cfg) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainDefHasOldStyleROUEFI(def) &&
|
||||
!def->os.loader->nvram &&
|
||||
def->os.loader->stateless != VIR_TRISTATE_BOOL_YES) {
|
||||
def->os.loader->nvram = virStorageSourceNew();
|
||||
def->os.loader->nvram->type = VIR_STORAGE_TYPE_FILE;
|
||||
def->os.loader->nvram->format = VIR_STORAGE_FILE_RAW;
|
||||
qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram->path);
|
||||
}
|
||||
|
||||
if (qemuDomainDefAddDefaultDevices(driver, def, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user