[PATCH 039/103] qemuBuildVirtioDevGetConfig: Split up formatting of bus suffix

Peter Krempa pkrempa at redhat.com
Thu Oct 7 15:17:27 UTC 2021


Add the bus suffix in a separate call. This will make it more obvious
what's happening in the next commit.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_command.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e86c3bda22..b1ee5c6cb8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -808,6 +808,10 @@ qemuBuildVirtioDevGetConfig(virDomainDeviceDef *device,
     *disableLegacy = VIR_TRISTATE_SWITCH_ABSENT;
     *disableModern = VIR_TRISTATE_SWITCH_ABSENT;

+    qemuBuildVirtioDevGetConfigDev(device, &has_tmodel, &has_ntmodel);
+
+    virBufferAdd(&buf, baseName, -1);
+
     switch ((virDomainDeviceAddressType) info->type) {
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
         implName = "pci";
@@ -841,9 +845,7 @@ qemuBuildVirtioDevGetConfig(virDomainDeviceDef *device,
         return -1;
     }

-    virBufferAsprintf(&buf, "%s-%s", baseName, implName);
-
-    qemuBuildVirtioDevGetConfigDev(device, &has_tmodel, &has_ntmodel);
+    virBufferAsprintf(&buf, "-%s", implName);

     if (has_tmodel || has_ntmodel) {
         if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
-- 
2.31.1




More information about the libvir-list mailing list