libvirt updates for openSUSE12.1

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=166
This commit is contained in:
James Fehlig 2011-10-18 21:25:37 +00:00 committed by Git OBS Bridge
parent ccfcfc25f2
commit 3da5a7017e
4 changed files with 281 additions and 3 deletions

View File

@ -0,0 +1,244 @@
commit c1bc3d892c7388ad5c7c70a298107236717a009a
Author: Jim Fehlig <jfehlig@suse.com>
Date: Tue Sep 27 21:46:08 2011 -0600
Add AHCI support to qemu driver
Tested with multiple AHCI controllers and multiple disks attached
to a controller. E.g.,
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/test/disk0.raw'/>
<target dev='sda' bus='sata'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/test/disk1.raw'/>
<target dev='sdb' bus='sata'/>
<address type='drive' controller='0' bus='0' unit='1'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/test/disk2.raw'/>
<target dev='sdc' bus='sata'/>
<address type='drive' controller='1' bus='0' unit='0'/>
</disk>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</controller>
<controller type='sata' index='1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
Index: libvirt-0.9.6/docs/formatdomain.html.in
===================================================================
--- libvirt-0.9.6.orig/docs/formatdomain.html.in
+++ libvirt-0.9.6/docs/formatdomain.html.in
@@ -972,11 +972,12 @@
as a device ordering hint. The optional <code>bus</code>
attribute specifies the type of disk device to emulate;
possible values are driver specific, with typical values being
- "ide", "scsi", "virtio", "xen" or "usb". If omitted, the bus type is
- inferred from the style of the device name. eg, a device named 'sda'
- will typically be exported using a SCSI bus.
+ "ide", "scsi", "virtio", "xen", "usb" or "sata". If omitted, the bus
+ type is inferred from the style of the device name. eg, a device named
+ 'sda' will typically be exported using a SCSI bus.
<span class="since">Since 0.0.3; <code>bus</code> attribute since 0.4.3;
- "usb" attribute value since after 0.4.4</span></dd>
+ "usb" attribute value since after 0.4.4; "sata" attribute value since
+ 0.9.7</span></dd>
<dt><code>driver</code></dt>
<dd>
The optional driver element allows specifying further details
Index: libvirt-0.9.6/docs/schemas/domaincommon.rng
===================================================================
--- libvirt-0.9.6.orig/docs/schemas/domaincommon.rng
+++ libvirt-0.9.6/docs/schemas/domaincommon.rng
@@ -790,6 +790,7 @@
<value>xen</value>
<value>usb</value>
<value>uml</value>
+ <value>sata</value>
</choice>
</attribute>
</optional>
Index: libvirt-0.9.6/src/conf/domain_conf.c
===================================================================
--- libvirt-0.9.6.orig/src/conf/domain_conf.c
+++ libvirt-0.9.6/src/conf/domain_conf.c
@@ -2156,6 +2156,15 @@ virDomainDiskDefAssignAddress(virCapsPtr
def->info.addr.drive.unit = (idx % 2);
break;
+ case VIR_DOMAIN_DISK_BUS_SATA:
+ /* For SATA we define the default mapping to be 6 units
+ * per bus, 1 bus per controller, many controllers */
+ def->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE;
+ def->info.addr.drive.controller = idx / 6;
+ def->info.addr.drive.bus = 0;
+ def->info.addr.drive.unit = idx % 6;
+ break;
+
case VIR_DOMAIN_DISK_BUS_FDC:
/* For FDC we define the default mapping to be 2 units
* per bus, 1 bus per controller, many controllers */
@@ -8674,6 +8683,11 @@ int virDomainDefAddImplicitControllers(v
VIR_DOMAIN_DISK_BUS_IDE) < 0)
return -1;
+ if (virDomainDefAddDiskControllersForType(def,
+ VIR_DOMAIN_CONTROLLER_TYPE_SATA,
+ VIR_DOMAIN_DISK_BUS_SATA) < 0)
+ return -1;
+
if (virDomainDefMaybeAddVirtioSerialController(def) < 0)
return -1;
Index: libvirt-0.9.6/src/qemu/qemu_capabilities.c
===================================================================
--- libvirt-0.9.6.orig/src/qemu/qemu_capabilities.c
+++ libvirt-0.9.6/src/qemu/qemu_capabilities.c
@@ -136,6 +136,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
"pci-ohci",
"usb-redir",
"usb-hub",
+ "ich9-ahci",
);
struct qemu_feature_flags {
@@ -1227,6 +1228,8 @@ qemuCapsParseDeviceStr(const char *str,
qemuCapsSet(flags, QEMU_CAPS_USB_REDIR);
if (strstr(str, "name \"usb-hub\""))
qemuCapsSet(flags, QEMU_CAPS_USB_HUB);
+ if (strstr(str, "name \"ich9-ahci\""))
+ qemuCapsSet(flags, QEMU_CAPS_ICH9_AHCI);
/* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */
if (!qemuCapsGet(flags, QEMU_CAPS_CHARDEV_SPICEVMC) &&
Index: libvirt-0.9.6/src/qemu/qemu_capabilities.h
===================================================================
--- libvirt-0.9.6.orig/src/qemu/qemu_capabilities.h
+++ libvirt-0.9.6/src/qemu/qemu_capabilities.h
@@ -110,6 +110,7 @@ enum qemuCapsFlags {
QEMU_CAPS_PCI_OHCI = 71, /* -device pci-ohci */
QEMU_CAPS_USB_REDIR = 72, /* -device usb-redir */
QEMU_CAPS_USB_HUB = 73, /* -device usb-hub */
+ QEMU_CAPS_ICH9_AHCI = 74, /* -device ich9-ahci */
QEMU_CAPS_LAST, /* this must always be the last item */
};
Index: libvirt-0.9.6/src/qemu/qemu_command.c
===================================================================
--- libvirt-0.9.6.orig/src/qemu/qemu_command.c
+++ libvirt-0.9.6/src/qemu/qemu_command.c
@@ -1694,6 +1694,12 @@ qemuBuildDriveDevStr(virDomainDiskDefPtr
disk->info.addr.drive.bus,
disk->info.addr.drive.unit);
break;
+ case VIR_DOMAIN_DISK_BUS_SATA:
+ virBufferAddLit(&opt, "ide-drive");
+ virBufferAsprintf(&opt, ",bus=ahci%d.%d",
+ disk->info.addr.drive.controller,
+ disk->info.addr.drive.unit);
+ break;
case VIR_DOMAIN_DISK_BUS_VIRTIO:
virBufferAddLit(&opt, "virtio-blk-pci");
qemuBuildIoEventFdStr(&opt, disk->ioeventfd, qemuCaps);
@@ -1894,6 +1900,10 @@ qemuBuildControllerDevStr(virDomainContr
virBufferAsprintf(&buf, "usb-ccid,id=ccid%d", def->idx);
break;
+ case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
+ virBufferAsprintf(&buf, "ahci,id=ahci%d", def->idx);
+ break;
+
case VIR_DOMAIN_CONTROLLER_TYPE_USB:
if (qemuBuildUSBControllerDevStr(def, qemuCaps, &buf) == -1)
goto error;
@@ -3675,14 +3685,22 @@ qemuBuildCommandLine(virConnectPtr conn,
cont->type == VIR_DOMAIN_CONTROLLER_TYPE_FDC)
continue;
- /* QEMU doesn't implement a SATA driver */
+ /* Only recent QEMU implements a SATA (AHCI) controller */
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
- qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- "%s", _("SATA is not supported with this QEMU binary"));
- goto error;
- }
+ if (!qemuCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("SATA is not supported with this QEMU binary"));
+ goto error;
+ } else {
+ char *devstr;
+
+ virCommandAddArg(cmd, "-device");
+ if (!(devstr = qemuBuildControllerDevStr(cont, qemuCaps, NULL)))
+ goto error;
- if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
+ virCommandAddArg(cmd, devstr);
+ }
+ } else if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
def->controllers[i]->model == -1 &&
!qemuCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
if (usblegacy) {
Index: libvirt-0.9.6/tests/qemuxml2argvdata/qemuxml2argv-disk-sata-device.args
===================================================================
--- /dev/null
+++ libvirt-0.9.6/tests/qemuxml2argvdata/qemuxml2argv-disk-sata-device.args
@@ -0,0 +1,6 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
+pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor \
+unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -device ahci,id=ahci0,\
+bus=pci.0,addr=0x3 -drive file=/dev/HostVG/QEMUGuest1,if=none,\
+id=drive-sata0-0-0 -device ide-drive,bus=ahci0.0,drive=drive-sata0-0-0,\
+id=sata0-0-0 -usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
Index: libvirt-0.9.6/tests/qemuxml2argvdata/qemuxml2argv-disk-sata-device.xml
===================================================================
--- /dev/null
+++ libvirt-0.9.6/tests/qemuxml2argvdata/qemuxml2argv-disk-sata-device.xml
@@ -0,0 +1,25 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219136</memory>
+ <currentMemory>219136</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sda' bus='sata'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
+ </disk>
+ <controller type='sata' index='0'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
Index: libvirt-0.9.6/tests/qemuxml2argvtest.c
===================================================================
--- libvirt-0.9.6.orig/tests/qemuxml2argvtest.c
+++ libvirt-0.9.6/tests/qemuxml2argvtest.c
@@ -356,6 +356,9 @@ mymain(void)
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
DO_TEST("disk-scsi-device-auto", false,
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
+ DO_TEST("disk-sata-device", false,
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE,
+ QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_ICH9_AHCI);
DO_TEST("disk-aio", false,
QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_AIO,
QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Oct 18 15:20:11 MDT 2011 - jfehlig@suse.com
- Add AHCI controller support to qemu driver
c1bc3d89-qemu-add-ahci.patch
- Set security driver to 'none' in /etc/libvirt/qemu.conf. Users
must opt-in for Apparmor confinement of qemu instances.
suse-qemu-conf.patch
-------------------------------------------------------------------
Thu Sep 22 21:08:11 MDT 2011 - jfehlig@suse.com

View File

@ -374,6 +374,10 @@ Source1: libvirtd.init
Source2: libvirtd-relocation-server.fw
Source99: baselibs.conf
# Upstream patches
# This patch reverts commit f84aedad, which is not needed since
# the openSUSE kvm package is patched with qemu 'no-shutdown' fix
Patch0: f84aedad-revert.patch
Patch1: c1bc3d89-qemu-add-ahci.patch
# Need to go upstream
Patch100: xen-name-for-devid.patch
Patch101: clone.patch
@ -382,9 +386,7 @@ Patch103: xend-disk-order.patch
# Our patches
Patch200: libvirtd-defaults.patch
Patch201: use-init-script-redhat.patch
# This patch reverts commit f84aedad, which is not needed since
# affected SUSE kvm packages have the necessary qemu fix.
Patch202: f84aedad-revert.patch
Patch202: suse-qemu-conf.patch
%if %{with_apparmor}
Patch250: install-apparmor-profiles.patch
%endif
@ -499,6 +501,8 @@ Authors:
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch100 -p1
%patch101
%patch102 -p1

21
suse-qemu-conf.patch Normal file
View File

@ -0,0 +1,21 @@
Index: libvirt-0.9.6/src/qemu/qemu.conf
===================================================================
--- libvirt-0.9.6.orig/src/qemu/qemu.conf
+++ libvirt-0.9.6/src/qemu/qemu.conf
@@ -136,7 +136,16 @@
# leaving SELinux enabled for the host in general, then set this
# to 'none' instead.
#
+# SUSE Note:
+# Currently, Apparmor is the default security framework in SUSE
+# distros. If Apparmor is enabled on the host, libvirtd is
+# generously confined but users must opt-in to confine qemu
+# instances. Change this to 'apparmor' to enable Apparmor
+# confinement of qemu instances.
+#
# security_driver = "selinux"
+# security_driver = "apparmor"
+security_driver = "none"
# The user ID for QEMU processes run by the system instance.