]> xenbits.xensource.com Git - libvirt.git/commitdiff
Separate isa-fdc options generation
authorJán Tomko <jtomko@redhat.com>
Mon, 22 Jun 2015 13:20:34 +0000 (15:20 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 8 Jul 2015 13:00:10 +0000 (15:00 +0200)
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

index 25a7bc621440e0d43e36507593cdc1d12be78251..8ecbe655b8ae8ce03071af0476c2a713eae67dfb 100644 (file)
@@ -9784,18 +9784,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");