From 8564dd97e408345caf3883c824cf30d68fc67fb3d27c0c99fe1bfbdb2067b7e0 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Fri, 20 Nov 2009 00:34:56 +0000 Subject: [PATCH] fix libvirt compilation against xen-unstable OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=22 --- detach-disk.patch | 102 ++++++++++++++++++++++++------------------- libvirt.changes | 7 +++ libvirt.spec | 7 ++- migrate-params.patch | 2 +- snapshots.patch | 4 +- xen-max-vcpus.patch | 28 ++++++++++++ xen-pv-cdrom.patch | 2 +- 7 files changed, 102 insertions(+), 50 deletions(-) create mode 100644 xen-max-vcpus.patch diff --git a/detach-disk.patch b/detach-disk.patch index 834deec..0cb3ae7 100644 --- a/detach-disk.patch +++ b/detach-disk.patch @@ -2,49 +2,63 @@ Index: libvirt-0.7.2/src/xen/xend_internal.c =================================================================== --- libvirt-0.7.2.orig/src/xen/xend_internal.c +++ libvirt-0.7.2/src/xen/xend_internal.c -@@ -5896,7 +5896,7 @@ virDomainXMLDevID(virDomainPtr domain, - return -1; - xenUnifiedLock(priv); - xref = xenStoreDomainGetDiskID(domain->conn, domain->id, -- dev->data.disk->dst); -+ dev->data.disk->dst, class); - xenUnifiedUnlock(priv); - if (xref == NULL) - return -1; -Index: libvirt-0.7.2/src/xen/xs_internal.c -=================================================================== ---- libvirt-0.7.2.orig/src/xen/xs_internal.c -+++ libvirt-0.7.2/src/xen/xs_internal.c -@@ -968,7 +968,8 @@ xenStoreDomainGetNetworkID(virConnectPtr - * freed by the caller. - */ - char * --xenStoreDomainGetDiskID(virConnectPtr conn, int id, const char *dev) { -+xenStoreDomainGetDiskID(virConnectPtr conn, int id, -+ const char *dev, const char *class) { - char dir[80], path[128], **list = NULL, *val = NULL; - unsigned int devlen, len, i, num; - char *ret = NULL; -@@ -986,7 +987,7 @@ xenStoreDomainGetDiskID(virConnectPtr co - if (devlen <= 0) - return (NULL); +@@ -4087,13 +4087,12 @@ xenDaemonAttachDevice(virDomainPtr domai -- snprintf(dir, sizeof(dir), "/local/domain/0/backend/vbd/%d", id); -+ snprintf(dir, sizeof(dir), "/local/domain/0/backend/%s/%d", class, id); - list = xs_directory(priv->xshandle, 0, dir, &num); - if (list != NULL) { - for (i = 0; i < num; i++) { -Index: libvirt-0.7.2/src/xen/xs_internal.h + priv = (xenUnifiedPrivatePtr) domain->conn->privateData; + +- /* +- * on older Xen without the inactive guests management +- * avoid doing this on inactive guests +- */ +- if ((domain->id < 0) && (priv->xendConfigVersion < 3)) ++ if (domain->id < 0) { ++ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, ++ "%s", _("cannot attach device on inactive domain")); + return -1; +- ++ } ++ + if (!(def = xenDaemonDomainFetch(domain->conn, + domain->id, + domain->name, +@@ -4191,12 +4190,11 @@ xenDaemonDetachDevice(virDomainPtr domai + + priv = (xenUnifiedPrivatePtr) domain->conn->privateData; + +- /* +- * on older Xen without the inactive guests management +- * avoid doing this on inactive guests +- */ +- if ((domain->id < 0) && (priv->xendConfigVersion < 3)) ++ if (domain->id < 0) { ++ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, ++ "%s", _("cannot detach device on inactive domain")); + return -1; ++ } + + if (!(def = xenDaemonDomainFetch(domain->conn, + domain->id, +Index: libvirt-0.7.2/src/libvirt.c =================================================================== ---- libvirt-0.7.2.orig/src/xen/xs_internal.h -+++ libvirt-0.7.2/src/xen/xs_internal.h -@@ -49,7 +49,8 @@ char * xenStoreDomainGetNetworkID(virCo - const char *mac); - char * xenStoreDomainGetDiskID(virConnectPtr conn, - int id, -- const char *dev); -+ const char *dev, -+ const char *class); - char * xenStoreDomainGetName(virConnectPtr conn, - int id); - int xenStoreDomainGetUUID(virConnectPtr conn, +--- libvirt-0.7.2.orig/src/libvirt.c ++++ libvirt-0.7.2/src/libvirt.c +@@ -4868,7 +4868,8 @@ error: + * @domain: pointer to domain object + * @xml: pointer to XML description of one device + * +- * Create a virtual device attachment to backend. ++ * Create a virtual device attachment to backend. This function, having ++ * hotplug semantics, is only allowed on an active domain. + * + * Returns 0 in case of success, -1 in case of failure. + */ +@@ -4911,7 +4912,8 @@ error: + * @domain: pointer to domain object + * @xml: pointer to XML description of one device + * +- * Destroy a virtual device attachment to backend. ++ * Destroy a virtual device attachment to backend. This function, having ++ * hot-unplug semantics, is only allowed on an active domain. + * + * Returns 0 in case of success, -1 in case of failure. + */ diff --git a/libvirt.changes b/libvirt.changes index de22566..9e6e417 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Nov 19 16:48:36 MST 2009 - jfehlig@novell.com + +- Fix compilation against xen-unstable + xen-max-vcpus.patch +- Modify detach-disk.patch as per upstream suggestions + ------------------------------------------------------------------- Wed Nov 4 20:53:11 MDT 2009 - jfehlig@novell.com diff --git a/libvirt.spec b/libvirt.spec index 30d4bda..c39cdeb 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -95,12 +95,13 @@ Patch0: devmap-no-pkgconfig.patch Patch1: fs-ocfs2.patch Patch2: selinux-ldflags.patch Patch3: virsh-warning.patch +Patch4: xen-max-vcpus.patch +Patch5: detach-disk.patch # Need to go upstream Patch100: socat.patch Patch101: clone.patch Patch102: migrate-params.patch Patch103: xen-pv-cdrom.patch -Patch104: detach-disk.patch # Our patches Patch200: libvirtd-defaults.patch Patch201: suse-network.patch @@ -200,11 +201,12 @@ Authors: %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 +%patch5 -p1 %patch100 -p1 %patch101 %patch102 -p1 %patch103 -p1 -%patch104 -p1 %patch200 -p1 %patch201 -p1 %patch202 -p1 @@ -345,5 +347,6 @@ rm -rf $RPM_BUILD_ROOT %doc %{_docdir}/%{name}-python %{py_sitedir}/libvirt.py* %{py_sitedir}/libvirtmod* +#%attr(0755, root, root) %{_libdir}/%{name}/virt-aa-helper %changelog diff --git a/migrate-params.patch b/migrate-params.patch index fbcf3d9..62e0540 100644 --- a/migrate-params.patch +++ b/migrate-params.patch @@ -2,7 +2,7 @@ Index: libvirt-0.7.2/src/xen/xend_internal.c =================================================================== --- libvirt-0.7.2.orig/src/xen/xend_internal.c +++ libvirt-0.7.2/src/xen/xend_internal.c -@@ -4491,6 +4491,8 @@ xenDaemonDomainMigratePerform (virDomain +@@ -4489,6 +4489,8 @@ xenDaemonDomainMigratePerform (virDomain "node", "-1", "ssl", "0", "resource", "0", /* required, xend ignores it */ diff --git a/snapshots.patch b/snapshots.patch index a00c62e..a1f9822 100644 --- a/snapshots.patch +++ b/snapshots.patch @@ -452,7 +452,7 @@ Index: libvirt-0.7.2/src/xen/xend_internal.c #endif /* !PROXY */ /** -@@ -5082,6 +5169,11 @@ struct xenUnifiedDriver xenDaemonDriver +@@ -5080,6 +5167,11 @@ struct xenUnifiedDriver xenDaemonDriver xenDaemonGetSchedulerType, /* domainGetSchedulerType */ xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */ xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */ @@ -484,7 +484,7 @@ Index: libvirt-0.7.2/src/xen/xen_hypervisor.c =================================================================== --- libvirt-0.7.2.orig/src/xen/xen_hypervisor.c +++ libvirt-0.7.2/src/xen/xen_hypervisor.c -@@ -742,6 +742,11 @@ struct xenUnifiedDriver xenHypervisorDri +@@ -750,6 +750,11 @@ struct xenUnifiedDriver xenHypervisorDri xenHypervisorGetSchedulerType, /* domainGetSchedulerType */ xenHypervisorGetSchedulerParameters, /* domainGetSchedulerParameters */ xenHypervisorSetSchedulerParameters, /* domainSetSchedulerParameters */ diff --git a/xen-max-vcpus.patch b/xen-max-vcpus.patch new file mode 100644 index 0000000..8e40871 --- /dev/null +++ b/xen-max-vcpus.patch @@ -0,0 +1,28 @@ +commit d08067f04248c7f1bd797f4401308ea9a8971f1b +Author: Jim Fehlig +Date: Fri Nov 13 14:44:56 2009 -0700 + + xen-unstable changeset 19788 removed MAX_VIRT_CPUS from public + headers, breaking compilation of libvirt on -unstable. Its + semanitc was retained with XEN_LEGACY_MAX_VCPUS. Ensure + MAX_VIRT_CPUS is defined accordingly. + +diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c +index 6d8bfdd..843102a 100644 +--- a/src/xen/xen_hypervisor.c ++++ b/src/xen/xen_hypervisor.c +@@ -109,6 +109,14 @@ typedef privcmd_hypercall_t hypercall_t; + #define SYS_IFACE_MIN_VERS_NUMA 4 + #endif + ++/* xen-unstable changeset 19788 removed MAX_VIRT_CPUS from public ++ * headers. Its semanitc was retained with XEN_LEGACY_MAX_VCPUS. ++ * Ensure MAX_VIRT_CPUS is defined accordingly. ++ */ ++#if !defined(MAX_VIRT_CPUS) && defined(XEN_LEGACY_MAX_VCPUS) ++#define MAX_VIRT_CPUS XEN_LEGACY_MAX_VCPUS ++#endif ++ + static int xen_ioctl_hypercall_cmd = 0; + static int initialized = 0; + static int in_init = 0; diff --git a/xen-pv-cdrom.patch b/xen-pv-cdrom.patch index 3188ac7..c4728ae 100644 --- a/xen-pv-cdrom.patch +++ b/xen-pv-cdrom.patch @@ -2,7 +2,7 @@ Index: libvirt-0.7.2/src/xen/xend_internal.c =================================================================== --- libvirt-0.7.2.orig/src/xen/xend_internal.c +++ libvirt-0.7.2/src/xen/xend_internal.c -@@ -5324,7 +5324,10 @@ xenDaemonFormatSxprDisk(virConnectPtr co +@@ -5322,7 +5322,10 @@ xenDaemonFormatSxprDisk(virConnectPtr co } else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { virBufferVSprintf(buf, "(dev '%s:cdrom')", def->dst); } else {