While testing against Xen-3.2 I found out that the Xen hypercalls failed, this patches fixes it by checking the newer sysctl versions when initializing the driver. I also merged the associated debugging with the DEBUG from libvirt.c, to allow easier debugging of this issue. Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@xxxxxxxxxx | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
Index: src/xen_internal.c =================================================================== RCS file: /data/cvs/libxen/src/xen_internal.c,v retrieving revision 1.114 diff -u -p -r1.114 xen_internal.c --- src/xen_internal.c 27 Feb 2008 10:37:19 -0000 1.114 +++ src/xen_internal.c 28 Feb 2008 09:28:29 -0000 @@ -49,7 +49,9 @@ #include "buf.h" #include "capabilities.h" -/* #define DEBUG */ +#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__) +#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg) + /* * so far there is 2 versions of the structures usable for doing * hypervisor calls. @@ -1941,9 +1943,7 @@ xenHypervisorInit(void) ret = ioctl(fd, cmd, (unsigned long) &hc); if ((ret != -1) && (ret != 0)) { -#ifdef DEBUG - fprintf(stderr, "Using new hypervisor call: %X\n", ret); -#endif + DEBUG("Using new hypervisor call: %X\n", ret); hv_version = ret; xen_ioctl_hypercall_cmd = cmd; goto detect_v2; @@ -1959,9 +1959,7 @@ xenHypervisorInit(void) cmd = _IOC(_IOC_NONE, 'P', 0, sizeof(v0_hypercall_t)); ret = ioctl(fd, cmd, (unsigned long) &v0_hc); if ((ret != -1) && (ret != 0)) { -#ifdef DEBUG - fprintf(stderr, "Using old hypervisor call: %X\n", ret); -#endif + DEBUG("Using old hypervisor call: %X\n", ret); hv_version = ret; xen_ioctl_hypercall_cmd = cmd; hypervisor_version = 0; @@ -1989,9 +1987,7 @@ xenHypervisorInit(void) ipt = malloc(sizeof(*ipt)); if (ipt == NULL){ -#ifdef DEBUG - fprintf(stderr, "Memory allocation failed at xenHypervisorInit()\n"); -#endif + virXenError(NULL, VIR_ERR_NO_MEMORY, __FUNCTION__, 0); return(-1); } /* Currently consider RHEL5.0 Fedora7, xen-3.1, and xen-unstable */ @@ -2000,17 +1996,13 @@ xenHypervisorInit(void) /* RHEL 5.0 */ dom_interface_version = 3; /* XEN_DOMCTL_INTERFACE_VERSION */ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ -#ifdef DEBUG - fprintf(stderr, "Using hypervisor call v2, sys ver2 dom ver3\n"); -#endif + DEBUG0("Using hypervisor call v2, sys ver2 dom ver3\n"); goto done; } /* Fedora 7 */ dom_interface_version = 4; /* XEN_DOMCTL_INTERFACE_VERSION */ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ -#ifdef DEBUG - fprintf(stderr, "Using hypervisor call v2, sys ver2 dom ver4\n"); -#endif + DEBUG0("Using hypervisor call v2, sys ver2 dom ver4\n"); goto done; } } @@ -2020,21 +2012,27 @@ xenHypervisorInit(void) /* xen-3.1 */ dom_interface_version = 5; /* XEN_DOMCTL_INTERFACE_VERSION */ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ -#ifdef DEBUG - fprintf(stderr, "Using hypervisor call v2, sys ver3 dom ver5\n"); -#endif + DEBUG0("Using hypervisor call v2, sys ver3 dom ver5\n"); goto done; } } sys_interface_version = 4; /* XEN_SYSCTL_INTERFACE_VERSION */ if (virXen_getdomaininfo(fd, 0, &info) == 1) { - /* xen-unstable */ + /* Fedora 8 */ dom_interface_version = 5; /* XEN_DOMCTL_INTERFACE_VERSION */ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ -#ifdef DEBUG - fprintf(stderr, "Using hypervisor call v2, sys ver4 dom ver5\n"); -#endif + DEBUG0("Using hypervisor call v2, sys ver4 dom ver5\n"); + goto done; + } + } + + sys_interface_version = 6; /* XEN_SYSCTL_INTERFACE_VERSION */ + if (virXen_getdomaininfo(fd, 0, &info) == 1) { + /* Xen 3.2, Fedora 9 */ + dom_interface_version = 5; /* XEN_DOMCTL_INTERFACE_VERSION */ + if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ + DEBUG0("Using hypervisor call v2, sys ver6 dom ver5\n"); goto done; } } @@ -2042,9 +2040,7 @@ xenHypervisorInit(void) hypervisor_version = 1; sys_interface_version = -1; if (virXen_getdomaininfo(fd, 0, &info) == 1) { -#ifdef DEBUG - fprintf(stderr, "Using hypervisor call v1\n"); -#endif + DEBUG0("Using hypervisor call v1\n"); goto done; } @@ -2052,6 +2048,7 @@ xenHypervisorInit(void) * we failed to make the getdomaininfolist hypercall */ + DEBUG0("Failed to find any Xen hypervisor method\n"); hypervisor_version = -1; virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl ", IOCTL_PRIVCMD_HYPERCALL); close(fd); Index: proxy/libvirt_proxy.c =================================================================== RCS file: /data/cvs/libxen/proxy/libvirt_proxy.c,v retrieving revision 1.27 diff -u -p -r1.27 libvirt_proxy.c --- proxy/libvirt_proxy.c 22 Feb 2008 15:53:13 -0000 1.27 +++ proxy/libvirt_proxy.c 28 Feb 2008 09:28:29 -0000 @@ -32,6 +32,11 @@ #include "xs_internal.h" #include "xen_unified.h" +/* + * This is provided in libvirt.c when the code is part of the library + */ +int debugFlag = 0; + static int fdServer = -1; static int debug = 0; static int persist = 0;
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list