Compare commits
130 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f1a1c9fa59 | |||
| 478ce99c05 | |||
| c700f01de2 | |||
| 2ef31dc2ae | |||
| d4e5211296 | |||
| 1821e087f2 | |||
| 18e08b3f76 | |||
| ff14b5ac1e | |||
| 818f358ccf | |||
| fa8bc6764c | |||
| 66484c0a3a | |||
| d815da8211 | |||
| bf918b0c15 | |||
| b59030d6b9 | |||
| 7c228b7521 | |||
| 8c8b755519 | |||
| c24c6d1abf | |||
| 76fdaa7bb0 | |||
| 56b51c0be8 | |||
| e5af44684c | |||
| cd6f0ffeda | |||
| 47190b4726 | |||
| 78f1d3ac45 | |||
| a6948b8e59 | |||
| 5636327a0d | |||
| 35cba470a0 | |||
| ceac8fe559 | |||
| 46c95e5a07 | |||
| 8a3c40567c | |||
| 9b98b4ed36 | |||
| 8d2677cf1f | |||
| 7dcc6a4ac8 | |||
| 71733e9328 | |||
| 3acabefe34 | |||
| c41054c528 | |||
| f19e302ba9 | |||
| e9c1d3f4b0 | |||
| 0f577d932b | |||
| 21a02c2e90 | |||
| 4e460d5f09 | |||
| f9de2f6bc6 | |||
| 2daa1b7814 | |||
| f99eeb8567 | |||
| 7069f75cb8 | |||
| 2cac7dac46 | |||
| 913c3c6554 | |||
| a5a4c0c89b | |||
| 8c8aca2fab | |||
| daf8e124ca | |||
| 38c4b724fe | |||
| 4d00487275 | |||
| a6831c26c1 | |||
| c363c7ebdb | |||
| 18ee6daf8a | |||
| 459eb426c3 | |||
| a0d670d2bf | |||
| d7b41212c1 | |||
| 2e1539eba4 | |||
| ee9521d87c | |||
| 8d8fc08bac | |||
| e79d304c79 | |||
| db03f03fd9 | |||
| 957403ebec | |||
| 6c32e1aaeb | |||
| 362e335c0b | |||
| ed6c49f874 | |||
| 47fcec5405 | |||
| d7239a45b6 | |||
| f13fb18c58 | |||
| d29644418d | |||
| ed9e426b26 | |||
| 659febf9ff | |||
| fca1fccfad | |||
| f713d63bab | |||
| 5a45e466cf | |||
| 742b24eb23 | |||
| 03369d2383 | |||
| 2605d662e0 | |||
| e8394ab5b5 | |||
| 8ad156a5c2 | |||
| f2d6fb6239 | |||
| e3a592c38d | |||
| 7e99819dda | |||
| a160d7f98d | |||
| 36cab842e8 | |||
| 7b7b86e327 | |||
| f4bfe638b6 | |||
| 0e9d242f05 | |||
| e24467a8c2 | |||
| b39c370a76 | |||
| 62e4e7cde2 | |||
| f822179f97 | |||
| 47e7e1e548 | |||
| e73b75314b | |||
| 8193a55b4a | |||
| 6036708fa2 | |||
| 4717aa0b6d | |||
| 97ae25ea7d | |||
| 6470ed033b | |||
| b550f9c1d5 | |||
| ee0273ffc3 | |||
| 50fce74b00 | |||
| e29f71d1c9 | |||
| 427ed20801 | |||
| d23e6c285b | |||
| 2c139b45d8 | |||
| 762435e3b7 | |||
| 6383d6b056 | |||
| 3712441ea6 | |||
| 9d0bc882fa | |||
| 90dddf3d3d | |||
| 86abd54d02 | |||
| 4ab5ad5425 | |||
| f9c1b758c3 | |||
| 38cf1bd5ba | |||
| aeda455930 | |||
| 288291b795 | |||
| 7c2073faca | |||
| 5b528ba717 | |||
| 4f731a7250 | |||
| f1ac0031f5 | |||
| e45b9c9030 | |||
| 3cf75c269d | |||
| 585033f372 | |||
| 897506e66a | |||
| e4bf8ffa42 | |||
| 20367a58a6 | |||
| aa037364ed | |||
| c034c1a3b2 | |||
| da05e02884 |
-14
@@ -1,14 +0,0 @@
|
||||
.build*.log
|
||||
*.rpm
|
||||
i686
|
||||
x86_64
|
||||
libvirt-*.tar.gz
|
||||
libvirt-0.6.0.tar.gz
|
||||
libvirt-0.6.1.tar.gz
|
||||
libvirt-0.6.2.tar.gz
|
||||
libvirt-0.6.3.tar.gz
|
||||
libvirt-0.6.4.tar.gz
|
||||
libvirt-0.6.5.tar.gz
|
||||
libvirt-0.7.0-0.1.gitf055724.tar.gz
|
||||
libvirt-0.7.0-0.6.gite195b43.tar.gz
|
||||
libvirt-0.7.0.tar.gz
|
||||
@@ -0,0 +1,5 @@
|
||||
.build*.log
|
||||
*.rpm
|
||||
i686
|
||||
x86_64
|
||||
libvirt-*.tar.gz
|
||||
@@ -4,7 +4,7 @@ NAME := libvirt
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
--- src/qemu_conf.c.orig 2009-05-29 19:24:59.000000000 +0200
|
||||
+++ src/qemu_conf.c 2009-05-29 19:19:39.000000000 +0200
|
||||
@@ -792,6 +792,20 @@ int qemudBuildCommandLine(virConnectPtr
|
||||
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||
char domid[50];
|
||||
const char *cpu = NULL;
|
||||
+ int skipSound = 0;
|
||||
+
|
||||
+ if (driver->securityDriver &&
|
||||
+ driver->securityDriver->name &&
|
||||
+ STREQ(driver->securityDriver->name, "selinux") &&
|
||||
+ getuid() == 0) {
|
||||
+ static int soundWarned = 0;
|
||||
+ skipSound = 1;
|
||||
+ if (def->nsounds &&
|
||||
+ !soundWarned) {
|
||||
+ soundWarned = 1;
|
||||
+ VIR_WARN0("Sound cards for VMs are disabled while SELinux security model is active");
|
||||
+ }
|
||||
+ }
|
||||
|
||||
uname_normalize(&ut);
|
||||
|
||||
@@ -1429,7 +1443,8 @@ int qemudBuildCommandLine(virConnectPtr
|
||||
}
|
||||
|
||||
/* Add sound hardware */
|
||||
- if (def->nsounds) {
|
||||
+ if (def->nsounds &&
|
||||
+ !skipSound) {
|
||||
int size = 100;
|
||||
char *modstr;
|
||||
if (VIR_ALLOC_N(modstr, size+1) < 0)
|
||||
@@ -1,73 +0,0 @@
|
||||
From: Mark McLoughlin <markmc@redhat.com>
|
||||
Subject: [PATCH] chown kernel/initrd before spawning qemu
|
||||
|
||||
If we're running qemu unprivileged, we need to chown any supplied kernel
|
||||
or initrd before spawning it.
|
||||
|
||||
* src/qemu_driver.c: rename qemuDomainSetDiskOwnership() to
|
||||
qemuDomainSetFileOwnership(), pass it a path string instead of a disk
|
||||
definition and use it for chowning the kernel/initrd in
|
||||
qemuDomainSetAllDeviceOwnership()
|
||||
---
|
||||
src/qemu_driver.c | 20 ++++++++++++--------
|
||||
1 files changed, 12 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
|
||||
index 412b68d..bd58435 100644
|
||||
--- a/src/qemu_driver.c
|
||||
+++ b/src/qemu_driver.c
|
||||
@@ -1684,18 +1684,18 @@ static int qemuDomainSetHostdevOwnership(virConnectPtr conn,
|
||||
|
||||
}
|
||||
|
||||
-static int qemuDomainSetDiskOwnership(virConnectPtr conn,
|
||||
- virDomainDiskDefPtr def,
|
||||
+static int qemuDomainSetFileOwnership(virConnectPtr conn,
|
||||
+ const char *path,
|
||||
uid_t uid, gid_t gid)
|
||||
{
|
||||
|
||||
- if (!def->src)
|
||||
+ if (!path)
|
||||
return 0;
|
||||
|
||||
- VIR_DEBUG("Setting ownership on %s to %d:%d", def->src, uid, gid);
|
||||
- if (chown(def->src, uid, gid) < 0) {
|
||||
+ VIR_DEBUG("Setting ownership on %s to %d:%d", path, uid, gid);
|
||||
+ if (chown(path, uid, gid) < 0) {
|
||||
virReportSystemError(conn, errno, _("cannot set ownership on %s"),
|
||||
- def->src);
|
||||
+ path);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -1725,7 +1725,7 @@ static int qemuDomainSetDeviceOwnership(virConnectPtr conn,
|
||||
(def->data.disk->readonly || def->data.disk->shared))
|
||||
return 0;
|
||||
|
||||
- return qemuDomainSetDiskOwnership(conn, def->data.disk, uid, gid);
|
||||
+ return qemuDomainSetFileOwnership(conn, def->data.disk->src, uid, gid);
|
||||
|
||||
case VIR_DOMAIN_DEVICE_HOSTDEV:
|
||||
return qemuDomainSetHostdevOwnership(conn, def->data.hostdev, uid, gid);
|
||||
@@ -1753,12 +1753,16 @@ static int qemuDomainSetAllDeviceOwnership(virConnectPtr conn,
|
||||
uid = restore ? 0 : driver->user;
|
||||
gid = restore ? 0 : driver->group;
|
||||
|
||||
+ if (qemuDomainSetFileOwnership(conn, def->os.kernel, uid, gid) < 0 ||
|
||||
+ qemuDomainSetFileOwnership(conn, def->os.initrd, uid, gid) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
for (i = 0 ; i < def->ndisks ; i++) {
|
||||
if (restore &&
|
||||
(def->disks[i]->readonly || def->disks[i]->shared))
|
||||
continue;
|
||||
|
||||
- if (qemuDomainSetDiskOwnership(conn, def->disks[i], uid, gid) < 0)
|
||||
+ if (qemuDomainSetFileOwnership(conn, def->disks[i]->src, uid, gid) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
--
|
||||
1.6.2.5
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
From: Mark McLoughlin <markmc@redhat.com>
|
||||
Subject: [PATCH] Handle kernels with no ipv6 support
|
||||
|
||||
If the ipv6 kernel module is not loaded, then we get this when starting
|
||||
a virtual network:
|
||||
|
||||
libvir: Network Config error :
|
||||
cannot enable /proc/sys/net/ipv6/conf/virbr0/disable_ipv6:
|
||||
No such file or directory
|
||||
|
||||
If disable_ipv6 is not present, we should just merrily continue on our
|
||||
way.
|
||||
|
||||
* src/network_driver.c: make networkDisableIPV6() not fail if the kernel
|
||||
has no ipv6 support
|
||||
---
|
||||
src/network_driver.c | 6 ++++++
|
||||
1 files changed, 6 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/src/network_driver.c b/src/network_driver.c
|
||||
index eaea454..84910ab 100644
|
||||
--- a/src/network_driver.c
|
||||
+++ b/src/network_driver.c
|
||||
@@ -801,6 +801,12 @@ static int networkDisableIPV6(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
+ if (access(field, W_OK) < 0 && errno == ENOENT) {
|
||||
+ VIR_DEBUG("ipv6 appears to already be disabled on %s", network->def->bridge);
|
||||
+ ret = 0;
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
if (virFileWriteStr(field, "1") < 0) {
|
||||
virReportSystemError(conn, errno,
|
||||
_("cannot enable %s"), field);
|
||||
--
|
||||
1.6.2.5
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
commit 19bac57b26c2d46ac8a7601158f210f34acdceac
|
||||
Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Date: Thu Aug 13 11:56:31 2009 +0100
|
||||
|
||||
Make LXC / UML drivers robust against NUMA topology brokenness
|
||||
|
||||
Some kernel versions expose broken NUMA topology for some machines.
|
||||
This causes the LXC/UML drivers to fail to start. QEMU driver was
|
||||
already fixed for this problem
|
||||
|
||||
* src/lxc_conf.c: Log and ignore failure to populate NUMA info
|
||||
* src/uml_conf.c: Log and ignore failure to populate NUMA info
|
||||
* src/capabilities.c: Reset nnumaCell to 0 after freeing
|
||||
|
||||
diff --git a/src/capabilities.c b/src/capabilities.c
|
||||
index c6766b6..193a9fe 100644
|
||||
--- a/src/capabilities.c
|
||||
+++ b/src/capabilities.c
|
||||
@@ -139,6 +139,7 @@ virCapabilitiesFreeNUMAInfo(virCapsPtr caps)
|
||||
for (i = 0 ; i < caps->host.nnumaCell ; i++)
|
||||
virCapabilitiesFreeHostNUMACell(caps->host.numaCell[i]);
|
||||
VIR_FREE(caps->host.numaCell);
|
||||
+ caps->host.nnumaCell = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/src/lxc_conf.c b/src/lxc_conf.c
|
||||
index d06a024..fef60ba 100644
|
||||
--- a/src/lxc_conf.c
|
||||
+++ b/src/lxc_conf.c
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "lxc_conf.h"
|
||||
#include "nodeinfo.h"
|
||||
#include "virterror_internal.h"
|
||||
+#include "logging.h"
|
||||
+
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_LXC
|
||||
|
||||
@@ -46,8 +48,14 @@ virCapsPtr lxcCapsInit(void)
|
||||
0, 0)) == NULL)
|
||||
goto no_memory;
|
||||
|
||||
- if (nodeCapsInitNUMA(caps) < 0)
|
||||
- goto no_memory;
|
||||
+ /* Some machines have problematic NUMA toplogy causing
|
||||
+ * unexpected failures. We don't want to break the QEMU
|
||||
+ * driver in this scenario, so log errors & carry on
|
||||
+ */
|
||||
+ if (nodeCapsInitNUMA(caps) < 0) {
|
||||
+ virCapabilitiesFreeNUMAInfo(caps);
|
||||
+ VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities");
|
||||
+ }
|
||||
|
||||
/* XXX shouldn't 'borrow' KVM's prefix */
|
||||
virCapabilitiesSetMacPrefix(caps, (unsigned char []){ 0x52, 0x54, 0x00 });
|
||||
diff --git a/src/uml_conf.c b/src/uml_conf.c
|
||||
index 48e05a8..4f756d4 100644
|
||||
--- a/src/uml_conf.c
|
||||
+++ b/src/uml_conf.c
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "nodeinfo.h"
|
||||
#include "verify.h"
|
||||
#include "bridge.h"
|
||||
+#include "logging.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_UML
|
||||
|
||||
@@ -63,8 +64,14 @@ virCapsPtr umlCapsInit(void) {
|
||||
0, 0)) == NULL)
|
||||
goto no_memory;
|
||||
|
||||
- if (nodeCapsInitNUMA(caps) < 0)
|
||||
- goto no_memory;
|
||||
+ /* Some machines have problematic NUMA toplogy causing
|
||||
+ * unexpected failures. We don't want to break the QEMU
|
||||
+ * driver in this scenario, so log errors & carry on
|
||||
+ */
|
||||
+ if (nodeCapsInitNUMA(caps) < 0) {
|
||||
+ virCapabilitiesFreeNUMAInfo(caps);
|
||||
+ VIR_WARN0("Failed to query host NUMA topology, disabling NUMA capabilities");
|
||||
+ }
|
||||
|
||||
if ((guest = virCapabilitiesAddGuest(caps,
|
||||
"uml",
|
||||
@@ -1,469 +0,0 @@
|
||||
diff -rupN libvirt-0.7.0/configure.in libvirt-0.7.0.new/configure.in
|
||||
--- libvirt-0.7.0/configure.in 2009-08-05 08:53:49.000000000 -0400
|
||||
+++ libvirt-0.7.0.new/configure.in 2009-08-13 08:37:22.393897620 -0400
|
||||
@@ -641,40 +641,61 @@ AC_SUBST([SASL_LIBS])
|
||||
dnl PolicyKit library
|
||||
POLKIT_CFLAGS=
|
||||
POLKIT_LIBS=
|
||||
+PKCHECK_PATH=
|
||||
AC_ARG_WITH([polkit],
|
||||
[ --with-polkit use PolicyKit for UNIX socket access checks],
|
||||
[],
|
||||
[with_polkit=check])
|
||||
|
||||
+with_polkit0=no
|
||||
+with_polkit1=no
|
||||
if test "x$with_polkit" = "xyes" -o "x$with_polkit" = "xcheck"; then
|
||||
- PKG_CHECK_MODULES(POLKIT, polkit-dbus >= $POLKIT_REQUIRED,
|
||||
- [with_polkit=yes], [
|
||||
- if test "x$with_polkit" = "xcheck" ; then
|
||||
- with_polkit=no
|
||||
- else
|
||||
- AC_MSG_ERROR(
|
||||
- [You must install PolicyKit >= $POLKIT_REQUIRED to compile libvirt])
|
||||
- fi
|
||||
- ])
|
||||
- if test "x$with_polkit" = "xyes" ; then
|
||||
+ dnl Check for new polkit first - just a binary
|
||||
+ AC_PATH_PROG([PKCHECK_PATH],[pkcheck], [], [/usr/sbin:$PATH])
|
||||
+ if test "x$PKCHECK_PATH" != "x" ; then
|
||||
+ AC_DEFINE_UNQUOTED([PKCHECK_PATH],["$PKCHECK_PATH"],[Location of pkcheck program])
|
||||
AC_DEFINE_UNQUOTED([HAVE_POLKIT], 1,
|
||||
- [use PolicyKit for UNIX socket access checks])
|
||||
-
|
||||
- old_CFLAGS=$CFLAGS
|
||||
- old_LDFLAGS=$LDFLAGS
|
||||
- CFLAGS="$CFLAGS $POLKIT_CFLAGS"
|
||||
- LDFLAGS="$LDFLAGS $POLKIT_LIBS"
|
||||
- AC_CHECK_FUNCS([polkit_context_is_caller_authorized])
|
||||
- CFLAGS="$old_CFLAGS"
|
||||
- LDFLAGS="$old_LDFLAGS"
|
||||
-
|
||||
- AC_PATH_PROG([POLKIT_AUTH], [polkit-auth])
|
||||
- if test "x$POLKIT_AUTH" != "x"; then
|
||||
- AC_DEFINE_UNQUOTED([POLKIT_AUTH],["$POLKIT_AUTH"],[Location of polkit-auth program])
|
||||
+ [use PolicyKit for UNIX socket access checks])
|
||||
+ AC_DEFINE_UNQUOTED([HAVE_POLKIT1], 1,
|
||||
+ [use PolicyKit for UNIX socket access checks])
|
||||
+ with_polkit="yes"
|
||||
+ with_polkit1="yes"
|
||||
+ else
|
||||
+ dnl Check for old polkit second - library + binary
|
||||
+ PKG_CHECK_MODULES(POLKIT, polkit-dbus >= $POLKIT_REQUIRED,
|
||||
+ [with_polkit=yes], [
|
||||
+ if test "x$with_polkit" = "xcheck" ; then
|
||||
+ with_polkit=no
|
||||
+ else
|
||||
+ AC_MSG_ERROR(
|
||||
+ [You must install PolicyKit >= $POLKIT_REQUIRED to compile libvirt])
|
||||
+ fi
|
||||
+ ])
|
||||
+ if test "x$with_polkit" = "xyes" ; then
|
||||
+ AC_DEFINE_UNQUOTED([HAVE_POLKIT], 1,
|
||||
+ [use PolicyKit for UNIX socket access checks])
|
||||
+ AC_DEFINE_UNQUOTED([HAVE_POLKIT0], 1,
|
||||
+ [use PolicyKit for UNIX socket access checks])
|
||||
+
|
||||
+ old_CFLAGS=$CFLAGS
|
||||
+ old_LDFLAGS=$LDFLAGS
|
||||
+ CFLAGS="$CFLAGS $POLKIT_CFLAGS"
|
||||
+ LDFLAGS="$LDFLAGS $POLKIT_LIBS"
|
||||
+ AC_CHECK_FUNCS([polkit_context_is_caller_authorized])
|
||||
+ CFLAGS="$old_CFLAGS"
|
||||
+ LDFLAGS="$old_LDFLAGS"
|
||||
+
|
||||
+ AC_PATH_PROG([POLKIT_AUTH], [polkit-auth])
|
||||
+ if test "x$POLKIT_AUTH" != "x"; then
|
||||
+ AC_DEFINE_UNQUOTED([POLKIT_AUTH],["$POLKIT_AUTH"],[Location of polkit-auth program])
|
||||
+ fi
|
||||
+ with_polkit0="yes"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL([HAVE_POLKIT], [test "x$with_polkit" = "xyes"])
|
||||
+AM_CONDITIONAL([HAVE_POLKIT0], [test "x$with_polkit0" = "xyes"])
|
||||
+AM_CONDITIONAL([HAVE_POLKIT1], [test "x$with_polkit1" = "xyes"])
|
||||
AC_SUBST([POLKIT_CFLAGS])
|
||||
AC_SUBST([POLKIT_LIBS])
|
||||
|
||||
@@ -1695,7 +1716,11 @@ else
|
||||
AC_MSG_NOTICE([ avahi: no])
|
||||
fi
|
||||
if test "$with_polkit" = "yes" ; then
|
||||
-AC_MSG_NOTICE([ polkit: $POLKIT_CFLAGS $POLKIT_LIBS])
|
||||
+if test "$with_polkit0" = "yes" ; then
|
||||
+AC_MSG_NOTICE([ polkit: $POLKIT_CFLAGS $POLKIT_LIBS (version 0)])
|
||||
+else
|
||||
+AC_MSG_NOTICE([ polkit: $PKCHECK_PATH (version 1)])
|
||||
+fi
|
||||
else
|
||||
AC_MSG_NOTICE([ polkit: no])
|
||||
fi
|
||||
diff -rupN libvirt-0.7.0/qemud/libvirtd.policy libvirt-0.7.0.new/qemud/libvirtd.policy
|
||||
--- libvirt-0.7.0/qemud/libvirtd.policy 2009-07-22 09:37:32.000000000 -0400
|
||||
+++ libvirt-0.7.0.new/qemud/libvirtd.policy 1969-12-31 19:00:00.000000000 -0500
|
||||
@@ -1,42 +0,0 @@
|
||||
-<!DOCTYPE policyconfig PUBLIC
|
||||
- "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
- "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
|
||||
-
|
||||
-<!--
|
||||
-Policy definitions for libvirt daemon
|
||||
-
|
||||
-Copyright (c) 2007 Daniel P. Berrange <berrange redhat com>
|
||||
-
|
||||
-libvirt is licensed to you under the GNU Lesser General Public License
|
||||
-version 2. See COPYING for details.
|
||||
-
|
||||
-NOTE: If you make changes to this file, make sure to validate the file
|
||||
-using the polkit-policy-file-validate(1) tool. Changes made to this
|
||||
-file are instantly applied.
|
||||
--->
|
||||
-
|
||||
-<policyconfig>
|
||||
- <action id="org.libvirt.unix.monitor">
|
||||
- <description>Monitor local virtualized systems</description>
|
||||
- <message>System policy prevents monitoring of local virtualized systems</message>
|
||||
- <defaults>
|
||||
- <!-- Any program can use libvirt in read-only mode for monitoring,
|
||||
- even if not part of a session -->
|
||||
- <allow_any>yes</allow_any>
|
||||
- <allow_inactive>yes</allow_inactive>
|
||||
- <allow_active>yes</allow_active>
|
||||
- </defaults>
|
||||
- </action>
|
||||
-
|
||||
- <action id="org.libvirt.unix.manage">
|
||||
- <description>Manage local virtualized systems</description>
|
||||
- <message>System policy prevents management of local virtualized systems</message>
|
||||
- <defaults>
|
||||
- <!-- Only a program in the active host session can use libvirt in
|
||||
- read-write mode for management, and we require user password -->
|
||||
- <allow_any>no</allow_any>
|
||||
- <allow_inactive>no</allow_inactive>
|
||||
- <allow_active>auth_admin_keep_session</allow_active>
|
||||
- </defaults>
|
||||
- </action>
|
||||
-</policyconfig>
|
||||
diff -rupN libvirt-0.7.0/qemud/libvirtd.policy-0 libvirt-0.7.0.new/qemud/libvirtd.policy-0
|
||||
--- libvirt-0.7.0/qemud/libvirtd.policy-0 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ libvirt-0.7.0.new/qemud/libvirtd.policy-0 2009-08-13 08:37:22.408883879 -0400
|
||||
@@ -0,0 +1,42 @@
|
||||
+<!DOCTYPE policyconfig PUBLIC
|
||||
+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
+ "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
|
||||
+
|
||||
+<!--
|
||||
+Policy definitions for libvirt daemon
|
||||
+
|
||||
+Copyright (c) 2007 Daniel P. Berrange <berrange redhat com>
|
||||
+
|
||||
+libvirt is licensed to you under the GNU Lesser General Public License
|
||||
+version 2. See COPYING for details.
|
||||
+
|
||||
+NOTE: If you make changes to this file, make sure to validate the file
|
||||
+using the polkit-policy-file-validate(1) tool. Changes made to this
|
||||
+file are instantly applied.
|
||||
+-->
|
||||
+
|
||||
+<policyconfig>
|
||||
+ <action id="org.libvirt.unix.monitor">
|
||||
+ <description>Monitor local virtualized systems</description>
|
||||
+ <message>System policy prevents monitoring of local virtualized systems</message>
|
||||
+ <defaults>
|
||||
+ <!-- Any program can use libvirt in read-only mode for monitoring,
|
||||
+ even if not part of a session -->
|
||||
+ <allow_any>yes</allow_any>
|
||||
+ <allow_inactive>yes</allow_inactive>
|
||||
+ <allow_active>yes</allow_active>
|
||||
+ </defaults>
|
||||
+ </action>
|
||||
+
|
||||
+ <action id="org.libvirt.unix.manage">
|
||||
+ <description>Manage local virtualized systems</description>
|
||||
+ <message>System policy prevents management of local virtualized systems</message>
|
||||
+ <defaults>
|
||||
+ <!-- Only a program in the active host session can use libvirt in
|
||||
+ read-write mode for management, and we require user password -->
|
||||
+ <allow_any>no</allow_any>
|
||||
+ <allow_inactive>no</allow_inactive>
|
||||
+ <allow_active>auth_admin_keep_session</allow_active>
|
||||
+ </defaults>
|
||||
+ </action>
|
||||
+</policyconfig>
|
||||
diff -rupN libvirt-0.7.0/qemud/libvirtd.policy-1 libvirt-0.7.0.new/qemud/libvirtd.policy-1
|
||||
--- libvirt-0.7.0/qemud/libvirtd.policy-1 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ libvirt-0.7.0.new/qemud/libvirtd.policy-1 2009-08-13 08:37:22.412905763 -0400
|
||||
@@ -0,0 +1,42 @@
|
||||
+<!DOCTYPE policyconfig PUBLIC
|
||||
+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
+ "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
|
||||
+
|
||||
+<!--
|
||||
+Policy definitions for libvirt daemon
|
||||
+
|
||||
+Copyright (c) 2007 Daniel P. Berrange <berrange redhat com>
|
||||
+
|
||||
+libvirt is licensed to you under the GNU Lesser General Public License
|
||||
+version 2. See COPYING for details.
|
||||
+
|
||||
+NOTE: If you make changes to this file, make sure to validate the file
|
||||
+using the polkit-policy-file-validate(1) tool. Changes made to this
|
||||
+file are instantly applied.
|
||||
+-->
|
||||
+
|
||||
+<policyconfig>
|
||||
+ <action id="org.libvirt.unix.monitor">
|
||||
+ <description>Monitor local virtualized systems</description>
|
||||
+ <message>System policy prevents monitoring of local virtualized systems</message>
|
||||
+ <defaults>
|
||||
+ <!-- Any program can use libvirt in read-only mode for monitoring,
|
||||
+ even if not part of a session -->
|
||||
+ <allow_any>yes</allow_any>
|
||||
+ <allow_inactive>yes</allow_inactive>
|
||||
+ <allow_active>yes</allow_active>
|
||||
+ </defaults>
|
||||
+ </action>
|
||||
+
|
||||
+ <action id="org.libvirt.unix.manage">
|
||||
+ <description>Manage local virtualized systems</description>
|
||||
+ <message>System policy prevents management of local virtualized systems</message>
|
||||
+ <defaults>
|
||||
+ <!-- Only a program in the active host session can use libvirt in
|
||||
+ read-write mode for management, and we require user password -->
|
||||
+ <allow_any>no</allow_any>
|
||||
+ <allow_inactive>no</allow_inactive>
|
||||
+ <allow_active>auth_admin_keep</allow_active>
|
||||
+ </defaults>
|
||||
+ </action>
|
||||
+</policyconfig>
|
||||
diff -rupN libvirt-0.7.0/qemud/Makefile.am libvirt-0.7.0.new/qemud/Makefile.am
|
||||
--- libvirt-0.7.0/qemud/Makefile.am 2009-07-22 09:37:32.000000000 -0400
|
||||
+++ libvirt-0.7.0.new/qemud/Makefile.am 2009-08-13 08:37:22.398915449 -0400
|
||||
@@ -21,7 +21,8 @@ EXTRA_DIST = \
|
||||
remote_protocol.x \
|
||||
libvirtd.conf \
|
||||
libvirtd.init.in \
|
||||
- libvirtd.policy \
|
||||
+ libvirtd.policy-0 \
|
||||
+ libvirtd.policy-1 \
|
||||
libvirtd.sasl \
|
||||
libvirtd.sysconf \
|
||||
libvirtd.aug \
|
||||
@@ -147,7 +148,13 @@ endif
|
||||
libvirtd_LDADD += ../src/libvirt.la
|
||||
|
||||
if HAVE_POLKIT
|
||||
+if HAVE_POLKIT0
|
||||
policydir = $(datadir)/PolicyKit/policy
|
||||
+policyfile = libvirtd.policy-0
|
||||
+else
|
||||
+policydir = $(datadir)/polkit-1/actions
|
||||
+policyfile = libvirtd.policy-1
|
||||
+endif
|
||||
endif
|
||||
|
||||
if HAVE_AVAHI
|
||||
@@ -197,7 +204,7 @@ endif
|
||||
if HAVE_POLKIT
|
||||
install-data-polkit:: install-init
|
||||
mkdir -p $(DESTDIR)$(policydir)
|
||||
- $(INSTALL_DATA) $(srcdir)/libvirtd.policy $(DESTDIR)$(policydir)/org.libvirt.unix.policy
|
||||
+ $(INSTALL_DATA) $(srcdir)/$(policyfile) $(DESTDIR)$(policydir)/org.libvirt.unix.policy
|
||||
uninstall-data-polkit:: install-init
|
||||
rm -f $(DESTDIR)$(policydir)/org.libvirt.unix.policy
|
||||
else
|
||||
diff -rupN libvirt-0.7.0/qemud/qemud.c libvirt-0.7.0.new/qemud/qemud.c
|
||||
--- libvirt-0.7.0/qemud/qemud.c 2009-07-22 09:37:32.000000000 -0400
|
||||
+++ libvirt-0.7.0.new/qemud/qemud.c 2009-08-13 08:37:22.419878018 -0400
|
||||
@@ -895,7 +895,7 @@ static struct qemud_server *qemudNetwork
|
||||
}
|
||||
#endif
|
||||
|
||||
-#ifdef HAVE_POLKIT
|
||||
+#if HAVE_POLKIT0
|
||||
if (auth_unix_rw == REMOTE_AUTH_POLKIT ||
|
||||
auth_unix_ro == REMOTE_AUTH_POLKIT) {
|
||||
DBusError derr;
|
||||
@@ -982,7 +982,7 @@ static struct qemud_server *qemudNetwork
|
||||
sock = sock->next;
|
||||
}
|
||||
|
||||
-#ifdef HAVE_POLKIT
|
||||
+#if HAVE_POLKIT0
|
||||
if (server->sysbus)
|
||||
dbus_connection_unref(server->sysbus);
|
||||
#endif
|
||||
diff -rupN libvirt-0.7.0/qemud/qemud.h libvirt-0.7.0.new/qemud/qemud.h
|
||||
--- libvirt-0.7.0/qemud/qemud.h 2009-07-23 12:33:02.000000000 -0400
|
||||
+++ libvirt-0.7.0.new/qemud/qemud.h 2009-08-13 08:37:22.425909852 -0400
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <sasl/sasl.h>
|
||||
#endif
|
||||
|
||||
-#ifdef HAVE_POLKIT
|
||||
+#if HAVE_POLKIT0
|
||||
#include <dbus/dbus.h>
|
||||
#endif
|
||||
|
||||
@@ -253,7 +253,7 @@ struct qemud_server {
|
||||
#if HAVE_SASL
|
||||
char **saslUsernameWhitelist;
|
||||
#endif
|
||||
-#if HAVE_POLKIT
|
||||
+#if HAVE_POLKIT0
|
||||
DBusConnection *sysbus;
|
||||
#endif
|
||||
};
|
||||
diff -rupN libvirt-0.7.0/qemud/remote.c libvirt-0.7.0.new/qemud/remote.c
|
||||
--- libvirt-0.7.0/qemud/remote.c 2009-07-23 12:33:02.000000000 -0400
|
||||
+++ libvirt-0.7.0.new/qemud/remote.c 2009-08-13 08:37:22.431865087 -0400
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <fnmatch.h>
|
||||
#include "virterror_internal.h"
|
||||
|
||||
-#ifdef HAVE_POLKIT
|
||||
+#if HAVE_POLKIT0
|
||||
#include <polkit/polkit.h>
|
||||
#include <polkit-dbus/polkit-dbus.h>
|
||||
#endif
|
||||
@@ -3106,7 +3106,80 @@ remoteDispatchAuthSaslStep (struct qemud
|
||||
#endif /* HAVE_SASL */
|
||||
|
||||
|
||||
-#if HAVE_POLKIT
|
||||
+#if HAVE_POLKIT1
|
||||
+static int
|
||||
+remoteDispatchAuthPolkit (struct qemud_server *server,
|
||||
+ struct qemud_client *client,
|
||||
+ virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
+ remote_error *rerr,
|
||||
+ void *args ATTRIBUTE_UNUSED,
|
||||
+ remote_auth_polkit_ret *ret)
|
||||
+{
|
||||
+ pid_t callerPid;
|
||||
+ uid_t callerUid;
|
||||
+ const char *action;
|
||||
+ int status = -1;
|
||||
+ char pidbuf[50];
|
||||
+ int rv;
|
||||
+
|
||||
+ virMutexLock(&server->lock);
|
||||
+ virMutexLock(&client->lock);
|
||||
+ virMutexUnlock(&server->lock);
|
||||
+
|
||||
+ action = client->readonly ?
|
||||
+ "org.libvirt.unix.monitor" :
|
||||
+ "org.libvirt.unix.manage";
|
||||
+
|
||||
+ const char * const pkcheck [] = {
|
||||
+ PKCHECK_PATH,
|
||||
+ "--action-id", action,
|
||||
+ "--process", pidbuf,
|
||||
+ "--allow-user-interaction",
|
||||
+ NULL
|
||||
+ };
|
||||
+
|
||||
+ REMOTE_DEBUG("Start PolicyKit auth %d", client->fd);
|
||||
+ if (client->auth != REMOTE_AUTH_POLKIT) {
|
||||
+ VIR_ERROR0(_("client tried invalid PolicyKit init request"));
|
||||
+ goto authfail;
|
||||
+ }
|
||||
+
|
||||
+ if (qemudGetSocketIdentity(client->fd, &callerUid, &callerPid) < 0) {
|
||||
+ VIR_ERROR0(_("cannot get peer socket identity"));
|
||||
+ goto authfail;
|
||||
+ }
|
||||
+
|
||||
+ VIR_INFO(_("Checking PID %d running as %d"), callerPid, callerUid);
|
||||
+
|
||||
+ rv = snprintf(pidbuf, sizeof pidbuf, "%d", callerPid);
|
||||
+ if (rv < 0 || rv >= sizeof pidbuf) {
|
||||
+ VIR_ERROR(_("Caller PID was too large %d"), callerPid);
|
||||
+ goto authfail;
|
||||
+ }
|
||||
+
|
||||
+ if (virRun(NULL, pkcheck, &status) < 0) {
|
||||
+ VIR_ERROR(_("Cannot invoke %s"), PKCHECK_PATH);
|
||||
+ goto authfail;
|
||||
+ }
|
||||
+ if (status != 0) {
|
||||
+ VIR_ERROR(_("Policy kit denied action %s from pid %d, uid %d, result: %d\n"),
|
||||
+ action, callerPid, callerUid, status);
|
||||
+ goto authfail;
|
||||
+ }
|
||||
+ VIR_INFO(_("Policy allowed action %s from pid %d, uid %d"),
|
||||
+ action, callerPid, callerUid);
|
||||
+ ret->complete = 1;
|
||||
+ client->auth = REMOTE_AUTH_NONE;
|
||||
+
|
||||
+ virMutexUnlock(&client->lock);
|
||||
+ return 0;
|
||||
+
|
||||
+authfail:
|
||||
+ remoteDispatchAuthError(rerr);
|
||||
+ virMutexUnlock(&client->lock);
|
||||
+ return -1;
|
||||
+}
|
||||
+#elif HAVE_POLKIT0
|
||||
static int
|
||||
remoteDispatchAuthPolkit (struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
@@ -3217,7 +3290,7 @@ authfail:
|
||||
return -1;
|
||||
}
|
||||
|
||||
-#else /* HAVE_POLKIT */
|
||||
+#else /* !HAVE_POLKIT0 & !HAVE_POLKIT1*/
|
||||
|
||||
static int
|
||||
remoteDispatchAuthPolkit (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
@@ -3231,7 +3304,7 @@ remoteDispatchAuthPolkit (struct qemud_s
|
||||
remoteDispatchAuthError(rerr);
|
||||
return -1;
|
||||
}
|
||||
-#endif /* HAVE_POLKIT */
|
||||
+#endif /* HAVE_POLKIT1 */
|
||||
|
||||
|
||||
/***************************************************************
|
||||
diff -rupN libvirt-0.7.0/src/remote_internal.c libvirt-0.7.0.new/src/remote_internal.c
|
||||
--- libvirt-0.7.0/src/remote_internal.c 2009-07-29 10:42:15.000000000 -0400
|
||||
+++ libvirt-0.7.0.new/src/remote_internal.c 2009-08-13 10:55:57.607899170 -0400
|
||||
@@ -6201,6 +6201,7 @@ remoteAuthPolkit (virConnectPtr conn, st
|
||||
virConnectAuthPtr auth)
|
||||
{
|
||||
remote_auth_polkit_ret ret;
|
||||
+#if HAVE_POLKIT0
|
||||
int i, allowcb = 0;
|
||||
virConnectCredential cred = {
|
||||
VIR_CRED_EXTERNAL,
|
||||
@@ -6210,8 +6211,10 @@ remoteAuthPolkit (virConnectPtr conn, st
|
||||
NULL,
|
||||
0,
|
||||
};
|
||||
+#endif
|
||||
DEBUG0("Client initialize PolicyKit authentication");
|
||||
|
||||
+#if HAVE_POLKIT0
|
||||
if (auth && auth->cb) {
|
||||
/* Check if the necessary credential type for PolicyKit is supported */
|
||||
for (i = 0 ; i < auth->ncredtype ; i++) {
|
||||
@@ -6220,6 +6223,7 @@ remoteAuthPolkit (virConnectPtr conn, st
|
||||
}
|
||||
|
||||
if (allowcb) {
|
||||
+ DEBUG0("Client run callback for PolicyKit authentication");
|
||||
/* Run the authentication callback */
|
||||
if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
|
||||
virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
@@ -6233,6 +6237,9 @@ remoteAuthPolkit (virConnectPtr conn, st
|
||||
} else {
|
||||
DEBUG0("No auth callback provided");
|
||||
}
|
||||
+#else
|
||||
+ DEBUG0("No auth callback required for PolicyKit-1");
|
||||
+#endif
|
||||
|
||||
memset (&ret, 0, sizeof ret);
|
||||
if (call (conn, priv, in_open, REMOTE_PROC_AUTH_POLKIT,
|
||||
@@ -0,0 +1,180 @@
|
||||
From f3997733f0bca081d71848e66ca7d728b4c0a864 Mon Sep 17 00:00:00 2001
|
||||
From: Alon Levy <alevy@redhat.com>
|
||||
Date: Tue, 8 May 2012 20:42:44 +0300
|
||||
Subject: [PATCH] domain_conf: add "default" to list of valid spice channels
|
||||
|
||||
qemu's behavior in this case is to change the spice server behavior to
|
||||
require secure connection to any channel not otherwise specified as
|
||||
being in plaintext mode. libvirt doesn't currently allow requesting this
|
||||
(via plaintext-channel=<channel name>).
|
||||
|
||||
RHBZ: 819499
|
||||
|
||||
Signed-off-by: Alon Levy <alevy@redhat.com>
|
||||
(cherry picked from commit ba97e4edc6aa439a4f1e70855cf4503181efdb7f)
|
||||
Signed-off-by: Cole Robinson <crobinso@redhat.com>
|
||||
---
|
||||
docs/formatdomain.html.in | 7 +++++++
|
||||
docs/schemas/domaincommon.rng | 9 +++++++++
|
||||
src/conf/domain_conf.c | 20 ++++++++++++++++++++
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/qemu/qemu_command.c | 13 +++++++++++++
|
||||
.../qemuxml2argv-graphics-spice.args | 2 +-
|
||||
.../qemuxml2argv-graphics-spice.xml | 2 +-
|
||||
7 files changed, 52 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index e33913f..4a70b0f 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -2913,6 +2913,13 @@ qemu-kvm -net nic,model=? /dev/null
|
||||
<span class="since">Since 0.9.3</span>
|
||||
NB, this may not be supported by all hypervisors.
|
||||
<span class="since">"spice" since 0.8.6</span>.
|
||||
+ The <code>defaultMode</code> attribute sets the default channel
|
||||
+ security policy, valid values are <code>secure</code>,
|
||||
+ <code>insecure</code> and the default <code>any</code>
|
||||
+ (which is secure if possible, but falls back to insecure
|
||||
+ rather than erroring out if no secure path is
|
||||
+ available). <span class="since">"defaultMode" since
|
||||
+ 0.9.12</span>.
|
||||
</p>
|
||||
<p>
|
||||
When SPICE has both a normal and TLS secured TCP port
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index 5bcf1b9..30ab4c6 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -1779,6 +1779,15 @@
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <attribute name="defaultMode">
|
||||
+ <choice>
|
||||
+ <value>any</value>
|
||||
+ <value>secure</value>
|
||||
+ <value>insecure</value>
|
||||
+ </choice>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
<interleave>
|
||||
<ref name="listenElements"/>
|
||||
<zeroOrMore>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index d017ea4..2b21b11 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -6069,6 +6069,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
|
||||
char *port = virXMLPropString(node, "port");
|
||||
char *tlsPort;
|
||||
char *autoport;
|
||||
+ char *defaultMode;
|
||||
+ int defaultModeVal;
|
||||
|
||||
if (port) {
|
||||
if (virStrToLong_i(port, NULL, 10, &def->data.spice.port) < 0) {
|
||||
@@ -6101,6 +6103,20 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
|
||||
VIR_FREE(autoport);
|
||||
}
|
||||
|
||||
+ def->data.spice.defaultMode = VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY;
|
||||
+
|
||||
+ if ((defaultMode = virXMLPropString(node, "defaultMode")) != NULL) {
|
||||
+ if ((defaultModeVal = virDomainGraphicsSpiceChannelModeTypeFromString(defaultMode)) < 0) {
|
||||
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("unknown default spice channel mode %s"),
|
||||
+ defaultMode);
|
||||
+ VIR_FREE(defaultMode);
|
||||
+ goto error;
|
||||
+ }
|
||||
+ def->data.spice.defaultMode = defaultModeVal;
|
||||
+ VIR_FREE(defaultMode);
|
||||
+ }
|
||||
+
|
||||
if (def->data.spice.port == -1 && def->data.spice.tlsPort == -1) {
|
||||
/* Legacy compat syntax, used -1 for auto-port */
|
||||
def->data.spice.autoport = 1;
|
||||
@@ -12111,6 +12127,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
|
||||
virBufferEscapeString(buf, " keymap='%s'",
|
||||
def->data.spice.keymap);
|
||||
|
||||
+ if (def->data.spice.defaultMode != VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY)
|
||||
+ virBufferAsprintf(buf, " defaultMode='%s'",
|
||||
+ virDomainGraphicsSpiceChannelModeTypeToString(def->data.spice.defaultMode));
|
||||
+
|
||||
virDomainGraphicsAuthDefFormatAttr(buf, &def->data.spice.auth, flags);
|
||||
break;
|
||||
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index a2fea00..62eaafb 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -1233,6 +1233,7 @@ struct _virDomainGraphicsDef {
|
||||
virDomainGraphicsAuthDef auth;
|
||||
unsigned int autoport :1;
|
||||
int channels[VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST];
|
||||
+ int defaultMode; /* enum virDomainGraphicsSpiceChannelMode */
|
||||
int image;
|
||||
int jpeg;
|
||||
int zlib;
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 55e772f..f411712 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -5499,6 +5499,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
const char *listenAddr = NULL;
|
||||
char *netAddr = NULL;
|
||||
int ret;
|
||||
+ int defaultMode = def->graphics[0]->data.spice.defaultMode;
|
||||
|
||||
if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SPICE)) {
|
||||
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
@@ -5582,6 +5583,18 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
virBufferAsprintf(&opt, ",x509-dir=%s",
|
||||
driver->spiceTLSx509certdir);
|
||||
|
||||
+ switch (defaultMode) {
|
||||
+ case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
|
||||
+ virBufferAsprintf(&opt, ",tls-channel=default");
|
||||
+ break;
|
||||
+ case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE:
|
||||
+ virBufferAsprintf(&opt, ",plaintext-channel=default");
|
||||
+ break;
|
||||
+ case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY:
|
||||
+ /* nothing */
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
for (i = 0 ; i < VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST ; i++) {
|
||||
int mode = def->graphics[0]->data.spice.channels[i];
|
||||
switch (mode) {
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
|
||||
index c9fdb99..698e39c 100644
|
||||
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
|
||||
@@ -2,7 +2,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
|
||||
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor \
|
||||
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
|
||||
/dev/HostVG/QEMUGuest1 -spice port=5903,tls-port=5904,addr=127.0.0.1,\
|
||||
-x509-dir=/etc/pki/libvirt-spice,tls-channel=main,plaintext-channel=inputs,\
|
||||
+x509-dir=/etc/pki/libvirt-spice,tls-channel=default,tls-channel=main,plaintext-channel=inputs,\
|
||||
image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,\
|
||||
playback-compression=on,streaming-video=filter,disable-copy-paste -vga \
|
||||
qxl -global qxl.vram_size=18874368 -device qxl,id=video1,vram_size=33554432,bus=pci.0,addr=0x4 \
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
|
||||
index 8930b60..a3789f2 100644
|
||||
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
|
||||
@@ -22,7 +22,7 @@
|
||||
<controller type='usb' index='0'/>
|
||||
<controller type='ide' index='0'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
- <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
|
||||
+ <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1' defaultMode='secure'>
|
||||
<listen type='address' address='127.0.0.1'/>
|
||||
<channel name='main' mode='secure'/>
|
||||
<channel name='inputs' mode='insecure'/>
|
||||
--
|
||||
1.7.7.6
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
From 3c3816ed226e766aa76624de7d159cdd1ee67913 Mon Sep 17 00:00:00 2001
|
||||
From: Alon Levy <alevy@redhat.com>
|
||||
Date: Tue, 8 May 2012 16:00:28 +0300
|
||||
Subject: [PATCH] domain_conf: add "usbredir" to list of valid spice channels
|
||||
|
||||
Add "usbredir" channel to list of recognized spice channels.
|
||||
|
||||
RHBZ: 819498
|
||||
|
||||
Signed-off-by: Alon Levy <alevy@redhat.com>
|
||||
(cherry picked from commit 4e78ffb63489071c4100678ed88d3111284555e8)
|
||||
Signed-off-by: Cole Robinson <crobinso@redhat.com>
|
||||
---
|
||||
docs/formatdomain.html.in | 8 ++-
|
||||
docs/schemas/domaincommon.rng | 1 +
|
||||
src/conf/domain_conf.c | 3 +-
|
||||
src/conf/domain_conf.h | 1 +
|
||||
.../qemuxml2argv-graphics-spice-usb-redir.args | 16 ++++++
|
||||
.../qemuxml2argv-graphics-spice-usb-redir.xml | 53 ++++++++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 6 ++
|
||||
7 files changed, 84 insertions(+), 4 deletions(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.args
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.xml
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index 801e1ec..e33913f 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -2922,9 +2922,11 @@ qemu-kvm -net nic,model=? /dev/null
|
||||
main <graphics> element. Valid channel names
|
||||
include <code>main</code>, <code>display</code>,
|
||||
<code>inputs</code>, <code>cursor</code>,
|
||||
- <code>playback</code>, <code>record</code>;
|
||||
- and <span class="since">since
|
||||
- 0.8.8</span>: <code>smartcard</code>.
|
||||
+ <code>playback</code>, <code>record</code>
|
||||
+ (all <span class="since"> since 0.8.6</span>);
|
||||
+ <code>smartcard</code> (<span class="since">since
|
||||
+ 0.8.8</span>); and <code>usbredir</code>
|
||||
+ (<span class="since">since 0.9.12</span>).
|
||||
</p>
|
||||
<pre>
|
||||
<graphics type='spice' port='-1' tlsPort='-1' autoport='yes'>
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index 0cc04af..5bcf1b9 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -1792,6 +1792,7 @@
|
||||
<value>playback</value>
|
||||
<value>record</value>
|
||||
<value>smartcard</value>
|
||||
+ <value>usbredir</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<attribute name="mode">
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index d886b60..d017ea4 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -428,7 +428,8 @@ VIR_ENUM_IMPL(virDomainGraphicsSpiceChannelName,
|
||||
"cursor",
|
||||
"playback",
|
||||
"record",
|
||||
- "smartcard");
|
||||
+ "smartcard",
|
||||
+ "usbredir");
|
||||
|
||||
VIR_ENUM_IMPL(virDomainGraphicsSpiceChannelMode,
|
||||
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_LAST,
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 1b8741e..a2fea00 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -1097,6 +1097,7 @@ enum virDomainGraphicsSpiceChannelName {
|
||||
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_PLAYBACK,
|
||||
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_RECORD,
|
||||
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_SMARTCARD,
|
||||
+ VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_USBREDIR,
|
||||
|
||||
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST
|
||||
};
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.args
|
||||
new file mode 100644
|
||||
index 0000000..35e51a7
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.args
|
||||
@@ -0,0 +1,16 @@
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice /usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \
|
||||
+-device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 \
|
||||
+-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 \
|
||||
+-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \
|
||||
+-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \
|
||||
+-spice port=5903,tls-port=5904,addr=127.0.0.1,\
|
||||
+x509-dir=/etc/pki/libvirt-spice,tls-channel=main,plaintext-channel=inputs,\
|
||||
+tls-channel=usbredir,\
|
||||
+image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,\
|
||||
+playback-compression=on,streaming-video=filter,disable-copy-paste \
|
||||
+-vga cirrus \
|
||||
+-chardev socket,id=charredir0,host=localhost,port=4000 \
|
||||
+-device usb-redir,chardev=charredir0,id=redir0 \
|
||||
+-chardev spicevmc,id=charredir1,name=usbredir \
|
||||
+-device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=4 \
|
||||
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.xml
|
||||
new file mode 100644
|
||||
index 0000000..1dc23bd
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.xml
|
||||
@@ -0,0 +1,53 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</currentMemory>
|
||||
+ <vcpu>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='i686' machine='pc'>hvm</type>
|
||||
+ <boot dev='hd'/>
|
||||
+ </os>
|
||||
+ <clock offset='utc'/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>destroy</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu</emulator>
|
||||
+ <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
|
||||
+ <listen type='address' address='127.0.0.1'/>
|
||||
+ <channel name='main' mode='secure'/>
|
||||
+ <channel name='inputs' mode='insecure'/>
|
||||
+ <channel name='usbredir' mode='secure'/>
|
||||
+ <image compression='auto_glz'/>
|
||||
+ <jpeg compression='auto'/>
|
||||
+ <zlib compression='auto'/>
|
||||
+ <playback compression='on'/>
|
||||
+ <streaming mode='filter'/>
|
||||
+ <clipboard copypaste='no'/>
|
||||
+ </graphics>
|
||||
+ <controller type='usb' index='0' model='ich9-ehci1'>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
|
||||
+ </controller>
|
||||
+ <controller type='usb' index='0' model='ich9-uhci1'>
|
||||
+ <master startport='0'/>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
|
||||
+ </controller>
|
||||
+ <controller type='usb' index='0' model='ich9-uhci2'>
|
||||
+ <master startport='2'/>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
|
||||
+ </controller>
|
||||
+ <controller type='usb' index='0' model='ich9-uhci3'>
|
||||
+ <master startport='4'/>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>
|
||||
+ </controller>
|
||||
+ <redirdev bus='usb' type='tcp'>
|
||||
+ <source mode='connect' host='localhost' service='4000'/>
|
||||
+ <protocol type='raw'/>
|
||||
+ </redirdev>
|
||||
+ <redirdev bus='usb' type='spicevmc'>
|
||||
+ <address type='usb' bus='0' port='4'/>
|
||||
+ </redirdev>
|
||||
+ <memballoon model='virtio'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index a32d4f8..b128c07 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -540,6 +540,12 @@ mymain(void)
|
||||
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
|
||||
QEMU_CAPS_DEVICE_QXL_VGA);
|
||||
+ DO_TEST("graphics-spice-usb-redir", false,
|
||||
+ QEMU_CAPS_VGA, QEMU_CAPS_SPICE,
|
||||
+ QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
|
||||
+ QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
|
||||
+ QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
|
||||
+ QEMU_CAPS_CHARDEV_SPICEVMC);
|
||||
|
||||
DO_TEST("input-usbmouse", false, NONE);
|
||||
DO_TEST("input-usbtablet", false, NONE);
|
||||
--
|
||||
1.7.7.6
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--- libvirt-0.9.11.5.orig/src/lxc/lxc_container.c 2012-08-12 18:03:58.000000000 -0500
|
||||
+++ libvirt-0.9.11.5.orig/src/lxc/lxc_container.c 2012-09-21 07:38:19.000000000 -0500
|
||||
@@ -506,7 +506,7 @@
|
||||
if (pivotRoot) {
|
||||
#if HAVE_SELINUX
|
||||
if (getfilecon("/", &con) < 0 &&
|
||||
- errno != ENOTSUP) {
|
||||
+ errno != ENOTSUP && errno != ENODATA) {
|
||||
virReportSystemError(errno, "%s",
|
||||
_("Failed to query file context on /"));
|
||||
goto cleanup;
|
||||
--- libvirt-0.9.11.5.orig/src/lxc/lxc_controller.c 2012-08-12 18:03:58.000000000 -0500
|
||||
+++ libvirt-0.9.11.5.orig/src/lxc/lxc_controller.c 2012-09-21 07:20:41.000000000 -0500
|
||||
@@ -1480,7 +1480,7 @@
|
||||
|
||||
#if HAVE_SELINUX
|
||||
if (getfilecon(root->src, &con) < 0 &&
|
||||
- errno != ENOTSUP) {
|
||||
+ errno != ENOTSUP && errno != ENODATA) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to query file context on %s"),
|
||||
root->src);
|
||||
@@ -0,0 +1,155 @@
|
||||
From 7c96ce960b84ba19b9cc8e090615f54206e44ff0 Mon Sep 17 00:00:00 2001
|
||||
From: Laine Stump <laine@laine.org>
|
||||
Date: Tue, 6 Dec 2011 12:47:28 -0500
|
||||
Subject: [PATCH] qemu: replace deprecated fedora-13 machine type with pc-0.14
|
||||
|
||||
This addresses https://bugzilla.redhat.com/show_bug.cgi?id=754772 .
|
||||
It should only be applied to Fedora builds of libvirt, F15 and
|
||||
later, so there is no upstream equivalent patch.
|
||||
|
||||
Background:
|
||||
|
||||
During the lifetime of Fedora 13, some features were backported into
|
||||
the F13 build of qemu-kvm from upstream. These features were part of
|
||||
the functionality of machine type "pc-0.13" in upstream qemu-kvm, so a
|
||||
special "fedora-13" machine type was created for the F13 qemu-kvm.
|
||||
Since "fedora-13" became the new "canonical machine type", all new
|
||||
domains created with F13 libvirt tools by default contained that
|
||||
machine type in their configuration file.
|
||||
|
||||
In Fedora 14, a patch was made to qemu to treat the fedora-13 machine
|
||||
type as equivalent to "pc-0.13". When Fedora 15 was released, this was
|
||||
inadvertently changed to make it equivalent to "pc-0.14".
|
||||
|
||||
With the release of Fedora 16, qemu-kvm initially removed support for
|
||||
this machine type, which caused failure of many guest configurations
|
||||
to start. qemu-kvm subsequently re-added the patch to support
|
||||
fedora-13 (as equivalent to pc-0.14), but with the promise that they
|
||||
could remove it with the release of Fedora 17. (see
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=748218 ).
|
||||
|
||||
Solution:
|
||||
|
||||
In order to create a repeat of the recent problems, prior to F17
|
||||
existing guest configurations need to be updated to change fedora-13
|
||||
to pc-0.14 (which has been determined to be equivalent for all
|
||||
practical purposes in both F15 and F16). That's what this patch does:
|
||||
|
||||
1) Each time libvirtd is started, it calls virDomainLoadAllConfigs()
|
||||
which calls virDomainLoadConfig(); this function has been modified to
|
||||
check for os.machine == "fedora-13", and change it to "pc-0.14" then
|
||||
write the updated config back to disk.
|
||||
|
||||
2) Also, any other time a domain definition is parsed, the parsed
|
||||
version in memory is changed to turn "fedora-13" into "pc-0.14". This
|
||||
handles domains that had been saved to disk prior to the upgrade, and
|
||||
are subsequently restarted.
|
||||
|
||||
3) Finally, whenever a domain definition is formatted into a string,
|
||||
any occurrence of fedora-13 is replaced with pc-0.14 *directly in the
|
||||
virDomainDef* (to avoid multiple warning messages for the same object
|
||||
when it's formatted multiple times). This should deal with those cases
|
||||
where a domain was running at the time of upgrade, and is later
|
||||
saved/snapshotted.
|
||||
|
||||
I had considered doing this with some sed commands in the specfile,
|
||||
but that wouldn't do anything to help the xml saved in image files.
|
||||
|
||||
(Also, one of the xml tests was using the machine type "fedora-13",
|
||||
and since that machine type is treated specially by the rest of this
|
||||
patch, it was failing. That has been changed in a separate patch,
|
||||
which must be applied with this patch, and which *is* also upstream).
|
||||
---
|
||||
src/conf/domain_conf.c | 62 +++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 files changed, 59 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index f8d0a4c..c79014b 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -8394,7 +8394,25 @@ virDomainDefPtr virDomainDefParseString(virCapsPtr caps,
|
||||
unsigned int expectedVirtTypes,
|
||||
unsigned int flags)
|
||||
{
|
||||
- return virDomainDefParse(xmlStr, NULL, caps, expectedVirtTypes, flags);
|
||||
+ virDomainDefPtr def
|
||||
+ = virDomainDefParse(xmlStr, NULL, caps, expectedVirtTypes, flags);
|
||||
+
|
||||
+ /* Fedora-specific HACK - treat fedora-13 and pc-0.14 as equivalent.
|
||||
+ * This handles the case of domains that had been saved to an image file
|
||||
+ * prior to upgrade (save or snapshot), then restarted/reverted.
|
||||
+ */
|
||||
+ if (def && STREQ_NULLABLE(def->os.machine, "fedora-13")) {
|
||||
+ VIR_FREE(def->os.machine);
|
||||
+ if (!(def->os.machine = strdup("pc-0.14"))) {
|
||||
+ virReportOOMError();
|
||||
+ virDomainDefFree(def);
|
||||
+ def = NULL;
|
||||
+ } else {
|
||||
+ VIR_WARN("Replacing deprecated 'fedora-13' machine type "
|
||||
+ "with equivalent 'pc-0.14' in domain %s xml", def->name);
|
||||
+ }
|
||||
+ }
|
||||
+ return def;
|
||||
}
|
||||
|
||||
virDomainDefPtr virDomainDefParseFile(virCapsPtr caps,
|
||||
@@ -11737,8 +11755,30 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
virBufferAddLit(buf, " <type");
|
||||
if (def->os.arch)
|
||||
virBufferAsprintf(buf, " arch='%s'", def->os.arch);
|
||||
- if (def->os.machine)
|
||||
- virBufferAsprintf(buf, " machine='%s'", def->os.machine);
|
||||
+ if (def->os.machine) {
|
||||
+ /* Fedora-specific HACK - replace "fedora-13" with "pc-0.14"
|
||||
+ * (in the original DomainDef as well as in the xml output).
|
||||
+ * This will catch XML being written to save/migration images
|
||||
+ * of domains that were running when libvirtd was restarted at
|
||||
+ * the time of upgrade.
|
||||
+ */
|
||||
+ if (STREQ_NULLABLE(def->os.machine, "fedora-13")) {
|
||||
+ virBufferAddLit(buf, " machine='pc-0.14'");
|
||||
+ VIR_WARN("substituting machine type 'fedora-13' with 'pc-0.14' "
|
||||
+ "in domain %s", def->name);
|
||||
+ /* It's not exactly nice to modify the source object,
|
||||
+ * but sometimes virDomainFormat is called > 100 times for the
|
||||
+ * same object, which would result in far too many warning logs.
|
||||
+ */
|
||||
+ VIR_FREE(def->os.machine);
|
||||
+ if (!(def->os.machine = strdup("pc-0.14"))) {
|
||||
+ virReportOOMError();
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ } else {
|
||||
+ virBufferAsprintf(buf, " machine='%s'", def->os.machine);
|
||||
+ }
|
||||
+ }
|
||||
/*
|
||||
* HACK: For xen driver we previously used bogus 'linux' as the
|
||||
* os type for paravirt, whereas capabilities declare it to
|
||||
@@ -12149,6 +12189,22 @@ static virDomainObjPtr virDomainLoadConfig(virCapsPtr caps,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto error;
|
||||
|
||||
+ /* Fedora-specific HACK - replace "fedora-13" with "pc-0.14".
|
||||
+ * This updates all config files at the first restart of libvirt
|
||||
+ * after upgrade.
|
||||
+ */
|
||||
+ if (STREQ_NULLABLE(def->os.machine, "fedora-13")) {
|
||||
+ VIR_FREE(def->os.machine);
|
||||
+ if (!(def->os.machine = strdup("pc-0.14"))) {
|
||||
+ virReportOOMError();
|
||||
+ goto error;
|
||||
+ }
|
||||
+ VIR_WARN("Replacing deprecated 'fedora-13' machine type "
|
||||
+ "with equivalent 'pc-0.14' in domain %s configuration file", name);
|
||||
+ if (virDomainSaveConfig(configDir, def) < 0)
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
if ((autostartLink = virDomainConfigFile(autostartDir, name)) == NULL)
|
||||
goto error;
|
||||
|
||||
--
|
||||
1.7.7.6
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
commit b8012ce9312f00947c5ca7250a7a96534c85835f
|
||||
Author: David Weber <wb@munzinger.de>
|
||||
Date: Mon May 14 09:53:02 2012 +0000
|
||||
|
||||
sanlock: fix locking for readonly devices
|
||||
|
||||
Add ignore param for readonly and shared disk in sanlock
|
||||
|
||||
diff --git a/src/locking/libvirt_sanlock.aug b/src/locking/libvirt_sanlock.aug
|
||||
index 5f5f8a1..d65b002 100644
|
||||
--- a/src/locking/libvirt_sanlock.aug
|
||||
+++ b/src/locking/libvirt_sanlock.aug
|
||||
@@ -21,6 +21,7 @@ module Libvirt_sanlock =
|
||||
| bool_entry "auto_disk_leases"
|
||||
| int_entry "host_id"
|
||||
| bool_entry "require_lease_for_disks"
|
||||
+ | bool_entry "ignore_readonly_and_shared_disks"
|
||||
let comment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
|
||||
let empty = [ label "#empty" . eol ]
|
||||
|
||||
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
|
||||
index d344d6a..146aefd 100644
|
||||
--- a/src/locking/lock_driver_sanlock.c
|
||||
+++ b/src/locking/lock_driver_sanlock.c
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* lock_driver_sanlock.c: A lock driver for Sanlock
|
||||
*
|
||||
- * Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
+ * Copyright (C) 2010-2012 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -65,6 +65,7 @@ struct _virLockManagerSanlockDriver {
|
||||
bool requireLeaseForDisks;
|
||||
int hostID;
|
||||
bool autoDiskLease;
|
||||
+ bool ignoreReadonlyShared;
|
||||
char *autoDiskLeasePath;
|
||||
};
|
||||
|
||||
@@ -114,6 +115,10 @@ static int virLockManagerSanlockLoadConfig(const char *configFile)
|
||||
CHECK_TYPE("auto_disk_leases", VIR_CONF_LONG);
|
||||
if (p) driver->autoDiskLease = p->l;
|
||||
|
||||
+ p = virConfGetValue(conf, "ignore_readonly_and_shared_disks");
|
||||
+ CHECK_TYPE("ignore_readonly_and_shared_disks", VIR_CONF_LONG);
|
||||
+ if (p) driver->ignoreReadonlyShared = p->l;
|
||||
+
|
||||
p = virConfGetValue(conf, "disk_lease_dir");
|
||||
CHECK_TYPE("disk_lease_dir", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
@@ -625,6 +630,12 @@ static int virLockManagerSanlockAddResource(virLockManagerPtr lock,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if ((flags & (VIR_LOCK_MANAGER_RESOURCE_READONLY |
|
||||
+ VIR_LOCK_MANAGER_RESOURCE_SHARED)) &&
|
||||
+ driver->ignoreReadonlyShared) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (flags & VIR_LOCK_MANAGER_RESOURCE_READONLY) {
|
||||
virLockError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Readonly leases are not supported"));
|
||||
diff --git a/src/locking/sanlock.conf b/src/locking/sanlock.conf
|
||||
index efc35ee..19ab2b3 100644
|
||||
--- a/src/locking/sanlock.conf
|
||||
+++ b/src/locking/sanlock.conf
|
||||
@@ -52,3 +52,10 @@
|
||||
# to enabled, otherwise it defaults to disabled.
|
||||
#
|
||||
#require_lease_for_disks = 1
|
||||
+
|
||||
+#
|
||||
+# Enable this flag to have sanlock ignore readonly and shared disks.
|
||||
+# If disabled, then this rejects attempts to share resources until
|
||||
+# sanlock gains support for shared locks.
|
||||
+#
|
||||
+#ignore_readonly_and_shared_disks = 1
|
||||
commit acbd4965c44c4dbc676dfe89aff970052e376073
|
||||
Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Date: Thu Jun 21 15:34:46 2012 +0100
|
||||
|
||||
Add support for shared sanlock leases
|
||||
|
||||
A sanlock lease can be marked as shared (rather
|
||||
than exclusive) using SANLK_RES_SHARED flag. This
|
||||
adds support for that flag and ensures that in auto
|
||||
disk mode, any shared disks use shared leases. This
|
||||
also makes any read-only disks be completely
|
||||
ignored.
|
||||
|
||||
These changes remove the need for the option
|
||||
|
||||
ignore_readonly_and_shared_disks
|
||||
|
||||
so that is removed
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
|
||||
index 146aefd..16941c9 100644
|
||||
--- a/src/locking/lock_driver_sanlock.c
|
||||
+++ b/src/locking/lock_driver_sanlock.c
|
||||
@@ -65,7 +65,6 @@ struct _virLockManagerSanlockDriver {
|
||||
bool requireLeaseForDisks;
|
||||
int hostID;
|
||||
bool autoDiskLease;
|
||||
- bool ignoreReadonlyShared;
|
||||
char *autoDiskLeasePath;
|
||||
};
|
||||
|
||||
@@ -115,10 +114,6 @@ static int virLockManagerSanlockLoadConfig(const char *configFile)
|
||||
CHECK_TYPE("auto_disk_leases", VIR_CONF_LONG);
|
||||
if (p) driver->autoDiskLease = p->l;
|
||||
|
||||
- p = virConfGetValue(conf, "ignore_readonly_and_shared_disks");
|
||||
- CHECK_TYPE("ignore_readonly_and_shared_disks", VIR_CONF_LONG);
|
||||
- if (p) driver->ignoreReadonlyShared = p->l;
|
||||
-
|
||||
p = virConfGetValue(conf, "disk_lease_dir");
|
||||
CHECK_TYPE("disk_lease_dir", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
@@ -428,7 +423,8 @@ static int virLockManagerSanlockDiskLeaseName(const char *path,
|
||||
static int virLockManagerSanlockAddLease(virLockManagerPtr lock,
|
||||
const char *name,
|
||||
size_t nparams,
|
||||
- virLockManagerParamPtr params)
|
||||
+ virLockManagerParamPtr params,
|
||||
+ bool shared)
|
||||
{
|
||||
virLockManagerSanlockPrivatePtr priv = lock->privateData;
|
||||
int ret = -1;
|
||||
@@ -440,6 +436,7 @@ static int virLockManagerSanlockAddLease(virLockManagerPtr lock,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
+ res->flags = shared ? SANLK_RES_SHARED : 0;
|
||||
res->num_disks = 1;
|
||||
if (!virStrcpy(res->name, name, SANLK_NAME_LEN)) {
|
||||
virLockError(VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -485,7 +482,8 @@ cleanup:
|
||||
static int virLockManagerSanlockAddDisk(virLockManagerPtr lock,
|
||||
const char *name,
|
||||
size_t nparams,
|
||||
- virLockManagerParamPtr params ATTRIBUTE_UNUSED)
|
||||
+ virLockManagerParamPtr params ATTRIBUTE_UNUSED,
|
||||
+ bool shared)
|
||||
{
|
||||
virLockManagerSanlockPrivatePtr priv = lock->privateData;
|
||||
int ret = -1;
|
||||
@@ -503,6 +501,7 @@ static int virLockManagerSanlockAddDisk(virLockManagerPtr lock,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
+ res->flags = shared ? SANLK_RES_SHARED : 0;
|
||||
res->num_disks = 1;
|
||||
if (virLockManagerSanlockDiskLeaseName(name, res->name, SANLK_NAME_LEN) < 0)
|
||||
goto cleanup;
|
||||
@@ -630,27 +629,15 @@ static int virLockManagerSanlockAddResource(virLockManagerPtr lock,
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if ((flags & (VIR_LOCK_MANAGER_RESOURCE_READONLY |
|
||||
- VIR_LOCK_MANAGER_RESOURCE_SHARED)) &&
|
||||
- driver->ignoreReadonlyShared) {
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- if (flags & VIR_LOCK_MANAGER_RESOURCE_READONLY) {
|
||||
- virLockError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
- _("Readonly leases are not supported"));
|
||||
- return -1;
|
||||
- }
|
||||
- if (flags & VIR_LOCK_MANAGER_RESOURCE_SHARED) {
|
||||
- virLockError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
- _("Shareable leases are not supported"));
|
||||
- return -1;
|
||||
- }
|
||||
+ /* Treat R/O resources as a no-op lock request */
|
||||
+ if (flags & VIR_LOCK_MANAGER_RESOURCE_READONLY)
|
||||
+ return 0;
|
||||
|
||||
switch (type) {
|
||||
case VIR_LOCK_MANAGER_RESOURCE_TYPE_DISK:
|
||||
if (driver->autoDiskLease) {
|
||||
- if (virLockManagerSanlockAddDisk(lock, name, nparams, params) < 0)
|
||||
+ if (virLockManagerSanlockAddDisk(lock, name, nparams, params,
|
||||
+ !!(flags & VIR_LOCK_MANAGER_RESOURCE_SHARED)) < 0)
|
||||
return -1;
|
||||
|
||||
if (virLockManagerSanlockCreateLease(priv->res_args[priv->res_count-1]) < 0)
|
||||
@@ -664,7 +651,8 @@ static int virLockManagerSanlockAddResource(virLockManagerPtr lock,
|
||||
break;
|
||||
|
||||
case VIR_LOCK_MANAGER_RESOURCE_TYPE_LEASE:
|
||||
- if (virLockManagerSanlockAddLease(lock, name, nparams, params) < 0)
|
||||
+ if (virLockManagerSanlockAddLease(lock, name, nparams, params,
|
||||
+ !!(flags & VIR_LOCK_MANAGER_RESOURCE_SHARED)) < 0)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
diff --git a/src/locking/sanlock.conf b/src/locking/sanlock.conf
|
||||
index 19ab2b3..efc35ee 100644
|
||||
--- a/src/locking/sanlock.conf
|
||||
+++ b/src/locking/sanlock.conf
|
||||
@@ -52,10 +52,3 @@
|
||||
# to enabled, otherwise it defaults to disabled.
|
||||
#
|
||||
#require_lease_for_disks = 1
|
||||
-
|
||||
-#
|
||||
-# Enable this flag to have sanlock ignore readonly and shared disks.
|
||||
-# If disabled, then this rejects attempts to share resources until
|
||||
-# sanlock gains support for shared locks.
|
||||
-#
|
||||
-#ignore_readonly_and_shared_disks = 1
|
||||
+1564
-499
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user