[PATCH 1/2] Separate isa-fdc options generation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For the implicit controller, we set them via -global.
Separating them will allow reuse for explicit fdc controller as well.

No functional impact apart from one extra allocation.
---
 src/qemu/qemu_command.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 5444638..418682d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9776,18 +9776,25 @@ qemuBuildCommandLine(virConnectPtr conn,
 
             if (withDeviceArg) {
                 if (disk->bus == VIR_DOMAIN_DISK_BUS_FDC) {
+                    if (virAsprintf(&optstr, "drive%c=drive-%s",
+                                    disk->info.addr.drive.unit ? 'B' : 'A',
+                                    disk->info.alias) < 0)
+                        goto error;
+
                     virCommandAddArg(cmd, "-global");
-                    virCommandAddArgFormat(cmd, "isa-fdc.drive%c=drive-%s",
-                                           disk->info.addr.drive.unit
-                                           ? 'B' : 'A',
-                                           disk->info.alias);
+                    virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr);
+                    VIR_FREE(optstr);
 
                     if (bootindex) {
+                        if (virAsprintf(&optstr, "bootindex%c=%d",
+                                        disk->info.addr.drive.unit
+                                        ? 'B' : 'A',
+                                        bootindex) < 0)
+                            goto error;
+
                         virCommandAddArg(cmd, "-global");
-                        virCommandAddArgFormat(cmd, "isa-fdc.bootindex%c=%d",
-                                               disk->info.addr.drive.unit
-                                               ? 'B' : 'A',
-                                               bootindex);
+                        virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr);
+                        VIR_FREE(optstr);
                     }
                 } else {
                     virCommandAddArg(cmd, "-device");
-- 
2.3.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]