domctl ver7 support

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=39
This commit is contained in:
James Fehlig 2010-02-22 18:06:48 +00:00 committed by Git OBS Bridge
parent abc111875d
commit 68a8e6df7a
3 changed files with 294 additions and 4 deletions

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Mon Feb 22 11:05:41 MST 2010 - jfehlig@novell.com
- Add support for new XEN_DOMCTL_INTERFACE_VERSION version 7.
xen-domctl-ver7.patch
-------------------------------------------------------------------
Mon Feb 15 15:40:51 MST 2010 - jfehlig@novell.com
- Unconditionally add /var/log/libvirt/{qemu,lxc,uml} directories.
bnc#579522
-------------------------------------------------------------------
Thu Feb 4 12:36:48 MST 2010 - jfehlig@novell.com

View File

@ -17,6 +17,7 @@
# norootforbuild
# hypervisor drivers that run on local host
%define with_xen 1
%define with_qemu 1
%define with_lxc 1
@ -43,6 +44,7 @@
%define with_udev 0
%define with_hal 0
%define with_yajl 0
# Xen is available only on i386 x86_64
%ifnarch %ix86 x86_64
%define with_xen 0
@ -112,7 +114,7 @@ License: LGPLv2.1+
Group: Development/Libraries/C and C++
AutoReqProv: yes
Version: 0.7.6
Release: 1
Release: 3
Summary: A C toolkit to interract with the virtualization capabilities of Linux
# The client side, i.e. shared libs and virsh are in a subpackage
Requires: libvirt-client = %{version}-%{release}
@ -150,6 +152,7 @@ Patch9: xen-name-for-devid.patch
Patch100: socat.patch
Patch101: clone.patch
Patch102: xen-pv-cdrom.patch
Patch103: xen-domctl-ver7.patch
# Our patches
Patch200: libvirtd-defaults.patch
Patch201: suse-network.patch
@ -270,6 +273,7 @@ Authors:
%patch100 -p1
%patch101
%patch102 -p1
%patch103 -p1
%patch200 -p1
%patch201 -p1
%patch202 -p1
@ -451,20 +455,20 @@ rm -rf $RPM_BUILD_ROOT
%dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/qemu/
%dir %attr(0700, root, root) %{_localstatedir}/cache/libvirt/qemu/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
%endif
%if %{with_lxc}
%config %{_sysconfdir}/libvirt/lxc.conf
%dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/lxc/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/lxc/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
%attr(0755, root, root) %{_libdir}/%{name}/libvirt_lxc
%endif
%if %{with_uml}
%dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/uml/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/uml/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
%endif
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
%if 0%{with_storage_disk}
%{_libdir}/%{name}/libvirt_parthelper
%endif
@ -481,8 +485,10 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/virt-xml-validate
%{_bindir}/virt-pki-validate
%{_libdir}/lib*.so.*
%dir %{_datadir}/libvirt/
%dir %{_datadir}/libvirt/schemas/
%{_datadir}/libvirt/schemas/domain.rng
%{_datadir}/libvirt/schemas/network.rng
%{_datadir}/libvirt/schemas/storagepool.rng

272
xen-domctl-ver7.patch Normal file
View File

