7a3408
From 699ce9cb3514bc0458ab61e4e82b725922011dbd Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <699ce9cb3514bc0458ab61e4e82b725922011dbd@dist-git>
7a3408
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
7a3408
Date: Wed, 8 Jul 2015 15:56:46 +0200
7a3408
Subject: [PATCH] Separate isa-fdc options generation
7a3408
MIME-Version: 1.0
7a3408
Content-Type: text/plain; charset=UTF-8
7a3408
Content-Transfer-Encoding: 8bit
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1227880
7a3408
7a3408
For the implicit controller, we set them via -global.
7a3408
Separating them will allow reuse for explicit fdc controller as well.
7a3408
7a3408
No functional impact apart from one extra allocation.
7a3408
7a3408
(cherry picked from commit 4ef21ec192f0de6e638d22b6a406cd87744f6b99)
7a3408
Signed-off-by: Ján Tomko <jtomko@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_command.c | 23 +++++++++++++++--------
7a3408
 1 file changed, 15 insertions(+), 8 deletions(-)
7a3408
7a3408
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
7a3408
index ca14ffc..d8ce22f 100644
7a3408
--- a/src/qemu/qemu_command.c
7a3408
+++ b/src/qemu/qemu_command.c
7a3408
@@ -9805,18 +9805,25 @@ qemuBuildCommandLine(virConnectPtr conn,
7a3408
 
7a3408
             if (withDeviceArg) {
7a3408
                 if (disk->bus == VIR_DOMAIN_DISK_BUS_FDC) {
7a3408
+                    if (virAsprintf(&optstr, "drive%c=drive-%s",
7a3408
+                                    disk->info.addr.drive.unit ? 'B' : 'A',
7a3408
+                                    disk->info.alias) < 0)
7a3408
+                        goto error;
7a3408
+
7a3408
                     virCommandAddArg(cmd, "-global");
7a3408
-                    virCommandAddArgFormat(cmd, "isa-fdc.drive%c=drive-%s",
7a3408
-                                           disk->info.addr.drive.unit
7a3408
-                                           ? 'B' : 'A',
7a3408
-                                           disk->info.alias);
7a3408
+                    virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr);
7a3408
+                    VIR_FREE(optstr);
7a3408
 
7a3408
                     if (bootindex) {
7a3408
+                        if (virAsprintf(&optstr, "bootindex%c=%d",
7a3408
+                                        disk->info.addr.drive.unit
7a3408
+                                        ? 'B' : 'A',
7a3408
+                                        bootindex) < 0)
7a3408
+                            goto error;
7a3408
+
7a3408
                         virCommandAddArg(cmd, "-global");
7a3408
-                        virCommandAddArgFormat(cmd, "isa-fdc.bootindex%c=%d",
7a3408
-                                               disk->info.addr.drive.unit
7a3408
-                                               ? 'B' : 'A',
7a3408
-                                               bootindex);
7a3408
+                        virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr);
7a3408
+                        VIR_FREE(optstr);
7a3408
                     }
7a3408
                 } else {
7a3408
                     virCommandAddArg(cmd, "-device");
7a3408
-- 
7a3408
2.4.5
7a3408