|
|
43fe83 |
From bdc09433303e6240ee0dca47642f39c41dd3fd8a Mon Sep 17 00:00:00 2001
|
|
|
43fe83 |
Message-Id: <bdc09433303e6240ee0dca47642f39c41dd3fd8a.1377873637.git.jdenemar@redhat.com>
|
|
|
43fe83 |
From: Laine Stump <laine@laine.org>
|
|
|
43fe83 |
Date: Tue, 6 Aug 2013 13:23:26 -0600
|
|
|
43fe83 |
Subject: [PATCH] qemu: enable using implicit sata controller in q35 machines
|
|
|
43fe83 |
|
|
|
43fe83 |
This patch is part of the resolution to:
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=819968
|
|
|
43fe83 |
|
|
|
43fe83 |
q35 machines have an implicit ahci (sata) controller at 00:1F.2 which
|
|
|
43fe83 |
has no "id" associated with it. For this reason, we can't refer to it
|
|
|
43fe83 |
as "ahci0". Instead, we don't give an id on the commandline, which
|
|
|
43fe83 |
qemu interprets as "use the first ahci controller". We then need to
|
|
|
43fe83 |
specify the unit with "unit=%d" rather than adding it onto the bus
|
|
|
43fe83 |
arg.
|
|
|
43fe83 |
(cherry picked from commit 83718cfe230dc4178940571090909b26d7af28d2)
|
|
|
43fe83 |
---
|
|
|
43fe83 |
src/qemu/qemu_command.c | 23 ++++++++++++++++++++---
|
|
|
43fe83 |
tests/qemuxml2argvdata/qemuxml2argv-q35.args | 2 ++
|
|
|
43fe83 |
tests/qemuxml2argvdata/qemuxml2argv-q35.xml | 5 +++++
|
|
|
43fe83 |
tests/qemuxml2argvtest.c | 2 +-
|
|
|
43fe83 |
tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml | 5 +++++
|
|
|
43fe83 |
5 files changed, 33 insertions(+), 4 deletions(-)
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
43fe83 |
index c7e7826..a8fce22 100644
|
|
|
43fe83 |
--- a/src/qemu/qemu_command.c
|
|
|
43fe83 |
+++ b/src/qemu/qemu_command.c
|
|
|
43fe83 |
@@ -4211,9 +4211,26 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
|
|
|
43fe83 |
virBufferAddLit(&opt, "ide-drive");
|
|
|
43fe83 |
}
|
|
|
43fe83 |
|
|
|
43fe83 |
- virBufferAsprintf(&opt, ",bus=ahci%d.%d",
|
|
|
43fe83 |
- disk->info.addr.drive.controller,
|
|
|
43fe83 |
- disk->info.addr.drive.unit);
|
|
|
43fe83 |
+ if (qemuDomainMachineIsQ35(def) &&
|
|
|
43fe83 |
+ disk->info.addr.drive.controller == 0) {
|
|
|
43fe83 |
+ /* Q35 machines have an implicit ahci (sata) controller at
|
|
|
43fe83 |
+ * 00:1F.2 which has no "id" associated with it. For this
|
|
|
43fe83 |
+ * reason, we can't refer to it as "ahci0". Instead, we
|
|
|
43fe83 |
+ * don't give an id, which qemu interprets as "use the
|
|
|
43fe83 |
+ * first ahci controller". We then need to specify the
|
|
|
43fe83 |
+ * unit with "unit=%d" rather than adding it onto the bus
|
|
|
43fe83 |
+ * arg.
|
|
|
43fe83 |
+ */
|
|
|
43fe83 |
+ virBufferAsprintf(&opt, ",unit=%d", disk->info.addr.drive.unit);
|
|
|
43fe83 |
+ } else {
|
|
|
43fe83 |
+ /* All other ahci controllers have been created by
|
|
|
43fe83 |
+ * libvirt, so they *do* have an id, and we can identify
|
|
|
43fe83 |
+ * them that way.
|
|
|
43fe83 |
+ */
|
|
|
43fe83 |
+ virBufferAsprintf(&opt, ",bus=ahci%d.%d",
|
|
|
43fe83 |
+ disk->info.addr.drive.controller,
|
|
|
43fe83 |
+ disk->info.addr.drive.unit);
|
|
|
43fe83 |
+ }
|
|
|
43fe83 |
break;
|
|
|
43fe83 |
case VIR_DOMAIN_DISK_BUS_VIRTIO:
|
|
|
43fe83 |
if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
|
|
|
43fe83 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-q35.args
|
|
|
43fe83 |
index 5ff4bc7..9e67be5 100644
|
|
|
43fe83 |
--- a/tests/qemuxml2argvdata/qemuxml2argv-q35.args
|
|
|
43fe83 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35.args
|
|
|
43fe83 |
@@ -3,4 +3,6 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
|
|
|
43fe83 |
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
|
|
|
43fe83 |
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x2 \
|
|
|
43fe83 |
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
|
|
|
43fe83 |
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \
|
|
|
43fe83 |
+-device ide-drive,unit=0,drive=drive-sata0-0-0,id=sata0-0-0 \
|
|
|
43fe83 |
-vga qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368
|
|
|
43fe83 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-q35.xml
|
|
|
43fe83 |
index 3541b14..edaf6cb 100644
|
|
|
43fe83 |
--- a/tests/qemuxml2argvdata/qemuxml2argv-q35.xml
|
|
|
43fe83 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35.xml
|
|
|
43fe83 |
@@ -14,6 +14,11 @@
|
|
|
43fe83 |
<on_crash>destroy</on_crash>
|
|
|
43fe83 |
<devices>
|
|
|
43fe83 |
<emulator>/usr/libexec/qemu-kvm</emulator>
|
|
|
43fe83 |
+ <disk type='block' device='disk'>
|
|
|
43fe83 |
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
|
|
43fe83 |
+ <target dev='sda' bus='sata'/>
|
|
|
43fe83 |
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
|
|
43fe83 |
+ </disk>
|
|
|
43fe83 |
<controller type='pci' index='0' model='pcie-root'/>
|
|
|
43fe83 |
<controller type='pci' index='1' model='dmi-to-pci-bridge'/>
|
|
|
43fe83 |
<controller type='pci' index='2' model='pci-bridge'/>
|
|
|
43fe83 |
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
|
|
43fe83 |
index 0068d27..679124e 100644
|
|
|
43fe83 |
--- a/tests/qemuxml2argvtest.c
|
|
|
43fe83 |
+++ b/tests/qemuxml2argvtest.c
|
|
|
43fe83 |
@@ -1001,7 +1001,7 @@ mymain(void)
|
|
|
43fe83 |
DO_TEST("q35",
|
|
|
43fe83 |
QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
|
|
|
43fe83 |
QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
|
|
|
43fe83 |
- QEMU_CAPS_ICH9_AHCI,
|
|
|
43fe83 |
+ QEMU_CAPS_DRIVE, QEMU_CAPS_ICH9_AHCI,
|
|
|
43fe83 |
QEMU_CAPS_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
|
|
|
43fe83 |
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL);
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml
|
|
|
43fe83 |
index 2a86e61..96f8eaf 100644
|
|
|
43fe83 |
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml
|
|
|
43fe83 |
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml
|
|
|
43fe83 |
@@ -14,6 +14,11 @@
|
|
|
43fe83 |
<on_crash>destroy</on_crash>
|
|
|
43fe83 |
<devices>
|
|
|
43fe83 |
<emulator>/usr/libexec/qemu-kvm</emulator>
|
|
|
43fe83 |
+ <disk type='block' device='disk'>
|
|
|
43fe83 |
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
|
|
43fe83 |
+ <target dev='sda' bus='sata'/>
|
|
|
43fe83 |
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
|
|
43fe83 |
+ </disk>
|
|
|
43fe83 |
<controller type='pci' index='0' model='pcie-root'/>
|
|
|
43fe83 |
<controller type='pci' index='1' model='dmi-to-pci-bridge'/>
|
|
|
43fe83 |
<controller type='pci' index='2' model='pci-bridge'/>
|
|
|
43fe83 |
--
|
|
|
43fe83 |
1.8.3.2
|
|
|
43fe83 |
|