]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: inline code for filling in per-VM NVRAM path
authorDaniel P. Berrangé <berrange@redhat.com>
Fri, 4 Feb 2022 14:30:38 +0000 (14:30 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 22 Feb 2022 14:55:58 +0000 (14:55 +0000)
Before creating a NVRAM path, the qemuDomainNVRAMPathGenerate
method checks whether the config is using the old style
firmware approach. This check is redundant in one of the two
callers. By inlining the check into the other caller, it makes
it clearer to understand that the NVRAM path filling is done
conditionally.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_firmware.c

index d4bc2c04addb3f5eed821c789f0e843c86890687..acc76c1cd6c6dc3ae4f4a2a8f89a1d4868c7b89b 100644 (file)
@@ -4451,7 +4451,9 @@ qemuDomainDefPostParse(virDomainDef *def,
         def->os.machine = g_strdup(machine);
     }
 
-    qemuDomainNVRAMPathGenerate(cfg, def);
+    if (virDomainDefHasOldStyleROUEFI(def) &&
+        !def->os.loader->nvram)
+        qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram);
 
     if (qemuDomainDefAddDefaultDevices(driver, def, qemuCaps) < 0)
         return -1;
@@ -10987,16 +10989,6 @@ qemuDomainNVRAMPathFormat(virQEMUDriverConfig *cfg,
 }
 
 
-void
-qemuDomainNVRAMPathGenerate(virQEMUDriverConfig *cfg,
-                            virDomainDef *def)
-{
-    if (virDomainDefHasOldStyleROUEFI(def) &&
-        !def->os.loader->nvram)
-        qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram);
-}
-
-
 virDomainEventSuspendedDetailType
 qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason)
 {
index a41db6c3277a93c37e96e6b952a1baa6c2d40fcb..be56b5dbb3316d7d9878e2656595d08504891859 100644 (file)
@@ -983,10 +983,6 @@ qemuDomainNVRAMPathFormat(virQEMUDriverConfig *cfg,
                           virDomainDef *def,
                           char **path);
 
-void
-qemuDomainNVRAMPathGenerate(virQEMUDriverConfig *cfg,
-                            virDomainDef *def);
-
 virDomainEventSuspendedDetailType
 qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason);
 
index ff364996b824b680b5a4fcae0c06406e0abf416f..209cc0046a61b89c7b25e0808af412946b48139d 100644 (file)
@@ -1139,11 +1139,12 @@ qemuFirmwareEnableFeatures(virQEMUDriver *driver,
         VIR_FREE(def->os.loader->templt);
         def->os.loader->templt = g_strdup(flash->nvram_template.filename);
 
-        qemuDomainNVRAMPathGenerate(cfg, def);
+        qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram);
 
-        VIR_DEBUG("decided on firmware '%s' varstore template '%s'",
+        VIR_DEBUG("decided on firmware '%s' template '%s' NVRAM '%s'",
                   def->os.loader->path,
-                  def->os.loader->templt);
+                  def->os.loader->templt,
+                  def->os.loader->nvram);
         break;
 
     case QEMU_FIRMWARE_DEVICE_KERNEL: