James Fehlig 2011-03-31 20:22:32 +00:00 committed by Git OBS Bridge
parent 5011d5533b
commit 1a8e4d6309
13 changed files with 77 additions and 469 deletions

View File

@ -1,93 +0,0 @@
commit 71753cb7f7a16ff800381c0b5ee4e99eea92fed3
Author: Guido Günther <agx@sigxcpu.org>
Date: Mon Mar 14 10:56:28 2011 +0800
Add missing checks for read only connections
As pointed on CVE-2011-1146, some API forgot to check the read-only
status of the connection for entry point which modify the state
of the system or may lead to a remote execution using user data.
The entry points concerned are:
- virConnectDomainXMLToNative
- virNodeDeviceDettach
- virNodeDeviceReAttach
- virNodeDeviceReset
- virDomainRevertToSnapshot
- virDomainSnapshotDelete
* src/libvirt.c: fix the above set of entry points to error on read-only
connections
Index: libvirt-0.8.8/src/libvirt.c
===================================================================
--- libvirt-0.8.8.orig/src/libvirt.c
+++ libvirt-0.8.8/src/libvirt.c
@@ -3152,6 +3152,10 @@ char *virConnectDomainXMLToNative(virCon
virDispatchError(NULL);
return NULL;
}
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
if (nativeFormat == NULL || domainXml == NULL) {
virLibConnError(VIR_ERR_INVALID_ARG, __FUNCTION__);
@@ -9579,6 +9583,11 @@ virNodeDeviceDettach(virNodeDevicePtr de
return -1;
}
+ if (dev->conn->flags & VIR_CONNECT_RO) {
+ virLibConnError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
+
if (dev->conn->driver->nodeDeviceDettach) {
int ret;
ret = dev->conn->driver->nodeDeviceDettach (dev);
@@ -9622,6 +9631,11 @@ virNodeDeviceReAttach(virNodeDevicePtr d
return -1;
}
+ if (dev->conn->flags & VIR_CONNECT_RO) {
+ virLibConnError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
+
if (dev->conn->driver->nodeDeviceReAttach) {
int ret;
ret = dev->conn->driver->nodeDeviceReAttach (dev);
@@ -9667,6 +9681,11 @@ virNodeDeviceReset(virNodeDevicePtr dev)
return -1;
}
+ if (dev->conn->flags & VIR_CONNECT_RO) {
+ virLibConnError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
+
if (dev->conn->driver->nodeDeviceReset) {
int ret;
ret = dev->conn->driver->nodeDeviceReset (dev);
@@ -12962,6 +12981,10 @@ virDomainRevertToSnapshot(virDomainSnaps
}
conn = snapshot->domain->conn;
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibConnError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
if (conn->driver->domainRevertToSnapshot) {
int ret = conn->driver->domainRevertToSnapshot(snapshot, flags);
@@ -13008,6 +13031,10 @@ virDomainSnapshotDelete(virDomainSnapsho
}
conn = snapshot->domain->conn;
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibConnError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
if (conn->driver->domainSnapshotDelete) {
int ret = conn->driver->domainSnapshotDelete(snapshot, flags);

View File

@ -2,7 +2,7 @@ Index: src/lxc/lxc_container.c
===================================================================
--- src/lxc/lxc_container.c.orig
+++ src/lxc/lxc_container.c
@@ -845,6 +845,9 @@ int lxcContainerStart(virDomainDefPtr de
@@ -883,6 +883,9 @@ int lxcContainerStart(virDomainDefPtr de
lxc_child_argv_t args = { def, nveths, veths, control, ttyPath };
/* allocate a stack for the container */
@ -12,7 +12,7 @@ Index: src/lxc/lxc_container.c
if (VIR_ALLOC_N(stack, stacksize) < 0) {
virReportOOMError();
return -1;
@@ -863,7 +866,11 @@ int lxcContainerStart(virDomainDefPtr de
@@ -901,7 +904,11 @@ int lxcContainerStart(virDomainDefPtr de
flags |= CLONE_NEWNET;
}
@ -22,9 +22,9 @@ Index: src/lxc/lxc_container.c
pid = clone(lxcContainerChild, stacktop, flags, &args);
+#endif
VIR_FREE(stack);
DEBUG("clone() completed, new container PID is %d", pid);
VIR_DEBUG("clone() completed, new container PID is %d", pid);
@@ -889,6 +896,7 @@ int lxcContainerAvailable(int features)
@@ -927,6 +934,7 @@ int lxcContainerAvailable(int features)
char *childStack;
char *stack;
int childStatus;
@ -32,7 +32,7 @@ Index: src/lxc/lxc_container.c
if (features & LXC_CONTAINER_FEATURE_USER)
flags |= CLONE_NEWUSER;
@@ -896,14 +904,21 @@ int lxcContainerAvailable(int features)
@@ -934,14 +942,21 @@ int lxcContainerAvailable(int features)
if (features & LXC_CONTAINER_FEATURE_NET)
flags |= CLONE_NEWNET;
@ -41,7 +41,7 @@ Index: src/lxc/lxc_container.c
+ stacksize *= 2;
+#endif
+ if (VIR_ALLOC_N(stack, stacksize) < 0) {
DEBUG0("Unable to allocate stack");
VIR_DEBUG0("Unable to allocate stack");
return -1;
}

View File

@ -1,27 +0,0 @@
commit efc2594b4e0cbcdd6947fafeeed41accd5b611e0
Author: Jim Fehlig <jfehlig@novell.com>
Date: Thu Feb 17 14:22:55 2011 -0700
Do not add drive 'boot=on' param when a kernel is specified
libvirt-tck was failing several domain tests [1] with qemu 0.14, which
is now less tolerable of specifying 2 bootroms with the same boot index [2].
Drop the 'boot=on' param if kernel has been specfied.
[1] https://www.redhat.com/archives/libvir-list/2011-February/msg00559.html
[2] http://lists.nongnu.org/archive/html/qemu-devel/2011-02/msg01892.html
Index: libvirt-0.8.8/src/qemu/qemu_command.c
===================================================================
--- libvirt-0.8.8.orig/src/qemu/qemu_command.c
+++ libvirt-0.8.8/src/qemu/qemu_command.c
@@ -3116,7 +3116,7 @@ qemuBuildCommandLine(virConnectPtr conn,
int bootCD = 0, bootFloppy = 0, bootDisk = 0;
/* If QEMU supports boot=on for -drive param... */
- if (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE_BOOT) {
+ if (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE_BOOT && !def->os.kernel) {
for (i = 0 ; i < def->os.nBootDevs ; i++) {
switch (def->os.bootDevs[i]) {
case VIR_DOMAIN_BOOT_CDROM:

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1b055afdea9df8d502b7572ea4c81a9aa5fa0f8688d3a58cf63abcef6e84b807
size 9569079

3
libvirt-0.9.0.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:88d34ed2763694154a6c8b6847730d899a7d348179a7844d0753d45751820e1b
size 9716336

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Mar 31 14:16:17 MST 2011 - jfehlig@novell.com
- Update to libvirt 0.9.0 RC3
-------------------------------------------------------------------
Thu Mar 24 10:23:30 UTC 2011 - coolo@novell.com

View File

@ -144,8 +144,8 @@ Url: http://libvirt.org/
License: LGPLv2.1+
Group: Development/Libraries/C and C++
AutoReqProv: yes
Version: 0.8.8
Release: 3
Version: 0.9.0
Release: 1
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: %{name}-client = %{version}-%{release}
@ -169,14 +169,11 @@ Recommends: PolicyKit >= 0.6
Source0: %{name}-%{version}.tar.bz2
Source1: libvirtd.init
# Upstream patches
Patch0: efc2594b-boot-param.patch
Patch1: 71753cb7-CVE-2011-1146.patch
# Need to go upstream
Patch100: xen-name-for-devid.patch
Patch102: clone.patch
Patch103: xen-pv-cdrom.patch
Patch104: xen-domctl-ver7.patch
Patch105: xend-disk-order.patch
Patch101: clone.patch
Patch102: xen-pv-cdrom.patch
Patch103: xend-disk-order.patch
# Our patches
Patch200: libvirtd-defaults.patch
Patch201: use-libvirt-guests-on-suse.patch
@ -285,13 +282,10 @@ Authors:
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch100 -p1
%patch102
%patch101
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch200 -p1
%patch201 -p1

View File

@ -1,7 +1,7 @@
Index: libvirt-0.8.6/daemon/libvirtd.conf
Index: libvirt-0.9.0/daemon/libvirtd.conf
===================================================================
--- libvirt-0.8.6.orig/daemon/libvirtd.conf
+++ libvirt-0.8.6/daemon/libvirtd.conf
--- libvirt-0.9.0.orig/daemon/libvirtd.conf
+++ libvirt-0.9.0/daemon/libvirtd.conf
@@ -18,8 +18,8 @@
# It is necessary to setup a CA and issue server certificates before
# using this capability.
@ -28,11 +28,11 @@ Index: libvirt-0.8.6/daemon/libvirtd.conf
# Override the default mDNS advertizement name. This must be
# unique on the immediate broadcast network.
Index: libvirt-0.8.6/daemon/libvirtd.c
Index: libvirt-0.9.0/daemon/libvirtd.c
===================================================================
--- libvirt-0.8.6.orig/daemon/libvirtd.c
+++ libvirt-0.8.6/daemon/libvirtd.c
@@ -147,7 +147,7 @@ static int sigwrite = -1; /* Signa
--- libvirt-0.9.0.orig/daemon/libvirtd.c
+++ libvirt-0.9.0/daemon/libvirtd.c
@@ -148,7 +148,7 @@ static int sigwrite = -1; /* Signa
static int ipsock = 0; /* -l Listen for TCP/IP */
/* Defaults for configuration file elements */
@ -41,7 +41,7 @@ Index: libvirt-0.8.6/daemon/libvirtd.c
static int listen_tcp = 0;
static char *listen_addr = (char *) LIBVIRTD_LISTEN_ADDR;
static char *tls_port = (char *) LIBVIRTD_TLS_PORT;
@@ -169,7 +169,7 @@ static int auth_tcp = REMOTE_AUTH_NONE;
@@ -170,7 +170,7 @@ static int auth_tcp = REMOTE_AUTH_NONE;
#endif
static int auth_tls = REMOTE_AUTH_NONE;

View File

@ -1,7 +1,7 @@
Index: libvirt-0.8.8/tools/Makefile.am
Index: libvirt-0.9.0/tools/Makefile.am
===================================================================
--- libvirt-0.8.8.orig/tools/Makefile.am
+++ libvirt-0.8.8/tools/Makefile.am
--- libvirt-0.9.0.orig/tools/Makefile.am
+++ libvirt-0.9.0/tools/Makefile.am
@@ -129,18 +129,18 @@ install-data-local: install-init
uninstall-local: uninstall-init
@ -39,11 +39,11 @@ Index: libvirt-0.8.8/tools/Makefile.am
-endif # LIBVIRT_INIT_SCRIPT_RED_HAT
CLEANFILES = $(bin_SCRIPTS) $(man1_MANS)
Index: libvirt-0.8.8/tools/libvirt-guests.sysconf
CLEANFILES = $(bin_SCRIPTS)
Index: libvirt-0.9.0/tools/libvirt-guests.sysconf
===================================================================
--- libvirt-0.8.8.orig/tools/libvirt-guests.sysconf
+++ libvirt-0.8.8/tools/libvirt-guests.sysconf
--- libvirt-0.9.0.orig/tools/libvirt-guests.sysconf
+++ libvirt-0.9.0/tools/libvirt-guests.sysconf
@@ -1,15 +1,23 @@
+## Path: System/Virtualization/libvirt
+
@ -82,10 +82,10 @@ Index: libvirt-0.8.8/tools/libvirt-guests.sysconf
# number of seconds we're willing to wait for a guest to shut down
-#SHUTDOWN_TIMEOUT=0
+SHUTDOWN_TIMEOUT=120
Index: libvirt-0.8.8/tools/libvirt-guests.init.sh
Index: libvirt-0.9.0/tools/libvirt-guests.init.sh
===================================================================
--- libvirt-0.8.8.orig/tools/libvirt-guests.init.sh
+++ libvirt-0.8.8/tools/libvirt-guests.init.sh
--- libvirt-0.9.0.orig/tools/libvirt-guests.init.sh
+++ libvirt-0.9.0/tools/libvirt-guests.init.sh
@@ -4,10 +4,10 @@
#
### BEGIN INIT INFO
@ -133,7 +133,7 @@ Index: libvirt-0.8.8/tools/libvirt-guests.init.sh
return 1
else
return 0
@@ -78,12 +75,31 @@ run_virsh_c() {
@@ -76,12 +73,31 @@ run_virsh_c() {
( export LC_ALL=C; run_virsh "$@" )
}
@ -159,32 +159,32 @@ Index: libvirt-0.8.8/tools/libvirt-guests.init.sh
list_guests() {
uri=$1
list=$(run_virsh_c $uri list)
list=$(run_virsh_c "$uri" list)
if [ $? -ne 0 ]; then
- RETVAL=1
+ rc_failed 1
return 1
fi
@@ -91,7 +107,7 @@ list_guests() {
@@ -89,7 +105,7 @@ list_guests() {
for id in $(echo "$list" | awk 'NR > 2 {print $1}'); do
uuid=$(run_virsh_c $uri dominfo $id | awk '/^UUID:/{print $2}')
uuid=$(run_virsh_c "$uri" dominfo "$id" | awk '/^UUID:/{print $2}')
if [ -z "$uuid" ]; then
- RETVAL=1
+ rc_failed 1
return 1
fi
uuids="$uuids $uuid"
@@ -118,7 +134,7 @@ guest_is_on() {
@@ -116,7 +132,7 @@ guest_is_on() {
guest_running=false
info=$(run_virsh_c $uri dominfo $uuid)
info=$(run_virsh_c "$uri" dominfo "$uuid")
if [ $? -ne 0 ]; then
- RETVAL=1
+ rc_failed 1
return 1
fi
@@ -156,6 +172,12 @@ start() {
@@ -157,6 +173,12 @@ start() {
continue
fi
@ -196,8 +196,8 @@ Index: libvirt-0.8.8/tools/libvirt-guests.init.sh
+
eval_gettext "Resuming guests on \$uri URI..."; echo
for guest in $list; do
name=$(guest_name $uri $guest)
@@ -237,7 +259,7 @@ stop() {
name=$(guest_name "$uri" "$guest")
@@ -238,7 +260,7 @@ stop() {
if [ $SHUTDOWN_TIMEOUT -le 0 ]; then
gettext "Shutdown action requested but SHUTDOWN_TIMEOUT was not set"
echo
@ -206,7 +206,7 @@ Index: libvirt-0.8.8/tools/libvirt-guests.init.sh
return
fi
fi
@@ -301,14 +323,13 @@ gueststatus() {
@@ -308,14 +330,13 @@ gueststatus() {
rh_status() {
if [ -f "$LISTFILE" ]; then
gettext "stopped, with saved guests"; echo
@ -222,7 +222,7 @@ Index: libvirt-0.8.8/tools/libvirt-guests.init.sh
fi
}
@@ -352,4 +373,4 @@ case "$1" in
@@ -359,4 +380,4 @@ case "$1" in
usage
;;
esac

View File

@ -1,272 +0,0 @@
Index: libvirt-0.8.6/src/xen/xen_hypervisor.c
===================================================================
--- libvirt-0.8.6.orig/src/xen/xen_hypervisor.c
+++ libvirt-0.8.6/src/xen/xen_hypervisor.c
@@ -223,11 +223,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;
@@ -236,6 +253,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;
@@ -273,147 +291,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
@@ -2087,8 +2137,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");
- 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;

View File

@ -13,11 +13,11 @@ Date: Wed Jan 27 16:11:41 2010 -0700
This approach allows removing a disk when domain is inactive. We
obviously can't search xenstore when the domain is inactive.
Index: libvirt-0.8.8/src/xen/xend_internal.c
Index: libvirt-0.9.0/src/xen/xend_internal.c
===================================================================
--- libvirt-0.8.8.orig/src/xen/xend_internal.c
+++ libvirt-0.8.8/src/xen/xend_internal.c
@@ -89,6 +89,7 @@ xenDaemonFormatSxprOnePCI(virDomainHostd
--- libvirt-0.9.0.orig/src/xen/xend_internal.c
+++ libvirt-0.9.0/src/xen/xend_internal.c
@@ -62,6 +62,7 @@
static int
virDomainXMLDevID(virDomainPtr domain,
@ -25,7 +25,7 @@ Index: libvirt-0.8.8/src/xen/xend_internal.c
virDomainDeviceDefPtr dev,
char *class,
char *ref,
@@ -4088,7 +4089,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr
@@ -2725,7 +2726,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr
sexpr = virBufferContentAndReset(&buf);
@ -34,7 +34,7 @@ Index: libvirt-0.8.8/src/xen/xend_internal.c
/* device doesn't exist, define it */
ret = xend_op(domain->conn, domain->name, "op", "device_create",
"config", sexpr, NULL);
@@ -4211,7 +4212,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr
@@ -2848,7 +2849,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr
sexpr = virBufferContentAndReset(&buf);
@ -43,7 +43,7 @@ Index: libvirt-0.8.8/src/xen/xend_internal.c
virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("requested device does not exist"));
goto cleanup;
@@ -4304,7 +4305,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr
@@ -2941,7 +2942,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr
def, xml, VIR_DOMAIN_XML_INACTIVE)))
goto cleanup;
@ -52,7 +52,7 @@ Index: libvirt-0.8.8/src/xen/xend_internal.c
goto cleanup;
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
@@ -6085,6 +6086,7 @@ error:
@@ -3883,6 +3884,7 @@ struct xenUnifiedDriver xenDaemonDriver
*/
static int
virDomainXMLDevID(virDomainPtr domain,
@ -60,7 +60,7 @@ Index: libvirt-0.8.8/src/xen/xend_internal.c
virDomainDeviceDefPtr dev,
char *class,
char *ref,
@@ -6093,8 +6095,12 @@ virDomainXMLDevID(virDomainPtr domain,
@@ -3891,8 +3893,12 @@ virDomainXMLDevID(virDomainPtr domain,
xenUnifiedPrivatePtr priv = domain->conn->privateData;
char *xref;
char *tmp;
@ -73,7 +73,7 @@ Index: libvirt-0.8.8/src/xen/xend_internal.c
if (dev->data.disk->driverName &&
STREQ(dev->data.disk->driverName, "tap"))
strcpy(class, "tap");
@@ -6104,19 +6110,21 @@ virDomainXMLDevID(virDomainPtr domain,
@@ -3902,19 +3908,21 @@ virDomainXMLDevID(virDomainPtr domain,
else
strcpy(class, "vbd");

View File

@ -1,21 +1,21 @@
Index: libvirt-0.8.8/src/xen/xend_internal.c
Index: libvirt-0.9.0/src/xenxs/xen_sxpr.c
===================================================================
--- libvirt-0.8.8.orig/src/xen/xend_internal.c
+++ libvirt-0.8.8/src/xen/xend_internal.c
@@ -1365,7 +1365,7 @@ error:
--- libvirt-0.9.0.orig/src/xenxs/xen_sxpr.c
+++ libvirt-0.9.0/src/xenxs/xen_sxpr.c
@@ -326,7 +326,7 @@ error:
static int
xenDaemonParseSxprDisks(virDomainDefPtr def,
const struct sexpr *root,
- int hvm,
+ int hvm ATTRIBUTE_UNUSED,
int xendConfigVersion)
xenParseSxprDisks(virDomainDefPtr def,
const struct sexpr *root,
- int hvm,
+ int hvm ATTRIBUTE_UNUSED,
int xendConfigVersion)
{
const struct sexpr *cur, *node;
@@ -1412,7 +1412,6 @@ xenDaemonParseSxprDisks(virDomainDefPtr
@@ -373,7 +373,6 @@ xenParseSxprDisks(virDomainDefPtr def,
/* There is a case without the uname to the CD-ROM device */
offset = strchr(dst, ':');
if (!offset ||
- !hvm ||
STRNEQ(offset, ":cdrom")) {
virXendError(VIR_ERR_INTERNAL_ERROR,
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, vbd has no src"));

View File

@ -1,8 +1,8 @@
Index: libvirt-0.8.8/src/xen/xend_internal.c
Index: libvirt-0.9.0/src/xenxs/xen_sxpr.c
===================================================================
--- libvirt-0.8.8.orig/src/xen/xend_internal.c
+++ libvirt-0.8.8/src/xen/xend_internal.c
@@ -1383,20 +1383,24 @@ xenDaemonParseSxprDisks(virDomainDefPtr
--- libvirt-0.9.0.orig/src/xenxs/xen_sxpr.c
+++ libvirt-0.9.0/src/xenxs/xen_sxpr.c
@@ -344,20 +344,24 @@ xenParseSxprDisks(virDomainDefPtr def,
const char *src = NULL;
const char *dst = NULL;
const char *mode = NULL;
@ -27,7 +27,7 @@ Index: libvirt-0.8.8/src/xen/xend_internal.c
}
if (VIR_ALLOC(disk) < 0)
@@ -1521,7 +1525,12 @@ xenDaemonParseSxprDisks(virDomainDefPtr
@@ -482,7 +486,13 @@ xenParseSxprDisks(virDomainDefPtr def,
if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
goto no_memory;
@ -38,6 +38,7 @@ Index: libvirt-0.8.8/src/xen/xend_internal.c
+ def->ndisks++;
+ } else
+ def->disks[def->ndisks++] = disk;
+
disk = NULL;
}
}