mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-09 15:00:07 +00:00
qemu: Build cmd line for pstore device
Nothing special going on here. Resolves: https://issues.redhat.com/browse/RHEL-24746 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
This commit is contained in:
parent
90e50e67c6
commit
3cfe4caa0a
@ -658,6 +658,14 @@ qemuAssignDeviceCryptoAlias(virDomainDef *def,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
qemuAssignDevicePstoreAlias(virDomainPstoreDef *pstore)
|
||||
{
|
||||
if (!pstore->info.alias)
|
||||
pstore->info.alias = g_strdup("pstore0");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuAssignDeviceAliases(virDomainDef *def)
|
||||
{
|
||||
@ -747,6 +755,8 @@ qemuAssignDeviceAliases(virDomainDef *def)
|
||||
for (i = 0; i < def->ncryptos; i++) {
|
||||
qemuAssignDeviceCryptoAlias(def, def->cryptos[i]);
|
||||
}
|
||||
if (def->pstore)
|
||||
qemuAssignDevicePstoreAlias(def->pstore);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -10341,6 +10341,53 @@ qemuBuildCryptoCommandLine(virCommand *cmd,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuBuildPstoreCommandLine(virCommand *cmd,
|
||||
const virDomainDef *def,
|
||||
virDomainPstoreDef *pstore,
|
||||
virQEMUCaps *qemuCaps)
|
||||
{
|
||||
g_autoptr(virJSONValue) devProps = NULL;
|
||||
g_autoptr(virJSONValue) memProps = NULL;
|
||||
g_autofree char *memAlias = NULL;
|
||||
|
||||
if (!pstore->info.alias) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("pstore device is missing alias"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
memAlias = g_strdup_printf("mem%s", pstore->info.alias);
|
||||
|
||||
if (qemuMonitorCreateObjectProps(&memProps,
|
||||
"memory-backend-file",
|
||||
memAlias,
|
||||
"s:mem-path", pstore->path,
|
||||
"U:size", pstore->size * 1024,
|
||||
"b:share", true,
|
||||
NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectAdd(&devProps,
|
||||
"s:driver", "acpi-erst",
|
||||
"s:id", pstore->info.alias,
|
||||
"s:memdev", memAlias,
|
||||
NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuBuildDeviceAddressProps(devProps, def, &pstore->info) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuBuildObjectCommandlineFromJSON(cmd, memProps, qemuCaps) < 0 ||
|
||||
qemuBuildDeviceCommandlineFromJSON(cmd, devProps, def, qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuBuildAsyncTeardownCommandLine(virCommand *cmd,
|
||||
const virDomainDef *def,
|
||||
@ -10699,6 +10746,10 @@ qemuBuildCommandLine(virDomainObj *vm,
|
||||
if (qemuBuildCryptoCommandLine(cmd, def, qemuCaps) < 0)
|
||||
return NULL;
|
||||
|
||||
if (def->pstore &&
|
||||
qemuBuildPstoreCommandLine(cmd, def, def->pstore, qemuCaps) < 0)
|
||||
return NULL;
|
||||
|
||||
if (qemuBuildAsyncTeardownCommandLine(cmd, def, qemuCaps) < 0)
|
||||
return NULL;
|
||||
|
||||
|
@ -33,4 +33,6 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
|
||||
-global ICH9-LPC.noreboot=off \
|
||||
-watchdog-action reset \
|
||||
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
|
||||
-object '{"qom-type":"memory-backend-file","id":"mempstore0","mem-path":"/tmp/guest_acpi_esrt","size":8192,"share":true}' \
|
||||
-device '{"driver":"acpi-erst","id":"pstore0","memdev":"mempstore0","bus":"pci.2","addr":"0x1"}' \
|
||||
-msg timestamp=on
|
||||
|
Loading…
Reference in New Issue
Block a user