static void
qemuBuldDomainLoaderPflashCommandLine(virCommandPtr cmd,
- virDomainLoaderDefPtr loader)
+ virDomainLoaderDefPtr loader,
+ virQEMUCapsPtr qemuCaps)
{
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
int unit = 0;
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);
static void
qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
- virDomainDefPtr def)
+ virDomainDefPtr def,
+ virQEMUCapsPtr qemuCaps)
{
virDomainLoaderDefPtr loader = def->os.loader;
break;
case VIR_DOMAIN_LOADER_TYPE_PFLASH:
- qemuBuldDomainLoaderPflashCommandLine(cmd, loader);
+ qemuBuldDomainLoaderPflashCommandLine(cmd, loader, qemuCaps);
break;
case VIR_DOMAIN_LOADER_TYPE_NONE:
if (qemuBuildCpuCommandLine(cmd, driver, def, qemuCaps) < 0)
return NULL;
- qemuBuildDomainLoaderCommandLine(cmd, def);
+ qemuBuildDomainLoaderCommandLine(cmd, def, qemuCaps);
if (!migrateURI && !snapshot && qemuDomainAlignMemorySizes(def) < 0)
return NULL;
VIR_DEBUG("Prepare bios/uefi paths");
if (qemuFirmwareFillDomain(driver, vm, flags) < 0)
goto cleanup;
+ if (qemuDomainInitializePflashStorageSource(vm) < 0)
+ goto cleanup;
VIR_DEBUG("Preparing external devices");
if (qemuExtDevicesPrepareDomain(driver, vm) < 0)
if (qemuDomainPerfRestart(obj) < 0)
goto error;
+ /* recreate the pflash storage sources */
+ if (qemuDomainInitializePflashStorageSource(obj) < 0)
+ goto error;
+
/* XXX: Need to change as long as lock is introduced for
* qemu_driver->sharedDevices.
*/