render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c1c534
From 60d285eca3ab7003a7ebd03e3610616e0a657942 Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <60d285eca3ab7003a7ebd03e3610616e0a657942@dist-git>
c1c534
From: Michal Privoznik <mprivozn@redhat.com>
c1c534
Date: Mon, 20 Nov 2017 11:08:51 +0100
c1c534
Subject: [PATCH] qemuBuildDriveDevStr: Prefer default aliases for IDE bus
c1c534
c1c534
https://bugzilla.redhat.com/show_bug.cgi?id=1434451
c1c534
c1c534
When testing user aliases it was discovered that for 440fx
c1c534
machine type which has default IDE bus builtin, domain cannot
c1c534
start if IDE controller has the user provided alias. This is
c1c534
because for 440fx we don't put the IDE controller onto the
c1c534
command line (since it is builtin) and therefore any device that
c1c534
is plugged onto the bus must use the default alias.
c1c534
c1c534
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c1c534
(cherry picked from commit 9324f67a572f9b32f25bc088fb9f34e736edc612)
c1c534
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c1c534
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c1c534
---
c1c534
 src/qemu/qemu_command.c                               | 14 +++++++++++---
c1c534
 tests/qemuxml2argvdata/qemuxml2argv-user-aliases.args |  4 ++--
c1c534
 2 files changed, 13 insertions(+), 5 deletions(-)
c1c534
c1c534
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
c1c534
index aa7079229f..272ef610a3 100644
c1c534
--- a/src/qemu/qemu_command.c
c1c534
+++ b/src/qemu/qemu_command.c
c1c534
@@ -1947,9 +1947,17 @@ qemuBuildDriveDevStr(const virDomainDef *def,
c1c534
             virBufferAddLit(&opt, "ide-drive");
c1c534
         }
c1c534
 
c1c534
-        if (!(contAlias = virDomainControllerAliasFind(def, VIR_DOMAIN_CONTROLLER_TYPE_IDE,
c1c534
-                                                       disk->info.addr.drive.controller)))
c1c534
-           goto error;
c1c534
+        /* When domain has builtin IDE controller we don't put it onto cmd
c1c534
+         * line. Therefore we can't set its alias. In that case, use the
c1c534
+         * default one. */
c1c534
+        if (qemuDomainHasBuiltinIDE(def)) {
c1c534
+            contAlias = "ide";
c1c534
+        } else {
c1c534
+            if (!(contAlias = virDomainControllerAliasFind(def,
c1c534
+                                                           VIR_DOMAIN_CONTROLLER_TYPE_IDE,
c1c534
+                                                           disk->info.addr.drive.controller)))
c1c534
+                goto error;
c1c534
+        }
c1c534
         virBufferAsprintf(&opt, ",bus=%s.%d,unit=%d",
c1c534
                           contAlias,
c1c534
                           disk->info.addr.drive.bus,
c1c534
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.args b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.args
c1c534
index 62fbd567b1..1719c1bc88 100644
c1c534
--- a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.args
c1c534
+++ b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.args
c1c534
@@ -44,8 +44,8 @@ id=drive-ua-myEncryptedDisk1 \
c1c534
 id=ua-myEncryptedDisk1 \
c1c534
 -drive file=/home/zippy/tmp/install-amd64-minimal-20140619.iso,format=raw,\
c1c534
 if=none,media=cdrom,id=drive-ua-WhatAnAwesomeCDROM,readonly=on,cache=none \
c1c534
--device ide-drive,bus=ua-DoesAnybodyStillUseIDE.1,unit=0,\
c1c534
-drive=drive-ua-WhatAnAwesomeCDROM,id=ua-WhatAnAwesomeCDROM \
c1c534
+-device ide-drive,bus=ide.1,unit=0,drive=drive-ua-WhatAnAwesomeCDROM,\
c1c534
+id=ua-WhatAnAwesomeCDROM \
c1c534
 -device virtio-net-pci,vlan=0,id=ua-CheckoutThisNIC,mac=52:54:00:d6:c0:0b,\
c1c534
 bus=pci.0,addr=0x3 \
c1c534
 -net tap,fd=3,vlan=0,name=hostua-CheckoutThisNIC \
c1c534
-- 
c1c534
2.15.0
c1c534