mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: Introduce qemuBuildNVRAMCommandLine
Add new function to manage adding the NVRAM device options to the command line removing that task from the mainline qemuBuildCommandLine. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
b12acd31af
commit
928d2ffe2a
@ -3522,6 +3522,42 @@ qemuBuildNVRAMDevStr(virDomainNVRAMDefPtr dev)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuBuildNVRAMCommandLine(virCommandPtr cmd,
|
||||||
|
const virDomainDef *def,
|
||||||
|
virQEMUCapsPtr qemuCaps)
|
||||||
|
{
|
||||||
|
if (!def->nvram)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (ARCH_IS_PPC64(def->os.arch) &&
|
||||||
|
STRPREFIX(def->os.machine, "pseries")) {
|
||||||
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVRAM)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("nvram device is not supported by "
|
||||||
|
"this QEMU binary"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *optstr;
|
||||||
|
virCommandAddArg(cmd, "-global");
|
||||||
|
optstr = qemuBuildNVRAMDevStr(def->nvram);
|
||||||
|
if (!optstr)
|
||||||
|
return -1;
|
||||||
|
if (optstr)
|
||||||
|
virCommandAddArg(cmd, optstr);
|
||||||
|
VIR_FREE(optstr);
|
||||||
|
} else {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("nvram device is only supported for PPC64"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
qemuBuildVirtioInputDevStr(const virDomainDef *def,
|
qemuBuildVirtioInputDevStr(const virDomainDef *def,
|
||||||
virDomainInputDefPtr dev,
|
virDomainInputDefPtr dev,
|
||||||
@ -9234,30 +9270,9 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
if (qemuBuildRNGCommandLine(logManager, cmd, def, qemuCaps) < 0)
|
if (qemuBuildRNGCommandLine(logManager, cmd, def, qemuCaps) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (def->nvram) {
|
if (qemuBuildNVRAMCommandLine(cmd, def, qemuCaps) < 0)
|
||||||
if (ARCH_IS_PPC64(def->os.arch) &&
|
goto error;
|
||||||
STRPREFIX(def->os.machine, "pseries")) {
|
|
||||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVRAM)) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("nvram device is not supported by "
|
|
||||||
"this QEMU binary"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *optstr;
|
|
||||||
virCommandAddArg(cmd, "-global");
|
|
||||||
optstr = qemuBuildNVRAMDevStr(def->nvram);
|
|
||||||
if (!optstr)
|
|
||||||
goto error;
|
|
||||||
if (optstr)
|
|
||||||
virCommandAddArg(cmd, optstr);
|
|
||||||
VIR_FREE(optstr);
|
|
||||||
} else {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("nvram device is only supported for PPC64"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (snapshot)
|
if (snapshot)
|
||||||
virCommandAddArgList(cmd, "-loadvm", snapshot->def->name, NULL);
|
virCommandAddArgList(cmd, "-loadvm", snapshot->def->name, NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user