From 95c8d0b21eb78f9b3cdc9eee0f5936a3489e8793 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 30 Sep 2021 17:06:02 +0200 Subject: [PATCH] qemuBuildVirtioDevGetConfig: Split up formatting of bus suffix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- 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 6f968ff5d6..ee6b775843 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -815,6 +815,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"; @@ -848,9 +852,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) {