fix libvirt compilation against xen-unstable

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=22
This commit is contained in:
James Fehlig 2009-11-20 00:34:56 +00:00 committed by Git OBS Bridge
parent c9dd98a09f
commit 8564dd97e4
7 changed files with 102 additions and 50 deletions

View File

@ -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.
*/

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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 */

28
xen-max-vcpus.patch Normal file
View File

@ -0,0 +1,28 @@
commit d08067f04248c7f1bd797f4401308ea9a8971f1b
Author: Jim Fehlig <jfehlig@novell.com>
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;

View File

@ -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 {