forked from pool/libvirt
Accepting request 156381 from Virtualization
Collection of bug fixes for libvirt 1.0.2 package. Please copy to 12.3 if that is still an option. Thanks! - Fix detach of managed PCI devices from inactive domains. Detected while running test cases for FATE #313570. Modified xen-name-for-devid.patch - spec: Fix installation of default network - Fix default setting of backend field of libxl_device_disk 567779e5-libxl-default-disk-backend.patch rhb#912488 - Fix build on IA64 Modified clone.patch OBS-URL: https://build.opensuse.org/request/show/156381 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libvirt?expand=0&rev=114
This commit is contained in:
commit
0b4a50c0a4
38
567779e5-libxl-default-disk-backend.patch
Normal file
38
567779e5-libxl-default-disk-backend.patch
Normal file
@ -0,0 +1,38 @@
|
||||
commit 567779e51a7727b021dee095c9d75cf0cde0bd43
|
||||
Author: Jim Fehlig <jfehlig@suse.com>
|
||||
Date: Wed Feb 20 13:02:28 2013 -0700
|
||||
|
||||
libxl: Fix setting of disk backend
|
||||
|
||||
The libxl driver was setting the backend field of libxl_device_disk
|
||||
structure to LIBXL_DISK_BACKEND_TAP when the driver element of disk
|
||||
configuration was not specified. This needlessly forces the use of
|
||||
blktap driver, which may not be loaded in dom0
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=912488
|
||||
|
||||
Ian Campbell suggested that LIBXL_DISK_BACKEND_UNKNOWN is a better
|
||||
default in this case
|
||||
|
||||
https://www.redhat.com/archives/libvir-list/2013-February/msg01126.html
|
||||
|
||||
Index: libvirt-1.0.2/src/libxl/libxl_conf.c
|
||||
===================================================================
|
||||
--- libvirt-1.0.2.orig/src/libxl/libxl_conf.c
|
||||
+++ libvirt-1.0.2/src/libxl/libxl_conf.c
|
||||
@@ -525,9 +525,13 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
- /* No driverName - default to raw/tap?? */
|
||||
+ /*
|
||||
+ * If driverName is not specified, default to raw as per
|
||||
+ * xl-disk-configuration.txt in the xen documentation and let
|
||||
+ * libxl pick a suitable backend.
|
||||
+ */
|
||||
x_disk->format = LIBXL_DISK_FORMAT_RAW;
|
||||
- x_disk->backend = LIBXL_DISK_BACKEND_TAP;
|
||||
+ x_disk->backend = LIBXL_DISK_BACKEND_UNKNOWN;
|
||||
}
|
||||
|
||||
/* XXX is this right? */
|
40
clone.patch
40
clone.patch
@ -2,7 +2,39 @@ Index: src/lxc/lxc_container.c
|
||||
===================================================================
|
||||
--- src/lxc/lxc_container.c.orig
|
||||
+++ src/lxc/lxc_container.c
|
||||
@@ -2358,6 +2358,9 @@ int lxcContainerStart(virDomainDefPtr de
|
||||
@@ -136,6 +136,7 @@ int lxcContainerHasReboot(void)
|
||||
int cmd, v;
|
||||
int status;
|
||||
char *tmp;
|
||||
+ int stacksize = getpagesize() * 4;
|
||||
|
||||
if (virFileReadAll("/proc/sys/kernel/ctrl-alt-del", 10, &buf) < 0)
|
||||
return -1;
|
||||
@@ -152,14 +153,21 @@ int lxcContainerHasReboot(void)
|
||||
VIR_FREE(buf);
|
||||
cmd = v ? LINUX_REBOOT_CMD_CAD_ON : LINUX_REBOOT_CMD_CAD_OFF;
|
||||
|
||||
- if (VIR_ALLOC_N(stack, getpagesize() * 4) < 0) {
|
||||
+#ifdef __ia64__
|
||||
+ stacksize *= 2;
|
||||
+#endif
|
||||
+ if (VIR_ALLOC_N(stack, stacksize) < 0) {
|
||||
virReportOOMError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
- childStack = stack + (getpagesize() * 4);
|
||||
+ childStack = stack + stacksize;
|
||||
|
||||
+#ifdef __ia64__
|
||||
+ cpid = __clone2(lxcContainerRebootChild, stack, stacksize, flags, &cmd);
|
||||
+#else
|
||||
cpid = clone(lxcContainerRebootChild, childStack, flags, &cmd);
|
||||
+#endif
|
||||
VIR_FREE(stack);
|
||||
if (cpid < 0) {
|
||||
virReportSystemError(errno, "%s",
|
||||
@@ -2358,6 +2366,9 @@ int lxcContainerStart(virDomainDefPtr de
|
||||
ttyPaths, nttyPaths, handshakefd};
|
||||
|
||||
/* allocate a stack for the container */
|
||||
@ -12,7 +44,7 @@ Index: src/lxc/lxc_container.c
|
||||
if (VIR_ALLOC_N(stack, stacksize) < 0) {
|
||||
virReportOOMError();
|
||||
return -1;
|
||||
@@ -2377,7 +2380,11 @@ int lxcContainerStart(virDomainDefPtr de
|
||||
@@ -2377,7 +2388,11 @@ int lxcContainerStart(virDomainDefPtr de
|
||||
cflags |= CLONE_NEWNET;
|
||||
}
|
||||
|
||||
@ -24,7 +56,7 @@ Index: src/lxc/lxc_container.c
|
||||
VIR_FREE(stack);
|
||||
VIR_DEBUG("clone() completed, new container PID is %d", pid);
|
||||
|
||||
@@ -2403,6 +2410,7 @@ int lxcContainerAvailable(int features)
|
||||
@@ -2403,6 +2418,7 @@ int lxcContainerAvailable(int features)
|
||||
int cpid;
|
||||
char *childStack;
|
||||
char *stack;
|
||||
@ -32,7 +64,7 @@ Index: src/lxc/lxc_container.c
|
||||
|
||||
if (features & LXC_CONTAINER_FEATURE_USER)
|
||||
flags |= CLONE_NEWUSER;
|
||||
@@ -2410,14 +2418,21 @@ int lxcContainerAvailable(int features)
|
||||
@@ -2410,14 +2426,21 @@ int lxcContainerAvailable(int features)
|
||||
if (features & LXC_CONTAINER_FEATURE_NET)
|
||||
flags |= CLONE_NEWNET;
|
||||
|
||||
|
@ -1,3 +1,28 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 25 12:30:24 MST 2013 - jfehlig@suse.com
|
||||
|
||||
- Fix detach of managed PCI devices from inactive domains.
|
||||
Detected while running test cases for FATE #313570.
|
||||
Modified xen-name-for-devid.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 21 15:48:39 MST 2013 - jfehlig@suse.com
|
||||
|
||||
- spec: Fix installation of default network
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 20 16:37:03 MST 2013 - jfehlig@suse.com
|
||||
|
||||
- Fix default setting of backend field of libxl_device_disk
|
||||
567779e5-libxl-default-disk-backend.patch
|
||||
rhb#912488
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 12 16:17:36 MST 2013 - jfehlig@suse.com
|
||||
|
||||
- Fix build on IA64
|
||||
Modified clone.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 7 10:23:10 MST 2013 - jfehlig@suse.com
|
||||
|
||||
|
@ -419,6 +419,7 @@ Source99: baselibs.conf
|
||||
# Upstream patches
|
||||
Patch0: a6b8bae5-python-generator-fix1.patch
|
||||
Patch1: 25ea8e47-python-generator-fix2.patch
|
||||
Patch2: 567779e5-libxl-default-disk-backend.patch
|
||||
# Need to go upstream
|
||||
Patch100: xen-name-for-devid.patch
|
||||
Patch101: clone.patch
|
||||
@ -560,6 +561,7 @@ Authors:
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch100 -p1
|
||||
%patch101
|
||||
%patch102 -p1
|
||||
@ -858,7 +860,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%if %{with_libvirtd}
|
||||
%if %{with_network}
|
||||
# Install the default network if one doesn't exist
|
||||
if ! /sbin/chkconfig libvirtd && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml
|
||||
if test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml
|
||||
then
|
||||
UUID=`/usr/bin/uuidgen`
|
||||
sed -e "s,</name>,</name>\n <uuid>$UUID</uuid>," \
|
||||
|
@ -1,17 +1,18 @@
|
||||
commit 7906a668fa8d5c21cc729db8a13b08e3dd1d241f
|
||||
Author: Jim Fehlig <jfehlig@novell.com>
|
||||
Date: Wed Jan 27 16:11:41 2010 -0700
|
||||
Do not search xenstore for disk/network/PCI device IDs
|
||||
|
||||
Disk, network, and PCI devices can be referenced by name in Xen,
|
||||
e.g. when modifying their configuration or remvoving them. As such,
|
||||
don't search xenstore for a device ID corresponding to these devices.
|
||||
Instead, search the devices contained in the domain definition and use
|
||||
the devices's target name if found.
|
||||
|
||||
Do not search xenstore for disk device IDs
|
||||
Note that for network devices, the mac address is used for the device
|
||||
name. For PCI devices, the bdf (bus:dev:fun) specifier is used for
|
||||
the device name.
|
||||
|
||||
Disk devices can be referenced by name in Xen, e.g. when modifying
|
||||
their configuration or remvoving them. As such, don't search
|
||||
xenstore for a device ID corresponding to the disk device. Instead,
|
||||
search the disks contained in the domain definition and use the
|
||||
disk's target name if found.
|
||||
|
||||
This approach allows removing a disk when domain is inactive. We
|
||||
obviously can't search xenstore when the domain is inactive.
|
||||
This approach allows removing a disk/network/PCI device when domain
|
||||
is inactive. We obviously can't search xenstore when the domain is
|
||||
inactive.
|
||||
|
||||
Index: libvirt-1.0.2/src/xen/xend_internal.c
|
||||
===================================================================
|
||||
@ -52,7 +53,22 @@ Index: libvirt-1.0.2/src/xen/xend_internal.c
|
||||
goto cleanup;
|
||||
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
|
||||
@@ -3924,6 +3925,7 @@ struct xenUnifiedDriver xenDaemonDriver
|
||||
@@ -3912,18 +3913,18 @@ struct xenUnifiedDriver xenDaemonDriver
|
||||
* @dev: pointer to device config object
|
||||
* @class: Xen device class "vbd" or "vif" (OUT)
|
||||
* @ref: Xen device reference (OUT)
|
||||
+ * @ref_len: Length of character buffer proviced by the ref parameter
|
||||
*
|
||||
* Set class according to XML root, and:
|
||||
* - if disk, copy in ref the target name from description
|
||||
- * - if network, get MAC address from description, scan XenStore and
|
||||
- * copy in ref the corresponding vif number.
|
||||
- * - if pci, get BDF from description, scan XenStore and
|
||||
- * copy in ref the corresponding dev number.
|
||||
+ * - if network, copy in ref the target MAC address from description
|
||||
+ * - if pci, copy in ref the target BDF from description
|
||||
*
|
||||
* Returns 0 in case of success, -1 in case of failure.
|
||||
*/
|
||||
static int
|
||||
virDomainXMLDevID(virDomainPtr domain,
|
||||
@ -60,12 +76,12 @@ Index: libvirt-1.0.2/src/xen/xend_internal.c
|
||||
virDomainDeviceDefPtr dev,
|
||||
char *class,
|
||||
char *ref,
|
||||
@@ -3932,8 +3934,12 @@ virDomainXMLDevID(virDomainPtr domain,
|
||||
@@ -3931,9 +3932,11 @@ virDomainXMLDevID(virDomainPtr domain,
|
||||
{
|
||||
xenUnifiedPrivatePtr priv = domain->conn->privateData;
|
||||
char *xref;
|
||||
char *tmp;
|
||||
- char *tmp;
|
||||
+ unsigned int i;
|
||||
+ virDomainDiskDefPtr disk;
|
||||
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
|
||||
+ if (dev->data.disk->dst == NULL)
|
||||
@ -73,7 +89,7 @@ Index: libvirt-1.0.2/src/xen/xend_internal.c
|
||||
if (dev->data.disk->driverName &&
|
||||
STREQ(dev->data.disk->driverName, "tap"))
|
||||
strcpy(class, "tap");
|
||||
@@ -3943,19 +3949,21 @@ virDomainXMLDevID(virDomainPtr domain,
|
||||
@@ -3943,19 +3946,17 @@ virDomainXMLDevID(virDomainPtr domain,
|
||||
else
|
||||
strcpy(class, "vbd");
|
||||
|
||||
@ -90,15 +106,11 @@ Index: libvirt-1.0.2/src/xen/xend_internal.c
|
||||
- VIR_FREE(xref);
|
||||
- if (tmp == NULL)
|
||||
- return -1;
|
||||
+ /* For disks, the device name can be used directly.
|
||||
+ * If disk device exists in domain definintion,
|
||||
+ * copy it to ref and return success.
|
||||
+ */
|
||||
+ /* For disks, the device name can be used directly. */
|
||||
+ for (i = 0; i < domDef->ndisks; i++) {
|
||||
+ disk = domDef->disks[i];
|
||||
+ virDomainDiskDefPtr disk = domDef->disks[i];
|
||||
+ if (STREQ(dev->data.disk->dst, disk->dst)) {
|
||||
+ tmp = virStrcpy(ref, disk->dst, ref_len);
|
||||
+ if (tmp == NULL)
|
||||
+ if (virStrcpy(ref, disk->dst, ref_len) == NULL)
|
||||
+ return -1;
|
||||
+ else
|
||||
+ return 0;
|
||||
@ -108,3 +120,92 @@ Index: libvirt-1.0.2/src/xen/xend_internal.c
|
||||
} else if (dev->type == VIR_DOMAIN_DEVICE_NET) {
|
||||
char mac[30];
|
||||
virDomainNetDefPtr def = dev->data.net;
|
||||
@@ -3965,17 +3966,22 @@ virDomainXMLDevID(virDomainPtr domain,
|
||||
|
||||
strcpy(class, "vif");
|
||||
|
||||
- xenUnifiedLock(priv);
|
||||
- xref = xenStoreDomainGetNetworkID(domain->conn, domain->id,
|
||||
- mac);
|
||||
- xenUnifiedUnlock(priv);
|
||||
- if (xref == NULL)
|
||||
- return -1;
|
||||
-
|
||||
- tmp = virStrcpy(ref, xref, ref_len);
|
||||
- VIR_FREE(xref);
|
||||
- if (tmp == NULL)
|
||||
- return -1;
|
||||
+ /* For nics, the mac address can be used directly. */
|
||||
+ for (i = 0; i < domDef->nnets; i++) {
|
||||
+ char dst_mac[30];
|
||||
+ virDomainNetDefPtr dst_net = domDef->nets[i];
|
||||
+ snprintf(dst_mac, sizeof(dst_mac), "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
+ dst_net->mac.addr[0], dst_net->mac.addr[1],
|
||||
+ dst_net->mac.addr[2], dst_net->mac.addr[3],
|
||||
+ dst_net->mac.addr[4], dst_net->mac.addr[5]);
|
||||
+ if (STREQ(mac, dst_mac)) {
|
||||
+ if (virStrcpy(ref, dst_mac, ref_len) == NULL)
|
||||
+ return -1;
|
||||
+ else
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ return -1;
|
||||
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
|
||||
dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||
dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
||||
@@ -3993,17 +3999,44 @@ virDomainXMLDevID(virDomainPtr domain,
|
||||
|
||||
strcpy(class, "pci");
|
||||
|
||||
- xenUnifiedLock(priv);
|
||||
- xref = xenStoreDomainGetPCIID(domain->conn, domain->id, bdf);
|
||||
- xenUnifiedUnlock(priv);
|
||||
- VIR_FREE(bdf);
|
||||
- if (xref == NULL)
|
||||
- return -1;
|
||||
+ /* For PCI devices, the device BFD can be used directly. */
|
||||
+ for (i = 0 ; i < domDef->nhostdevs ; i++) {
|
||||
+ char *dst_bdf;
|
||||
+ virDomainHostdevDefPtr hostdev = domDef->hostdevs[i];
|
||||
+
|
||||
+ if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
|
||||
+ continue;
|
||||
+ if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
||||
+ continue;
|
||||
+
|
||||
+ if (virAsprintf(&dst_bdf, "%04x:%02x:%02x.%0x",
|
||||
+ hostdev->source.subsys.u.pci.domain,
|
||||
+ hostdev->source.subsys.u.pci.bus,
|
||||
+ hostdev->source.subsys.u.pci.slot,
|
||||
+ hostdev->source.subsys.u.pci.function) < 0) {
|
||||
+ virReportOOMError();
|
||||
+ VIR_FREE(bdf);
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
- tmp = virStrcpy(ref, xref, ref_len);
|
||||
- VIR_FREE(xref);
|
||||
- if (tmp == NULL)
|
||||
- return -1;
|
||||
+ if (STREQ(bdf, dst_bdf)) {
|
||||
+ if (virStrcpy(ref, dst_bdf, ref_len) == NULL) {
|
||||
+ virReportOOMError();
|
||||
+ VIR_FREE(dst_bdf);
|
||||
+ VIR_FREE(bdf);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ else {
|
||||
+ VIR_FREE(dst_bdf);
|
||||
+ VIR_FREE(bdf);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ VIR_FREE(dst_bdf);
|
||||
+ }
|
||||
+
|
||||
+ VIR_FREE(bdf);
|
||||
+ return -1;
|
||||
} else {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("hotplug of device type not supported"));
|
||||
|
Loading…
Reference in New Issue
Block a user