1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-26 03:21:44 +03:00

qemu: Remove pre-blockdev PFLASH setup

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-07-20 14:29:28 +02:00
parent 87fe53a551
commit e231bede44
2 changed files with 10 additions and 55 deletions

View File

@ -7100,8 +7100,7 @@ qemuBuildMachineCommandLine(virCommand *cmd,
}
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) &&
virDomainDefHasOldStyleUEFI(def)) {
if (virDomainDefHasOldStyleUEFI(def)) {
if (priv->pflash0)
virBufferAsprintf(&buf, ",pflash0=%s", priv->pflash0->nodeformat);
if (def->os.loader->nvram)
@ -9403,53 +9402,10 @@ qemuBuildRedirdevCommandLine(virCommand *cmd,
}
static void
qemuBuildDomainLoaderPflashCommandLine(virCommand *cmd,
virDomainLoaderDef *loader,
virQEMUCaps *qemuCaps)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
int unit = 0;
if (loader->secure == VIR_TRISTATE_BOOL_YES) {
virCommandAddArgList(cmd,
"-global",
"driver=cfi.pflash01,property=secure,value=on",
NULL);
}
/* with blockdev we instantiate the pflash when formatting -machine */
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV))
return;
virBufferAddLit(&buf, "file=");
virQEMUBuildBufferEscapeComma(&buf, loader->path);
virBufferAsprintf(&buf, ",if=pflash,format=raw,unit=%d", unit);
unit++;
if (loader->readonly) {
virBufferAsprintf(&buf, ",readonly=%s",
virTristateSwitchTypeToString(loader->readonly));
}
virCommandAddArg(cmd, "-drive");
virCommandAddArgBuffer(cmd, &buf);
if (loader->nvram) {
virBufferAddLit(&buf, "file=");
virQEMUBuildBufferEscapeComma(&buf, loader->nvram->path);
virBufferAsprintf(&buf, ",if=pflash,format=raw,unit=%d", unit);
virCommandAddArg(cmd, "-drive");
virCommandAddArgBuffer(cmd, &buf);
}
}
static void
qemuBuildDomainLoaderCommandLine(virCommand *cmd,
virDomainDef *def,
virQEMUCaps *qemuCaps)
virDomainDef *def)
{
virDomainLoaderDef *loader = def->os.loader;
@ -9463,7 +9419,12 @@ qemuBuildDomainLoaderCommandLine(virCommand *cmd,
break;
case VIR_DOMAIN_LOADER_TYPE_PFLASH:
qemuBuildDomainLoaderPflashCommandLine(cmd, loader, qemuCaps);
if (loader->secure == VIR_TRISTATE_BOOL_YES) {
virCommandAddArgList(cmd,
"-global",
"driver=cfi.pflash01,property=secure,value=on",
NULL);
}
break;
case VIR_DOMAIN_LOADER_TYPE_NONE:
@ -9898,9 +9859,6 @@ qemuBuildPflashBlockdevCommandLine(virCommand *cmd,
if (!virDomainDefHasOldStyleUEFI(vm->def))
return 0;
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
return 0;
if (priv->pflash0 &&
qemuBuildPflashBlockdevOne(cmd, priv->pflash0, priv->qemuCaps) < 0)
return -1;
@ -10306,7 +10264,7 @@ qemuBuildCommandLine(virDomainObj *vm,
if (qemuBuildCpuCommandLine(cmd, driver, def, qemuCaps) < 0)
return NULL;
qemuBuildDomainLoaderCommandLine(cmd, def, qemuCaps);
qemuBuildDomainLoaderCommandLine(cmd, def);
if (qemuBuildMemCommandLine(cmd, def, qemuCaps, priv) < 0)
return NULL;

View File

@ -11208,7 +11208,7 @@ qemuDomainSupportsCheckpointsBlockjobs(virDomainObj *vm)
* qemuDomainInitializePflashStorageSource:
*
* This helper converts the specification of the source of the 'loader' in case
* PFLASH is required to virStorageSources in case QEMU_CAPS_BLOCKDEV is present.
* PFLASH is required to virStorageSources.
*
* This helper is used in the intermediate state when we don't support full
* backing chains for pflash drives in the XML.
@ -11226,9 +11226,6 @@ qemuDomainInitializePflashStorageSource(virDomainObj *vm,
virDomainDef *def = vm->def;
g_autoptr(virStorageSource) pflash0 = NULL;
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
return 0;
if (!virDomainDefHasOldStyleUEFI(def))
return 0;