@ -0,0 +1,272 @@
Index: libvirt-0.7.6/src/xen/xen_hypervisor.c
===================================================================
--- libvirt-0.7.6.orig/src/xen/xen_hypervisor.c
+++ libvirt-0.7.6/src/xen/xen_hypervisor.c
@@ -230,11 +230,28 @@ struct xen_v2d6_getdomaininfo {
};
typedef struct xen_v2d6_getdomaininfo xen_v2d6_getdomaininfo;
+struct xen_v2d7_getdomaininfo {
+ domid_t domain; /* the domain number */
+ uint32_t flags; /* flags, see before */
+ uint64_t tot_pages ALIGN_64; /* total number of pages used */
+ uint64_t max_pages ALIGN_64; /* maximum number of pages allowed */
+ uint64_t shr_pages ALIGN_64; /* number of shared pages */
+ uint64_t shared_info_frame ALIGN_64; /* MFN of shared_info struct */
+ uint64_t cpu_time ALIGN_64; /* CPU time used */
+ uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */
+ uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */
+ uint32_t ssidref;
+ xen_domain_handle_t handle;
+ uint32_t cpupool;
+};
+typedef struct xen_v2d7_getdomaininfo xen_v2d7_getdomaininfo;
+
union xen_getdomaininfo {
struct xen_v0_getdomaininfo v0;
struct xen_v2_getdomaininfo v2;
struct xen_v2d5_getdomaininfo v2d5;
struct xen_v2d6_getdomaininfo v2d6;
+ struct xen_v2d7_getdomaininfo v2d7;
};
typedef union xen_getdomaininfo xen_getdomaininfo;
@@ -243,6 +260,7 @@ union xen_getdomaininfolist {
struct xen_v2_getdomaininfo *v2;
struct xen_v2d5_getdomaininfo *v2d5;
struct xen_v2d6_getdomaininfo *v2d6;
+ struct xen_v2d7_getdomaininfo *v2d7;
};
typedef union xen_getdomaininfolist xen_getdomaininfolist;
@@ -280,147 +298,179 @@ typedef struct xen_v2s5_availheap xen_v
#define XEN_GETDOMAININFOLIST_ALLOC(domlist, size) \
(hypervisor_version < 2 ? \
(VIR_ALLOC_N(domlist.v0, (size)) == 0) : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ (VIR_ALLOC_N(domlist.v2d7, (size)) == 0) : \
+ (dom_interface_version == 6 ? \
(VIR_ALLOC_N(domlist.v2d6, (size)) == 0) : \
(dom_interface_version == 5 ? \
(VIR_ALLOC_N(domlist.v2d5, (size)) == 0) : \
- (VIR_ALLOC_N(domlist.v2, (size)) == 0))))
+ (VIR_ALLOC_N(domlist.v2, (size)) == 0)))))
#define XEN_GETDOMAININFOLIST_FREE(domlist) \
(hypervisor_version < 2 ? \
VIR_FREE(domlist.v0) : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ VIR_FREE(domlist.v2d7) : \
+ (dom_interface_version == 6 ? \
VIR_FREE(domlist.v2d6) : \
(dom_interface_version == 5 ? \
VIR_FREE(domlist.v2d5) : \
- VIR_FREE(domlist.v2))))
+ VIR_FREE(domlist.v2)))))
#define XEN_GETDOMAININFOLIST_CLEAR(domlist, size) \
(hypervisor_version < 2 ? \
memset(domlist.v0, 0, sizeof(*domlist.v0) * size) : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ memset(domlist.v2d7, 0, sizeof(*domlist.v2d7) * size) : \
+ (dom_interface_version == 6 ? \
memset(domlist.v2d6, 0, sizeof(*domlist.v2d6) * size) : \
(dom_interface_version == 5 ? \
memset(domlist.v2d5, 0, sizeof(*domlist.v2d5) * size) : \
- memset(domlist.v2, 0, sizeof(*domlist.v2) * size))))
+ memset(domlist.v2, 0, sizeof(*domlist.v2) * size)))))
#define XEN_GETDOMAININFOLIST_DOMAIN(domlist, n) \
(hypervisor_version < 2 ? \
domlist.v0[n].domain : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ domlist.v2d7[n].domain : \
+ (dom_interface_version == 6 ? \
domlist.v2d6[n].domain : \
(dom_interface_version == 5 ? \
domlist.v2d5[n].domain : \
- domlist.v2[n].domain)))
+ domlist.v2[n].domain))))
#define XEN_GETDOMAININFOLIST_UUID(domlist, n) \
(hypervisor_version < 2 ? \
domlist.v0[n].handle : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ domlist.v2d7[n].handle : \
+ (dom_interface_version == 6 ? \
domlist.v2d6[n].handle : \
(dom_interface_version == 5 ? \
domlist.v2d5[n].handle : \
- domlist.v2[n].handle)))
+ domlist.v2[n].handle))))
#define XEN_GETDOMAININFOLIST_DATA(domlist) \
(hypervisor_version < 2 ? \
(void*)(domlist->v0) : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ (void*)(domlist->v2d7) : \
+ (dom_interface_version == 6 ? \
(void*)(domlist->v2d6) : \
(dom_interface_version == 5 ? \
(void*)(domlist->v2d5) : \
- (void*)(domlist->v2))))
+ (void*)(domlist->v2)))))
#define XEN_GETDOMAININFO_SIZE \
(hypervisor_version < 2 ? \
sizeof(xen_v0_getdomaininfo) : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ sizeof(xen_v2d7_getdomaininfo) : \
+ (dom_interface_version == 6 ? \
sizeof(xen_v2d6_getdomaininfo) : \
(dom_interface_version == 5 ? \
sizeof(xen_v2d5_getdomaininfo) : \
- sizeof(xen_v2_getdomaininfo))))
+ sizeof(xen_v2_getdomaininfo)))))
#define XEN_GETDOMAININFO_CLEAR(dominfo) \
(hypervisor_version < 2 ? \
memset(&(dominfo.v0), 0, sizeof(xen_v0_getdomaininfo)) : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ memset(&(dominfo.v2d7), 0, sizeof(xen_v2d7_getdomaininfo)) : \
+ (dom_interface_version == 6 ? \
memset(&(dominfo.v2d6), 0, sizeof(xen_v2d6_getdomaininfo)) : \
(dom_interface_version == 5 ? \
memset(&(dominfo.v2d5), 0, sizeof(xen_v2d5_getdomaininfo)) : \
- memset(&(dominfo.v2), 0, sizeof(xen_v2_getdomaininfo)))))
+ memset(&(dominfo.v2), 0, sizeof(xen_v2_getdomaininfo))))))
#define XEN_GETDOMAININFO_DOMAIN(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.domain : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ dominfo.v2d7.domain : \
+ (dom_interface_version == 6 ? \
dominfo.v2d6.domain : \
(dom_interface_version == 5 ? \
dominfo.v2d5.domain : \
- dominfo.v2.domain)))
+ dominfo.v2.domain))))
#define XEN_GETDOMAININFO_CPUTIME(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.cpu_time : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ dominfo.v2d7.cpu_time : \
+ (dom_interface_version == 6 ? \
dominfo.v2d6.cpu_time : \
(dom_interface_version == 5 ? \
dominfo.v2d5.cpu_time : \
- dominfo.v2.cpu_time)))
+ dominfo.v2.cpu_time))))
#define XEN_GETDOMAININFO_CPUCOUNT(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.nr_online_vcpus : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ dominfo.v2d7.nr_online_vcpus : \
+ (dom_interface_version == 6 ? \
dominfo.v2d6.nr_online_vcpus : \
(dom_interface_version == 5 ? \
dominfo.v2d5.nr_online_vcpus : \
- dominfo.v2.nr_online_vcpus)))
+ dominfo.v2.nr_online_vcpus))))
#define XEN_GETDOMAININFO_MAXCPUID(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.max_vcpu_id : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ dominfo.v2d7.max_vcpu_id : \
+ (dom_interface_version == 6 ? \
dominfo.v2d6.max_vcpu_id : \
(dom_interface_version == 5 ? \
dominfo.v2d5.max_vcpu_id : \
- dominfo.v2.max_vcpu_id)))
+ dominfo.v2.max_vcpu_id))))
#define XEN_GETDOMAININFO_FLAGS(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.flags : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ dominfo.v2d7.flags : \
+ (dom_interface_version == 6 ? \
dominfo.v2d6.flags : \
(dom_interface_version == 5 ? \
dominfo.v2d5.flags : \
- dominfo.v2.flags)))
+ dominfo.v2.flags))))
#define XEN_GETDOMAININFO_TOT_PAGES(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.tot_pages : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ dominfo.v2d7.tot_pages : \
+ (dom_interface_version == 6 ? \
dominfo.v2d6.tot_pages : \
(dom_interface_version == 5 ? \
dominfo.v2d5.tot_pages : \
- dominfo.v2.tot_pages)))
+ dominfo.v2.tot_pages))))
#define XEN_GETDOMAININFO_MAX_PAGES(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.max_pages : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ dominfo.v2d7.max_pages : \
+ (dom_interface_version == 6 ? \
dominfo.v2d6.max_pages : \
(dom_interface_version == 5 ? \
dominfo.v2d5.max_pages : \
- dominfo.v2.max_pages)))
+ dominfo.v2.max_pages))))
#define XEN_GETDOMAININFO_UUID(dominfo) \
(hypervisor_version < 2 ? \
dominfo.v0.handle : \
- (dom_interface_version >= 6 ? \
+ (dom_interface_version >= 7 ? \
+ dominfo.v2d7.handle : \
+ (dom_interface_version == 6 ? \
dominfo.v2d6.handle : \
(dom_interface_version == 5 ? \
dominfo.v2d5.handle : \
- dominfo.v2.handle)))
+ dominfo.v2.handle))))
static int
@@ -2106,8 +2156,16 @@ xenHypervisorInit(void)
sys_interface_version = 7; /* XEN_SYSCTL_INTERFACE_VERSION */
if (virXen_getdomaininfo(fd, 0, &info) == 1) {
dom_interface_version = 6; /* XEN_DOMCTL_INTERFACE_VERSION */
- DEBUG0("Using hypervisor call v2, sys ver7 dom ver6\n");
- goto done;
+ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
+ DEBUG0("Using hypervisor call v2, sys ver6 dom ver6\n");
+ goto done;
+ }
+ /* CPU Pools addition to domctl interface */
+ dom_interface_version = 7; /* XEN_DOMCTL_INTERFACE_VERSION */
+ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){
+ DEBUG0("Using hypervisor call v2, sys ver6 dom ver7\n");
+ goto done;
+ }
}
hypervisor_version = 1;