mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemuBuildPanicCommandLine: Generate via JSON
Format a JSON object with the device properties and then use qemuBuildDeviceCommandlineFromJSON to convert it to the standard commandline for now. The 'ioport' property of 'pvpanic' is a number in QEMU: ioport=<uint16> - (default: 1285) Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
ab92e9decb
commit
8617d29abb
@ -10187,25 +10187,36 @@ qemuBuildVMCoreInfoCommandLine(virCommand *cmd,
|
||||
|
||||
static int
|
||||
qemuBuildPanicCommandLine(virCommand *cmd,
|
||||
const virDomainDef *def)
|
||||
const virDomainDef *def,
|
||||
virQEMUCaps *qemuCaps)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < def->npanics; i++) {
|
||||
switch ((virDomainPanicModel) def->panics[i]->model) {
|
||||
case VIR_DOMAIN_PANIC_MODEL_ISA:
|
||||
switch (def->panics[i]->info.type) {
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA:
|
||||
virCommandAddArg(cmd, "-device");
|
||||
virCommandAddArgFormat(cmd, "pvpanic,ioport=%d",
|
||||
def->panics[i]->info.addr.isa.iobase);
|
||||
break;
|
||||
case VIR_DOMAIN_PANIC_MODEL_ISA: {
|
||||
g_autoptr(virJSONValue) props = NULL;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE:
|
||||
virCommandAddArgList(cmd, "-device", "pvpanic", NULL);
|
||||
break;
|
||||
if (virJSONValueObjectCreate(&props,
|
||||
"s:driver", "pvpanic",
|
||||
NULL) < 0)
|
||||
return -1;
|
||||
|
||||
/* pvpanic uses 'ioport' instead of 'iobase' so
|
||||
* qemuBuildDeviceAddressProps can't be used */
|
||||
if (def->panics[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) {
|
||||
if (virJSONValueObjectAdd(props,
|
||||
"u:ioport", def->panics[i]->info.addr.isa.iobase,
|
||||
NULL) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case VIR_DOMAIN_PANIC_MODEL_S390:
|
||||
case VIR_DOMAIN_PANIC_MODEL_HYPERV:
|
||||
case VIR_DOMAIN_PANIC_MODEL_PSERIES:
|
||||
@ -10870,7 +10881,7 @@ qemuBuildCommandLine(virQEMUDriver *driver,
|
||||
if (qemuBuildSeccompSandboxCommandLine(cmd, cfg, qemuCaps) < 0)
|
||||
return NULL;
|
||||
|
||||
if (qemuBuildPanicCommandLine(cmd, def) < 0)
|
||||
if (qemuBuildPanicCommandLine(cmd, def, qemuCaps) < 0)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < def->nshmems; i++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user