mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
qemu: Use 'def->os.loader->nvram' directly instead of 'priv->pflash1'
Since we now have a full virStorageSource for storing the nvram path we don't need the extra dance of transferring the data into the 'pflash1' variable which was an intermediary solution to use -blockdev. For now we keep it functionally identical to the previous impl. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
This commit is contained in:
parent
911c3cb2f0
commit
5709b31f35
@ -7142,11 +7142,12 @@ qemuBuildMachineCommandLine(virCommand *cmd,
|
||||
}
|
||||
}
|
||||
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) &&
|
||||
virDomainDefHasOldStyleUEFI(def)) {
|
||||
if (priv->pflash0)
|
||||
virBufferAsprintf(&buf, ",pflash0=%s", priv->pflash0->nodeformat);
|
||||
if (priv->pflash1)
|
||||
virBufferAsprintf(&buf, ",pflash1=%s", priv->pflash1->nodeformat);
|
||||
if (def->os.loader->nvram)
|
||||
virBufferAsprintf(&buf, ",pflash1=%s", def->os.loader->nvram->nodeformat);
|
||||
}
|
||||
|
||||
if (virDomainNumaHasHMAT(def->numa))
|
||||
@ -10148,6 +10149,9 @@ qemuBuildPflashBlockdevCommandLine(virCommand *cmd,
|
||||
{
|
||||
qemuDomainObjPrivate *priv = vm->privateData;
|
||||
|
||||
if (!virDomainDefHasOldStyleUEFI(vm->def))
|
||||
return 0;
|
||||
|
||||
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
|
||||
return 0;
|
||||
|
||||
@ -10155,8 +10159,8 @@ qemuBuildPflashBlockdevCommandLine(virCommand *cmd,
|
||||
qemuBuildPflashBlockdevOne(cmd, priv->pflash0, priv->qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
if (priv->pflash1 &&
|
||||
qemuBuildPflashBlockdevOne(cmd, priv->pflash1, priv->qemuCaps) < 0)
|
||||
if (vm->def->os.loader->nvram &&
|
||||
qemuBuildPflashBlockdevOne(cmd, vm->def->os.loader->nvram, priv->qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -1698,7 +1698,6 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivate *priv)
|
||||
virHashRemoveAll(priv->blockjobs);
|
||||
|
||||
g_clear_pointer(&priv->pflash0, virObjectUnref);
|
||||
g_clear_pointer(&priv->pflash1, virObjectUnref);
|
||||
g_clear_pointer(&priv->backup, virDomainBackupDefFree);
|
||||
|
||||
/* reset node name allocator */
|
||||
@ -11317,7 +11316,6 @@ qemuDomainInitializePflashStorageSource(virDomainObj *vm)
|
||||
qemuDomainObjPrivate *priv = vm->privateData;
|
||||
virDomainDef *def = vm->def;
|
||||
g_autoptr(virStorageSource) pflash0 = NULL;
|
||||
g_autoptr(virStorageSource) pflash1 = NULL;
|
||||
|
||||
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
|
||||
return 0;
|
||||
@ -11336,17 +11334,11 @@ qemuDomainInitializePflashStorageSource(virDomainObj *vm)
|
||||
|
||||
|
||||
if (def->os.loader->nvram) {
|
||||
pflash1 = virStorageSourceNew();
|
||||
pflash1->type = VIR_STORAGE_TYPE_FILE;
|
||||
pflash1->format = VIR_STORAGE_FILE_RAW;
|
||||
pflash1->path = g_strdup(def->os.loader->nvram->path);
|
||||
pflash1->readonly = false;
|
||||
pflash1->nodeformat = g_strdup("libvirt-pflash1-format");
|
||||
pflash1->nodestorage = g_strdup("libvirt-pflash1-storage");
|
||||
def->os.loader->nvram->nodeformat = g_strdup("libvirt-pflash1-format");
|
||||
def->os.loader->nvram->nodestorage = g_strdup("libvirt-pflash1-storage");
|
||||
}
|
||||
|
||||
priv->pflash0 = g_steal_pointer(&pflash0);
|
||||
priv->pflash1 = g_steal_pointer(&pflash1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -231,7 +231,6 @@ struct _qemuDomainObjPrivate {
|
||||
* pointers hold the temporary virStorageSources for creating the -blockdev
|
||||
* commandline for pflash drives. */
|
||||
virStorageSource *pflash0;
|
||||
virStorageSource *pflash1;
|
||||
|
||||
/* running backup job */
|
||||
virDomainBackupDef *backup;
|
||||
|
Loading…
x
Reference in New Issue
Block a user