Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e59fd390c | |||
| 66c6e81b12 | |||
| 397698b913 | |||
| 4b8c90d47a | |||
| 21b5b71da6 | |||
| 159aa2a963 | |||
| afd84ddc60 | |||
| ac5ee8c94d | |||
| 1dd1aab12e | |||
| 8461092bcd | |||
| f050abb9f1 | |||
| 5248901265 | |||
| 4ad26eac7d | |||
| 9e06dca287 |
@@ -3,3 +3,6 @@
|
||||
i686
|
||||
x86_64
|
||||
libvirt-*.tar.gz
|
||||
/libvirt-0.8.4.tar.gz
|
||||
/libvirt-0.8.5.tar.gz
|
||||
/libvirt-0.8.7.tar.gz
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Thu, 17 Dec 2015 13:43:58 +0100
|
||||
Subject: [PATCH] schema: interleave domain name and uuid with other elements
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Allow <name> and <uuid> anywhere under <domain>, not just at the top:
|
||||
|
||||
error:XML document failed to validate against schema: Unable to validate
|
||||
doc against /usr/share/libvirt/schemas/domain.rng
|
||||
Expecting an element name, got nothing
|
||||
Invalid sequence in interleave
|
||||
Element domain failed to validate content
|
||||
|
||||
Introduced with the first RelaxNG schema in commit c642103.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1292131
|
||||
(cherry picked from commit b4e0549febe416ffefc16f389423740d6d65fa74)
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
docs/schemas/domaincommon.rng | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index b252a17..48610ce 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -30,8 +30,8 @@
|
||||
<define name="domain">
|
||||
<element name="domain">
|
||||
<ref name="hvs"/>
|
||||
- <ref name="ids"/>
|
||||
<interleave>
|
||||
+ <ref name="ids"/>
|
||||
<optional>
|
||||
<ref name="title"/>
|
||||
</optional>
|
||||
@@ -1,32 +0,0 @@
|
||||
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
||||
Date: Thu, 14 Jan 2016 14:31:17 +0100
|
||||
Subject: [PATCH] leaseshelper: fix crash when no mac is specified
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
If dnsmasq specified DNSMASQ_IAID (so we're dealing with an IPv6
|
||||
lease) but no DNSMASQ_MAC, we skip creation of the new lease object.
|
||||
|
||||
Also skip adding it to the leases array.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1202350
|
||||
(cherry picked from commit df9fe124d650bc438c531673492569da87523d20)
|
||||
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
||||
---
|
||||
src/network/leaseshelper.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
|
||||
index 2d528f7..6930310 100644
|
||||
--- a/src/network/leaseshelper.c
|
||||
+++ b/src/network/leaseshelper.c
|
||||
@@ -439,7 +439,7 @@ main(int argc, char **argv)
|
||||
|
||||
case VIR_LEASE_ACTION_OLD:
|
||||
case VIR_LEASE_ACTION_ADD:
|
||||
- if (virJSONValueArrayAppend(leases_array_new, lease_new) < 0) {
|
||||
+ if (lease_new && virJSONValueArrayAppend(leases_array_new, lease_new) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("failed to create json"));
|
||||
goto cleanup;
|
||||
@@ -1,63 +0,0 @@
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Tue, 19 Jan 2016 22:19:56 -0500
|
||||
Subject: [PATCH] build: predictably generate systemtap tapsets (bz 1173641)
|
||||
|
||||
The generated output is dependent on perl hashtable ordering, which
|
||||
gives different results for i686 and x86_64. Fix this by sorting
|
||||
the hash keys before iterating over them
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1173641
|
||||
(cherry picked from commit a1edb05c6028470aa24b74aa0f8d5fb5a181128a)
|
||||
---
|
||||
src/rpc/gensystemtap.pl | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/rpc/gensystemtap.pl b/src/rpc/gensystemtap.pl
|
||||
index 2467300..7b80fbf 100755
|
||||
--- a/src/rpc/gensystemtap.pl
|
||||
+++ b/src/rpc/gensystemtap.pl
|
||||
@@ -72,7 +72,7 @@ function libvirt_rpc_auth_name(type, verbose)
|
||||
{
|
||||
EOF
|
||||
my $first = 1;
|
||||
-foreach my $type (keys %auth) {
|
||||
+foreach my $type (sort(keys %auth)) {
|
||||
my $cond = $first ? "if" : "} else if";
|
||||
$first = 0;
|
||||
print " $cond (type == ", $type, ") {\n";
|
||||
@@ -95,7 +95,7 @@ function libvirt_rpc_type_name(type, verbose)
|
||||
{
|
||||
EOF
|
||||
$first = 1;
|
||||
-foreach my $type (keys %type) {
|
||||
+foreach my $type (sort(keys %type)) {
|
||||
my $cond = $first ? "if" : "} else if";
|
||||
$first = 0;
|
||||
print " $cond (type == ", $type, ") {\n";
|
||||
@@ -118,7 +118,7 @@ function libvirt_rpc_status_name(status, verbose)
|
||||
{
|
||||
EOF
|
||||
$first = 1;
|
||||
-foreach my $status (keys %status) {
|
||||
+foreach my $status (sort(keys %status)) {
|
||||
my $cond = $first ? "if" : "} else if";
|
||||
$first = 0;
|
||||
print " $cond (status == ", $status, ") {\n";
|
||||
@@ -141,7 +141,7 @@ function libvirt_rpc_program_name(program, verbose)
|
||||
{
|
||||
EOF
|
||||
$first = 1;
|
||||
-foreach my $prog (keys %funcs) {
|
||||
+foreach my $prog (sort(keys %funcs)) {
|
||||
my $cond = $first ? "if" : "} else if";
|
||||
$first = 0;
|
||||
print " $cond (program == ", $funcs{$prog}->{id}, ") {\n";
|
||||
@@ -165,7 +165,7 @@ function libvirt_rpc_procedure_name(program, version, proc, verbose)
|
||||
{
|
||||
EOF
|
||||
$first = 1;
|
||||
-foreach my $prog (keys %funcs) {
|
||||
+foreach my $prog (sort(keys %funcs)) {
|
||||
my $cond = $first ? "if" : "} else if";
|
||||
$first = 0;
|
||||
print " $cond (program == ", $funcs{$prog}->{id}, " && version == ", $funcs{$prog}->{version}, ") {\n";
|
||||
@@ -1,30 +0,0 @@
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Fri, 3 Jul 2015 16:51:56 +0100
|
||||
Subject: [PATCH] rpc: ensure daemon is spawn even if dead socket exists
|
||||
|
||||
The auto-spawn code would originally attempt to spawn the
|
||||
daemon for both ENOENT and ECONNREFUSED errors from connect().
|
||||
The various refactorings eventually lost this so we only
|
||||
spawn the daemon on ENOENT. The result is if the daemon exits
|
||||
uncleanly, so that the socket is left in the filesystem, we
|
||||
will never be able to auto-spawn the daemon again.
|
||||
|
||||
(cherry picked from commit 406ee8c226d2197ba1aaecb9cf3ad2b6df31ae44)
|
||||
---
|
||||
src/rpc/virnetsocket.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
|
||||
index 51f94d4..6153e0e 100644
|
||||
--- a/src/rpc/virnetsocket.c
|
||||
+++ b/src/rpc/virnetsocket.c
|
||||
@@ -610,7 +610,8 @@ int virNetSocketNewConnectUNIX(const char *path,
|
||||
|
||||
while (retries &&
|
||||
connect(fd, &remoteAddr.data.sa, remoteAddr.len) < 0) {
|
||||
- if (!(spawnDaemon && errno == ENOENT)) {
|
||||
+ if (!(spawnDaemon && (errno == ENOENT ||
|
||||
+ errno == ECONNREFUSED))) {
|
||||
virReportSystemError(errno, _("Failed to connect socket to '%s'"),
|
||||
path);
|
||||
goto cleanup;
|
||||
@@ -1,48 +0,0 @@
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Mon, 11 Jan 2016 20:01:24 -0500
|
||||
Subject: [PATCH] rpc: socket: Minor cleanups
|
||||
|
||||
- Add some debugging
|
||||
- Make the loop dependent only on retries
|
||||
- Make it explicit that connect(2) success exits the loop
|
||||
- Invert the error checking logic
|
||||
|
||||
(cherry picked from commit f102c7146ed7f6e04af0ad3bce302476239f2502)
|
||||
---
|
||||
src/rpc/virnetsocket.c | 16 ++++++++++++----
|
||||
1 file changed, 12 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
|
||||
index 6153e0e..dcff69e 100644
|
||||
--- a/src/rpc/virnetsocket.c
|
||||
+++ b/src/rpc/virnetsocket.c
|
||||
@@ -548,6 +548,9 @@ int virNetSocketNewConnectUNIX(const char *path,
|
||||
char *rundir = NULL;
|
||||
int ret = -1;
|
||||
|
||||
+ VIR_DEBUG("path=%s spawnDaemon=%d binary=%s", path, spawnDaemon,
|
||||
+ NULLSTR(binary));
|
||||
+
|
||||
memset(&localAddr, 0, sizeof(localAddr));
|
||||
memset(&remoteAddr, 0, sizeof(remoteAddr));
|
||||
|
||||
@@ -608,10 +611,15 @@ int virNetSocketNewConnectUNIX(const char *path,
|
||||
if (remoteAddr.data.un.sun_path[0] == '@')
|
||||
remoteAddr.data.un.sun_path[0] = '\0';
|
||||
|
||||
- while (retries &&
|
||||
- connect(fd, &remoteAddr.data.sa, remoteAddr.len) < 0) {
|
||||
- if (!(spawnDaemon && (errno == ENOENT ||
|
||||
- errno == ECONNREFUSED))) {
|
||||
+ while (retries) {
|
||||
+ if (connect(fd, &remoteAddr.data.sa, remoteAddr.len) == 0) {
|
||||
+ VIR_DEBUG("connect() succeeded");
|
||||
+ break;
|
||||
+ }
|
||||
+ VIR_DEBUG("connect() failed: retries=%d errno=%d", retries, errno);
|
||||
+
|
||||
+ if (!spawnDaemon ||
|
||||
+ (errno != ENOENT && errno != ECONNREFUSED)) {
|
||||
virReportSystemError(errno, _("Failed to connect socket to '%s'"),
|
||||
path);
|
||||
goto cleanup;
|
||||
@@ -1,40 +0,0 @@
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Mon, 11 Jan 2016 20:08:45 -0500
|
||||
Subject: [PATCH] rpc: socket: Explicitly error if we exceed retry count
|
||||
|
||||
When we autolaunch libvirtd for session URIs, we spin in a retry
|
||||
loop waiting for the daemon to start and the connect(2) to succeed.
|
||||
|
||||
However if we exceed the retry count, we don't explicitly raise an
|
||||
error, which can yield a slew of different error messages elsewhere
|
||||
in the code.
|
||||
|
||||
Explicitly raise the last connect(2) failure if we run out of retries.
|
||||
|
||||
(cherry picked from commit 8da02d528068942303923fc4f935e77cccac9c7c)
|
||||
---
|
||||
src/rpc/virnetsocket.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
|
||||
index dcff69e..90951be 100644
|
||||
--- a/src/rpc/virnetsocket.c
|
||||
+++ b/src/rpc/virnetsocket.c
|
||||
@@ -618,7 +618,9 @@ int virNetSocketNewConnectUNIX(const char *path,
|
||||
}
|
||||
VIR_DEBUG("connect() failed: retries=%d errno=%d", retries, errno);
|
||||
|
||||
+ retries--;
|
||||
if (!spawnDaemon ||
|
||||
+ retries == 0 ||
|
||||
(errno != ENOENT && errno != ECONNREFUSED)) {
|
||||
virReportSystemError(errno, _("Failed to connect socket to '%s'"),
|
||||
path);
|
||||
@@ -628,7 +630,6 @@ int virNetSocketNewConnectUNIX(const char *path,
|
||||
if (virNetSocketForkDaemon(binary) < 0)
|
||||
goto cleanup;
|
||||
|
||||
- retries--;
|
||||
usleep(5000);
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Mon, 11 Jan 2016 20:13:38 -0500
|
||||
Subject: [PATCH] rpc: socket: Don't repeatedly attempt to launch daemon
|
||||
|
||||
On every socket connect(2) attempt we were re-launching session
|
||||
libvirtd, up to 100 times in 5 seconds.
|
||||
|
||||
This understandably caused some weird load races and intermittent
|
||||
qemu:///session startup failures
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1271183
|
||||
(cherry picked from commit 2eb7a975756d05a5b54ab4acf60083beb6161ac6)
|
||||
---
|
||||
src/rpc/virnetsocket.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
|
||||
index 90951be..2ee4b6e 100644
|
||||
--- a/src/rpc/virnetsocket.c
|
||||
+++ b/src/rpc/virnetsocket.c
|
||||
@@ -547,6 +547,7 @@ int virNetSocketNewConnectUNIX(const char *path,
|
||||
virSocketAddr remoteAddr;
|
||||
char *rundir = NULL;
|
||||
int ret = -1;
|
||||
+ bool daemonLaunched = false;
|
||||
|
||||
VIR_DEBUG("path=%s spawnDaemon=%d binary=%s", path, spawnDaemon,
|
||||
NULLSTR(binary));
|
||||
@@ -627,8 +628,12 @@ int virNetSocketNewConnectUNIX(const char *path,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (virNetSocketForkDaemon(binary) < 0)
|
||||
- goto cleanup;
|
||||
+ if (!daemonLaunched) {
|
||||
+ if (virNetSocketForkDaemon(binary) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ daemonLaunched = true;
|
||||
+ }
|
||||
|
||||
usleep(5000);
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 15 Jan 2016 10:55:58 +0100
|
||||
Subject: [PATCH] security: Do not restore kernel and initrd labels
|
||||
|
||||
Kernel/initrd files are essentially read-only shareable images and thus
|
||||
should be handled in the same way. We already use the appropriate label
|
||||
for kernel/initrd files when starting a domain, but when a domain gets
|
||||
destroyed we would remove the labels which would make other running
|
||||
domains using the same files very unhappy.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=921135
|
||||
|
||||
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 68acc701bd449481e3206723c25b18fcd3d261b7)
|
||||
---
|
||||
src/security/security_dac.c | 8 --------
|
||||
src/security/security_selinux.c | 8 --------
|
||||
2 files changed, 16 deletions(-)
|
||||
|
||||
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
|
||||
index deb6980..d01215f 100644
|
||||
--- a/src/security/security_dac.c
|
||||
+++ b/src/security/security_dac.c
|
||||
@@ -971,14 +971,6 @@ virSecurityDACRestoreSecurityAllLabel(virSecurityManagerPtr mgr,
|
||||
virSecurityDACRestoreSecurityFileLabel(def->os.loader->nvram) < 0)
|
||||
rc = -1;
|
||||
|
||||
- if (def->os.kernel &&
|
||||
- virSecurityDACRestoreSecurityFileLabel(def->os.kernel) < 0)
|
||||
- rc = -1;
|
||||
-
|
||||
- if (def->os.initrd &&
|
||||
- virSecurityDACRestoreSecurityFileLabel(def->os.initrd) < 0)
|
||||
- rc = -1;
|
||||
-
|
||||
if (def->os.dtb &&
|
||||
virSecurityDACRestoreSecurityFileLabel(def->os.dtb) < 0)
|
||||
rc = -1;
|
||||
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
|
||||
index 6e67a86..2475a80 100644
|
||||
--- a/src/security/security_selinux.c
|
||||
+++ b/src/security/security_selinux.c
|
||||
@@ -1953,14 +1953,6 @@ virSecuritySELinuxRestoreSecurityAllLabel(virSecurityManagerPtr mgr,
|
||||
virSecuritySELinuxRestoreSecurityFileLabel(mgr, def->os.loader->nvram) < 0)
|
||||
rc = -1;
|
||||
|
||||
- if (def->os.kernel &&
|
||||
- virSecuritySELinuxRestoreSecurityFileLabel(mgr, def->os.kernel) < 0)
|
||||
- rc = -1;
|
||||
-
|
||||
- if (def->os.initrd &&
|
||||
- virSecuritySELinuxRestoreSecurityFileLabel(mgr, def->os.initrd) < 0)
|
||||
- rc = -1;
|
||||
-
|
||||
if (def->os.dtb &&
|
||||
virSecuritySELinuxRestoreSecurityFileLabel(mgr, def->os.dtb) < 0)
|
||||
rc = -1;
|
||||
@@ -1,37 +0,0 @@
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Tue, 15 Mar 2016 17:04:32 -0400
|
||||
Subject: [PATCH] rpc: wait longer for session daemon to start up
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1271183
|
||||
|
||||
We only wait 0.5 seconds for the session daemon to start up and present
|
||||
its socket, which isn't sufficient for many users. Bump up the sleep
|
||||
interval and retry amount so we wait for a total of 5.0 seconds.
|
||||
|
||||
(cherry picked from commit ca0c06f4008154de55e0b3109885facd0bf02d32)
|
||||
---
|
||||
src/rpc/virnetsocket.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
|
||||
index 2ee4b6e..275f1f5 100644
|
||||
--- a/src/rpc/virnetsocket.c
|
||||
+++ b/src/rpc/virnetsocket.c
|
||||
@@ -542,7 +542,7 @@ int virNetSocketNewConnectUNIX(const char *path,
|
||||
char *lockpath = NULL;
|
||||
int lockfd = -1;
|
||||
int fd = -1;
|
||||
- int retries = 100;
|
||||
+ int retries = 500;
|
||||
virSocketAddr localAddr;
|
||||
virSocketAddr remoteAddr;
|
||||
char *rundir = NULL;
|
||||
@@ -635,7 +635,7 @@ int virNetSocketNewConnectUNIX(const char *path,
|
||||
daemonLaunched = true;
|
||||
}
|
||||
|
||||
- usleep(5000);
|
||||
+ usleep(10000);
|
||||
}
|
||||
|
||||
localAddr.len = sizeof(localAddr.data);
|
||||
@@ -1,27 +0,0 @@
|
||||
From: Jovanka Gulicoska <jovanka.gulicoska@gmail.com>
|
||||
Date: Thu, 17 Mar 2016 20:02:20 +0100
|
||||
Subject: [PATCH] driver: log missing modules as INFO, not WARN
|
||||
|
||||
Missing modules is a common expected scenario for most libvirt usage on
|
||||
RPM distributions like Fedora, so it doesn't really warrant logging at
|
||||
WARN level. Use INFO instead
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1274849
|
||||
(cherry picked from commit 9a0c7f5f834185db9017c34aabc03ad99cf37bed)
|
||||
---
|
||||
src/driver.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/driver.c b/src/driver.c
|
||||
index db03438..f926fe4 100644
|
||||
--- a/src/driver.c
|
||||
+++ b/src/driver.c
|
||||
@@ -62,7 +62,7 @@ virDriverLoadModule(const char *name)
|
||||
return NULL;
|
||||
|
||||
if (access(modfile, R_OK) < 0) {
|
||||
- VIR_WARN("Module %s not accessible", modfile);
|
||||
+ VIR_INFO("Module %s not accessible", modfile);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Tue, 28 Apr 2015 17:38:00 -0400
|
||||
Subject: [PATCH] polkit: Allow password-less access for 'libvirt' group
|
||||
|
||||
Many users, who admin their own machines, want to be able to access
|
||||
system libvirtd via tools like virt-manager without having to enter
|
||||
a root password. Just google 'virt-manager without password' and
|
||||
you'll find many hits. I've read at least 5 blog posts over the years
|
||||
describing slightly different ways of achieving this goal.
|
||||
|
||||
Let's finally add official support for this.
|
||||
|
||||
Install a polkit-1 rules file granting password-less auth for any user
|
||||
in the new 'libvirt' group. Create the group on RPM install
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=957300
|
||||
(cherry picked from commit e94979e901517af9fdde358d7b7c92cc055dd50c)
|
||||
---
|
||||
daemon/Makefile.am | 13 +++++++++++++
|
||||
daemon/libvirt.rules | 9 +++++++++
|
||||
libvirt.spec.in | 15 +++++++++++++--
|
||||
3 files changed, 35 insertions(+), 2 deletions(-)
|
||||
create mode 100644 daemon/libvirt.rules
|
||||
|
||||
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
|
||||
index b95a79d..9c5ea37 100644
|
||||
--- a/daemon/Makefile.am
|
||||
+++ b/daemon/Makefile.am
|
||||
@@ -53,6 +53,7 @@ EXTRA_DIST = \
|
||||
libvirtd.init.in \
|
||||
libvirtd.upstart \
|
||||
libvirtd.policy.in \
|
||||
+ libvirt.rules \
|
||||
libvirtd.sasl \
|
||||
libvirtd.service.in \
|
||||
libvirtd.socket.in \
|
||||
@@ -233,6 +234,8 @@ policyauth = auth_admin_keep_session
|
||||
else ! WITH_POLKIT0
|
||||
policydir = $(datadir)/polkit-1/actions
|
||||
policyauth = auth_admin_keep
|
||||
+rulesdir = $(datadir)/polkit-1/rules.d
|
||||
+rulesfile = libvirt.rules
|
||||
endif ! WITH_POLKIT0
|
||||
endif WITH_POLKIT
|
||||
|
||||
@@ -263,9 +266,19 @@ if WITH_POLKIT
|
||||
install-data-polkit::
|
||||
$(MKDIR_P) $(DESTDIR)$(policydir)
|
||||
$(INSTALL_DATA) libvirtd.policy $(DESTDIR)$(policydir)/org.libvirt.unix.policy
|
||||
+if ! WITH_POLKIT0
|
||||
+ $(MKDIR_P) $(DESTDIR)$(rulesdir)
|
||||
+ $(INSTALL_DATA) $(srcdir)/$(rulesfile) $(DESTDIR)$(rulesdir)/50-libvirt.rules
|
||||
+endif ! WITH_POLKIT0
|
||||
+
|
||||
uninstall-data-polkit::
|
||||
rm -f $(DESTDIR)$(policydir)/org.libvirt.unix.policy
|
||||
rmdir $(DESTDIR)$(policydir) || :
|
||||
+if ! WITH_POLKIT0
|
||||
+ rm -f $(DESTDIR)$(rulesdir)/50-libvirt.rules
|
||||
+ rmdir $(DESTDIR)$(rulesdir) || :
|
||||
+endif ! WITH_POLKIT0
|
||||
+
|
||||
else ! WITH_POLKIT
|
||||
install-data-polkit::
|
||||
uninstall-data-polkit::
|
||||
diff --git a/daemon/libvirt.rules b/daemon/libvirt.rules
|
||||
new file mode 100644
|
||||
index 0000000..01a15fa
|
||||
--- /dev/null
|
||||
+++ b/daemon/libvirt.rules
|
||||
@@ -0,0 +1,9 @@
|
||||
+// Allow any user in the 'libvirt' group to connect to system libvirtd
|
||||
+// without entering a password.
|
||||
+
|
||||
+polkit.addRule(function(action, subject) {
|
||||
+ if (action.id == "org.libvirt.unix.manage" &&
|
||||
+ subject.isInGroup("libvirt")) {
|
||||
+ return polkit.Result.YES;
|
||||
+ }
|
||||
+});
|
||||
diff --git a/libvirt.spec.in b/libvirt.spec.in
|
||||
index dc327a2..a23629d 100644
|
||||
--- a/libvirt.spec.in
|
||||
+++ b/libvirt.spec.in
|
||||
@@ -1631,9 +1631,9 @@ then
|
||||
fi
|
||||
|
||||
%if %{with_libvirtd}
|
||||
+%pre daemon
|
||||
%if ! %{with_driver_modules}
|
||||
%if %{with_qemu}
|
||||
-%pre daemon
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 6
|
||||
# We want soft static allocation of well-known ids, as disk images
|
||||
# are commonly shared across NFS mounts by id rather than name; see
|
||||
@@ -1647,11 +1647,21 @@ if ! getent passwd qemu >/dev/null; then
|
||||
useradd -r -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu
|
||||
fi
|
||||
fi
|
||||
-exit 0
|
||||
%endif
|
||||
%endif
|
||||
%endif
|
||||
|
||||
+ %if %{with_polkit}
|
||||
+ %if 0%{?fedora} || 0%{?rhel} >= 6
|
||||
+# 'libvirt' group is just to allow password-less polkit access to
|
||||
+# libvirtd. The uid number is irrelevant, so we use dynamic allocation
|
||||
+# described at the above link.
|
||||
+getent group libvirt >/dev/null || groupadd -r libvirt
|
||||
+ %endif
|
||||
+ %endif
|
||||
+
|
||||
+exit 0
|
||||
+
|
||||
%post daemon
|
||||
|
||||
%if %{with_systemd}
|
||||
@@ -1925,6 +1935,7 @@ exit 0
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 6
|
||||
%{_datadir}/polkit-1/actions/org.libvirt.unix.policy
|
||||
%{_datadir}/polkit-1/actions/org.libvirt.api.policy
|
||||
+%{_datadir}/polkit-1/rules.d/50-libvirt.rules
|
||||
%else
|
||||
%{_datadir}/PolicyKit/policy/org.libvirt.unix.policy
|
||||
%endif
|
||||
@@ -0,0 +1,184 @@
|
||||
From a9311c363defcba7479fdabfb4862bcf851a6b7c 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)
|
||||
|
||||
Conflicts:
|
||||
|
||||
src/conf/domain_conf.c
|
||||
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 d082697..db5fa9b 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -2308,6 +2308,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 fe81c26..0d6edc8 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -1388,6 +1388,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 9cc1644..963768e 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -4689,6 +4689,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) {
|
||||
@@ -4726,6 +4728,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);
|
||||
+ }
|
||||
+
|
||||
def->data.spice.keymap = virXMLPropString(node, "keymap");
|
||||
|
||||
if (virDomainGraphicsAuthDefParseXML(node, &def->data.spice.auth,
|
||||
@@ -10311,6 +10327,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 d40fda6..f6df0ea 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -921,6 +921,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 366913b..ee192d3 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -4720,6 +4720,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",
|
||||
@@ -4781,6 +4782,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 -hda \
|
||||
/dev/HostVG/QEMUGuest1 -usb -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 5313b3a..29f20ab 100644
|
||||
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
|
||||
@@ -21,7 +21,7 @@
|
||||
</disk>
|
||||
<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,196 @@
|
||||
From b8c86d80df4ba6c682f05974892f5d7ab8f317a9 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 390476d..d082697 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -2317,9 +2317,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 9f8d292..fe81c26 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -1401,6 +1401,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 2f9da71..9cc1644 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -389,7 +389,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 f2cd8eb..d40fda6 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -797,6 +797,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 1dc6a01..d5475c5 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -405,6 +405,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
|
||||
|
||||
diff -rup libvirt-0.9.6.1/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.xml foo/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.xml
|
||||
--- libvirt-0.9.6.1/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.xml 2012-06-15 17:10:09.086979189 -0400
|
||||
+++ foo/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.xml 2012-06-15 17:21:08.788770706 -0400
|
||||
@@ -1,8 +1,8 @@
|
||||
<domain type='qemu'>
|
||||
<name>QEMUGuest1</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
- <memory unit='KiB'>219136</memory>
|
||||
- <currentMemory unit='KiB'>219136</currentMemory>
|
||||
+ <memory>219136</memory>
|
||||
+ <currentMemory>219136</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch='i686' machine='pc'>hvm</type>
|
||||
@@ -0,0 +1,136 @@
|
||||
From 57f08fb47b0938a9e8969b857380926fa6966ca8 Mon Sep 17 00:00:00 2001
|
||||
From: Laine Stump <laine@laine.org>
|
||||
Date: Wed, 14 Mar 2012 01:41:35 -0400
|
||||
Subject: [PATCH] Emit graphics events when a SPICE client
|
||||
connects/disconnects
|
||||
|
||||
Wire up the domain graphics event notifications for SPICE. Adapted
|
||||
from a RHEL-only patch written by Dan Berrange that used custom
|
||||
__com.redhat_SPICE events - equivalent events are now available in
|
||||
upstream QEMU (including a SPICE_CONNECTED event, which was missing in
|
||||
the __COM.redhat_SPICE version).
|
||||
|
||||
* src/qemu/qemu_monitor_json.c: Wire up SPICE graphics events
|
||||
(cherry picked from commit 89ae6a5a30bd91cfb2365544f9dd2e6c2a36ecca)
|
||||
|
||||
Signed-off-by: Cole Robinson <crobinso@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_monitor_json.c | 56 +++++++++++++++++++++++++++++++++++++++---
|
||||
1 files changed, 52 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
||||
index e38c2ed..d4a3b7b 100644
|
||||
--- a/src/qemu/qemu_monitor_json.c
|
||||
+++ b/src/qemu/qemu_monitor_json.c
|
||||
@@ -57,6 +57,9 @@ static void qemuMonitorJSONHandleVNCConnect(qemuMonitorPtr mon, virJSONValuePtr
|
||||
static void qemuMonitorJSONHandleVNCInitialize(qemuMonitorPtr mon, virJSONValuePtr data);
|
||||
static void qemuMonitorJSONHandleVNCDisconnect(qemuMonitorPtr mon, virJSONValuePtr data);
|
||||
static void qemuMonitorJSONHandleBlockJob(qemuMonitorPtr mon, virJSONValuePtr data);
|
||||
+static void qemuMonitorJSONHandleSPICEConnect(qemuMonitorPtr mon, virJSONValuePtr data);
|
||||
+static void qemuMonitorJSONHandleSPICEInitialize(qemuMonitorPtr mon, virJSONValuePtr data);
|
||||
+static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitorPtr mon, virJSONValuePtr data);
|
||||
|
||||
struct {
|
||||
const char *type;
|
||||
@@ -73,6 +76,9 @@ struct {
|
||||
{ "VNC_INITIALIZED", qemuMonitorJSONHandleVNCInitialize, },
|
||||
{ "VNC_DISCONNECTED", qemuMonitorJSONHandleVNCDisconnect, },
|
||||
{ "BLOCK_JOB_COMPLETED", qemuMonitorJSONHandleBlockJob, },
|
||||
+ { "SPICE_CONNECTED", qemuMonitorJSONHandleSPICEConnect, },
|
||||
+ { "SPICE_INITIALIZED", qemuMonitorJSONHandleSPICEInitialize, },
|
||||
+ { "SPICE_DISCONNECTED", qemuMonitorJSONHandleSPICEDisconnect, },
|
||||
};
|
||||
|
||||
|
||||
@@ -617,7 +623,7 @@ VIR_ENUM_DECL(qemuMonitorGraphicsAddressFamily)
|
||||
VIR_ENUM_IMPL(qemuMonitorGraphicsAddressFamily, VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6 + 1,
|
||||
"ipv4", "ipv6");
|
||||
|
||||
-static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, int phase)
|
||||
+static void qemuMonitorJSONHandleGraphics(qemuMonitorPtr mon, virJSONValuePtr data, int phase)
|
||||
{
|
||||
const char *localNode, *localService, *localFamily;
|
||||
const char *remoteNode, *remoteService, *remoteFamily;
|
||||
@@ -636,14 +642,38 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i
|
||||
}
|
||||
|
||||
authScheme = virJSONValueObjectGetString(server, "auth");
|
||||
+ if (!authScheme) {
|
||||
+ VIR_WARN("missing auth scheme in graphics event");
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
localFamily = virJSONValueObjectGetString(server, "family");
|
||||
+ if (!localFamily) {
|
||||
+ VIR_WARN("missing local address family in graphics event");
|
||||
+ return;
|
||||
+ }
|
||||
localNode = virJSONValueObjectGetString(server, "host");
|
||||
+ if (!localNode) {
|
||||
+ VIR_WARN("missing local hostname in graphics event");
|
||||
+ return;
|
||||
+ }
|
||||
localService = virJSONValueObjectGetString(server, "service");
|
||||
+ if (!localService)
|
||||
+ localService = ""; /* Spice has multiple ports, so this isn't provided */
|
||||
|
||||
remoteFamily = virJSONValueObjectGetString(client, "family");
|
||||
+ if (!remoteFamily) {
|
||||
+ VIR_WARN("missing remote address family in graphics event");
|
||||
+ return;
|
||||
+ }
|
||||
remoteNode = virJSONValueObjectGetString(client, "host");
|
||||
+ if (!remoteNode) {
|
||||
+ VIR_WARN("missing remote hostname in graphics event");
|
||||
+ return;
|
||||
+ }
|
||||
remoteService = virJSONValueObjectGetString(client, "service");
|
||||
+ if (!remoteService)
|
||||
+ remoteService = ""; /* Spice has multiple ports, so this isn't provided */
|
||||
|
||||
saslUsername = virJSONValueObjectGetString(client, "sasl_username");
|
||||
x509dname = virJSONValueObjectGetString(client, "x509_dname");
|
||||
@@ -665,19 +695,37 @@ static void qemuMonitorJSONHandleVNC(qemuMonitorPtr mon, virJSONValuePtr data, i
|
||||
|
||||
static void qemuMonitorJSONHandleVNCConnect(qemuMonitorPtr mon, virJSONValuePtr data)
|
||||
{
|
||||
- qemuMonitorJSONHandleVNC(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_CONNECT);
|
||||
+ qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_CONNECT);
|
||||
}
|
||||
|
||||
|
||||
static void qemuMonitorJSONHandleVNCInitialize(qemuMonitorPtr mon, virJSONValuePtr data)
|
||||
{
|
||||
- qemuMonitorJSONHandleVNC(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE);
|
||||
+ qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE);
|
||||
}
|
||||
|
||||
|
||||
static void qemuMonitorJSONHandleVNCDisconnect(qemuMonitorPtr mon, virJSONValuePtr data)
|
||||
{
|
||||
- qemuMonitorJSONHandleVNC(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT);
|
||||
+ qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void qemuMonitorJSONHandleSPICEConnect(qemuMonitorPtr mon, virJSONValuePtr data)
|
||||
+{
|
||||
+ qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_CONNECT);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void qemuMonitorJSONHandleSPICEInitialize(qemuMonitorPtr mon, virJSONValuePtr data)
|
||||
+{
|
||||
+ qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void qemuMonitorJSONHandleSPICEDisconnect(qemuMonitorPtr mon, virJSONValuePtr data)
|
||||
+{
|
||||
+ qemuMonitorJSONHandleGraphics(mon, data, VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT);
|
||||
}
|
||||
|
||||
static void qemuMonitorJSONHandleBlockJob(qemuMonitorPtr mon, virJSONValuePtr data)
|
||||
--
|
||||
1.7.7.6
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
From eaf056bf995558ecf6620ce031287f3aa81b66de Mon Sep 17 00:00:00 2001
|
||||
From: Laine Stump <laine@laine.org>
|
||||
Date: Tue, 6 Dec 2011 12:47:28 -0500
|
||||
Subject: [PATCH 1/2] 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 318f523..7906bb8 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -7500,7 +7500,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,
|
||||
@@ -10648,8 +10666,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
|
||||
@@ -11100,6 +11140,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.4
|
||||
|
||||
+580
-2105
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user