]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: command: Build the 'pflash' drives via -machine
authorPeter Krempa <pkrempa@redhat.com>
Fri, 15 Nov 2019 12:36:53 +0000 (13:36 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 22 Nov 2019 07:32:25 +0000 (08:32 +0100)
The old way to instantiate a pflash device via -drive was a hack since
it's a platform device.

The modern approach calls for configuring it via -machine and takes the
node name as an argument.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_command.c

index 3505a9817dcad9686b2b81bd89a008634468cba7..904ef56a03cfe1aec47bd879313914755aaea977 100644 (file)
@@ -7043,7 +7043,8 @@ static int
 qemuBuildMachineCommandLine(virCommandPtr cmd,
                             virQEMUDriverConfigPtr cfg,
                             const virDomainDef *def,
-                            virQEMUCapsPtr qemuCaps)
+                            virQEMUCapsPtr qemuCaps,
+                            qemuDomainObjPrivatePtr priv)
 {
     virTristateSwitch vmport = def->features[VIR_DOMAIN_FEATURE_VMPORT];
     virTristateSwitch smm = def->features[VIR_DOMAIN_FEATURE_SMM];
@@ -7343,6 +7344,13 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
     if (def->sev)
         virBufferAddLit(&buf, ",memory-encryption=sev0");
 
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
+        if (priv->pflash0)
+            virBufferAsprintf(&buf, ",pflash0=%s", priv->pflash0->nodeformat);
+        if (priv->pflash1)
+            virBufferAsprintf(&buf, ",pflash1=%s", priv->pflash1->nodeformat);
+    }
+
     virCommandAddArgBuffer(cmd, &buf);
 
     return 0;
@@ -10247,7 +10255,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
     if (enableFips)
         virCommandAddArg(cmd, "-enable-fips");
 
-    if (qemuBuildMachineCommandLine(cmd, cfg, def, qemuCaps) < 0)
+    if (qemuBuildMachineCommandLine(cmd, cfg, def, qemuCaps, priv) < 0)
         return NULL;
 
     qemuBuildTSEGCommandLine(cmd, def);