add upstream patches to fix bugs in new rpc code
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=136
This commit is contained in:
parent
f162911599
commit
775756fc1a
52
00d3c5a6-remove-dead-code.patch
Normal file
52
00d3c5a6-remove-dead-code.patch
Normal file
@ -0,0 +1,52 @@
|
||||
commit 00d3c5a6032e69a3c853380ca2d8b0764d15e306
|
||||
Author: Jim Fehlig <jfehlig@novell.com>
|
||||
Date: Mon Jul 11 14:38:03 2011 -0600
|
||||
|
||||
Remove code no longer used after commit df0b57a9
|
||||
|
||||
Index: libvirt-0.9.3/daemon/libvirtd.h
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/daemon/libvirtd.h
|
||||
+++ libvirt-0.9.3/daemon/libvirtd.h
|
||||
@@ -27,10 +27,6 @@
|
||||
|
||||
# include <config.h>
|
||||
|
||||
-# if HAVE_POLKIT0
|
||||
-# include <dbus/dbus.h>
|
||||
-# endif
|
||||
-
|
||||
# include <rpc/types.h>
|
||||
# include <rpc/xdr.h>
|
||||
# include "remote_protocol.h"
|
||||
@@ -85,30 +81,4 @@ extern virNetSASLContextPtr saslCtxt;
|
||||
extern virNetServerProgramPtr remoteProgram;
|
||||
extern virNetServerProgramPtr qemuProgram;
|
||||
|
||||
-/* Main server state */
|
||||
-struct qemud_server {
|
||||
- int privileged;
|
||||
-
|
||||
- int sigread;
|
||||
- int sigwrite;
|
||||
- char *logDir;
|
||||
- pthread_t eventThread;
|
||||
- unsigned int hasEventThread :1;
|
||||
- unsigned int quitEventThread :1;
|
||||
-# ifdef HAVE_AVAHI
|
||||
- struct libvirtd_mdns *mdns;
|
||||
-# endif
|
||||
-# if HAVE_SASL
|
||||
- char **saslUsernameWhitelist;
|
||||
-# endif
|
||||
-# if HAVE_POLKIT0
|
||||
- DBusConnection *sysbus;
|
||||
-# endif
|
||||
-};
|
||||
-
|
||||
-
|
||||
-# if HAVE_POLKIT
|
||||
-int qemudGetSocketIdentity(int fd, uid_t *uid, pid_t *pid);
|
||||
-# endif
|
||||
-
|
||||
#endif
|
44
2c85644b-rpc-3.patch
Normal file
44
2c85644b-rpc-3.patch
Normal file
@ -0,0 +1,44 @@
|
||||
commit 2c85644b0b51fbe5b6244e6773531af29933a727
|
||||
Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Date: Fri Jul 8 12:37:22 2011 +0100
|
||||
|
||||
Fix release of outgoing stream confirmation/abort message
|
||||
|
||||
When sending back the final OK or ERROR message on completion
|
||||
of a stream, we were not decrementing the 'nrequests' tracker
|
||||
on the client. With the default requests limit of '5', this
|
||||
meant once a client had created 5 streams, they are unable to
|
||||
process any further RPC calls. There was also a bug when
|
||||
handling an error from decoding a message length header, which
|
||||
meant a client connection would not immediately be closed.
|
||||
|
||||
* src/rpc/virnetserverclient.c: Fix release of request after
|
||||
stream completion & mark client for close on error
|
||||
|
||||
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
|
||||
index 30d7fcb..6aeb3a4 100644
|
||||
--- a/src/rpc/virnetserverclient.c
|
||||
+++ b/src/rpc/virnetserverclient.c
|
||||
@@ -700,8 +700,10 @@ readmore:
|
||||
|
||||
/* Either done with length word header */
|
||||
if (client->rx->bufferLength == VIR_NET_MESSAGE_LEN_MAX) {
|
||||
- if (virNetMessageDecodeLength(client->rx) < 0)
|
||||
+ if (virNetMessageDecodeLength(client->rx) < 0) {
|
||||
+ client->wantClose = true;
|
||||
return;
|
||||
+ }
|
||||
|
||||
virNetServerClientUpdateEvent(client);
|
||||
|
||||
@@ -831,7 +833,9 @@ virNetServerClientDispatchWrite(virNetServerClientPtr client)
|
||||
/* Get finished msg from head of tx queue */
|
||||
msg = virNetMessageQueueServe(&client->tx);
|
||||
|
||||
- if (msg->header.type == VIR_NET_REPLY) {
|
||||
+ if (msg->header.type == VIR_NET_REPLY ||
|
||||
+ (msg->header.type == VIR_NET_STREAM &&
|
||||
+ msg->header.status != VIR_NET_CONTINUE)) {
|
||||
client->nrequests--;
|
||||
/* See if the recv queue is currently throttled */
|
||||
if (!client->rx &&
|
125
3cfdc57b-rpc-5.patch
Normal file
125
3cfdc57b-rpc-5.patch
Normal file
@ -0,0 +1,125 @@
|
||||
commit 3cfdc57b8553cae95b8849bbcb7a4b227085cec1
|
||||
Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Date: Fri Jul 8 12:54:29 2011 +0100
|
||||
|
||||
Fix sending of reply to final RPC message
|
||||
|
||||
The dispatch for the CLOSE RPC call was invoking the method
|
||||
virNetServerClientClose(). This caused the client connection
|
||||
to be immediately terminated. This meant the reply to the
|
||||
final RPC message was never sent. Prior to the RPC rewrite
|
||||
we merely flagged the connection for closing, and actually
|
||||
closed it when the next RPC call dispatch had completed.
|
||||
|
||||
* daemon/remote.c: Flag connection for a delayed close
|
||||
* daemon/stream.c: Update to use new API for closing
|
||||
failed connection
|
||||
* src/rpc/virnetserverclient.c, src/rpc/virnetserverclient.h:
|
||||
Add support for a delayed connection close. Rename the
|
||||
virNetServerClientMarkClose method to virNetServerClientImmediateClose
|
||||
to clarify its semantics
|
||||
|
||||
diff --git a/daemon/remote.c b/daemon/remote.c
|
||||
index 2889908..a2e79ef 100644
|
||||
--- a/daemon/remote.c
|
||||
+++ b/daemon/remote.c
|
||||
@@ -483,11 +483,11 @@ cleanup:
|
||||
|
||||
static int
|
||||
remoteDispatchClose(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
- virNetServerClientPtr client,
|
||||
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||
virNetMessageHeaderPtr hdr ATTRIBUTE_UNUSED,
|
||||
virNetMessageErrorPtr rerr ATTRIBUTE_UNUSED)
|
||||
{
|
||||
- virNetServerClientClose(client);
|
||||
+ virNetServerClientDelayedClose(client);
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/daemon/stream.c b/daemon/stream.c
|
||||
index 28f6c32..4a8f1ee 100644
|
||||
--- a/daemon/stream.c
|
||||
+++ b/daemon/stream.c
|
||||
@@ -338,7 +338,7 @@ int daemonFreeClientStream(virNetServerClientPtr client,
|
||||
memset(msg, 0, sizeof(*msg));
|
||||
msg->header.type = VIR_NET_REPLY;
|
||||
if (virNetServerClientSendMessage(client, msg) < 0) {
|
||||
- virNetServerClientMarkClose(client);
|
||||
+ virNetServerClientImmediateClose(client);
|
||||
virNetMessageFree(msg);
|
||||
ret = -1;
|
||||
}
|
||||
@@ -608,7 +608,7 @@ daemonStreamHandleWrite(virNetServerClientPtr client,
|
||||
virNetMessageQueueServe(&stream->rx);
|
||||
if (ret < 0) {
|
||||
virNetMessageFree(msg);
|
||||
- virNetServerClientMarkClose(client);
|
||||
+ virNetServerClientImmediateClose(client);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -623,7 +623,7 @@ daemonStreamHandleWrite(virNetServerClientPtr client,
|
||||
msg->header.type = VIR_NET_REPLY;
|
||||
if (virNetServerClientSendMessage(client, msg) < 0) {
|
||||
virNetMessageFree(msg);
|
||||
- virNetServerClientMarkClose(client);
|
||||
+ virNetServerClientImmediateClose(client);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
|
||||
index 6aeb3a4..742c3a4 100644
|
||||
--- a/src/rpc/virnetserverclient.c
|
||||
+++ b/src/rpc/virnetserverclient.c
|
||||
@@ -61,6 +61,7 @@ struct _virNetServerClient
|
||||
{
|
||||
int refs;
|
||||
bool wantClose;
|
||||
+ bool delayedClose;
|
||||
virMutex lock;
|
||||
virNetSocketPtr sock;
|
||||
int auth;
|
||||
@@ -587,7 +588,14 @@ bool virNetServerClientIsClosed(virNetServerClientPtr client)
|
||||
return closed;
|
||||
}
|
||||
|
||||
-void virNetServerClientMarkClose(virNetServerClientPtr client)
|
||||
+void virNetServerClientDelayedClose(virNetServerClientPtr client)
|
||||
+{
|
||||
+ virNetServerClientLock(client);
|
||||
+ client->delayedClose = true;
|
||||
+ virNetServerClientUnlock(client);
|
||||
+}
|
||||
+
|
||||
+void virNetServerClientImmediateClose(virNetServerClientPtr client)
|
||||
{
|
||||
virNetServerClientLock(client);
|
||||
client->wantClose = true;
|
||||
@@ -852,6 +860,9 @@ virNetServerClientDispatchWrite(virNetServerClientPtr client)
|
||||
virNetMessageFree(msg);
|
||||
|
||||
virNetServerClientUpdateEvent(client);
|
||||
+
|
||||
+ if (client->delayedClose)
|
||||
+ client->wantClose = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/rpc/virnetserverclient.h b/src/rpc/virnetserverclient.h
|
||||
index 66510c3..3d2e1fb 100644
|
||||
--- a/src/rpc/virnetserverclient.h
|
||||
+++ b/src/rpc/virnetserverclient.h
|
||||
@@ -86,9 +86,10 @@ void virNetServerClientSetDispatcher(virNetServerClientPtr client,
|
||||
virNetServerClientDispatchFunc func,
|
||||
void *opaque);
|
||||
void virNetServerClientClose(virNetServerClientPtr client);
|
||||
-
|
||||
bool virNetServerClientIsClosed(virNetServerClientPtr client);
|
||||
-void virNetServerClientMarkClose(virNetServerClientPtr client);
|
||||
+
|
||||
+void virNetServerClientDelayedClose(virNetServerClientPtr client);
|
||||
+void virNetServerClientImmediateClose(virNetServerClientPtr client);
|
||||
bool virNetServerClientWantClose(virNetServerClientPtr client);
|
||||
|
||||
int virNetServerClientInit(virNetServerClientPtr client);
|
48
3e5d48ef-rpc-1.patch
Normal file
48
3e5d48ef-rpc-1.patch
Normal file
@ -0,0 +1,48 @@
|
||||
commit 3e5d48ef33224a915bb2afd7933fbec3c2b232ba
|
||||
Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Date: Fri Jul 8 12:33:52 2011 +0100
|
||||
|
||||
Fix potential crash in libvirtd with active streams
|
||||
|
||||
If a client disconnects while it has a stream active, there is
|
||||
a race condition which could see libvirtd crash. This is because
|
||||
the client struct may be freed before the last stream event has
|
||||
triggered. This is trivially solved by holding an extra reference
|
||||
on the client for the stream callbak
|
||||
|
||||
* daemon/stream.c: Acquire reference on client when adding the
|
||||
stream callback
|
||||
|
||||
diff --git a/daemon/stream.c b/daemon/stream.c
|
||||
index 56d79c2..28f6c32 100644
|
||||
--- a/daemon/stream.c
|
||||
+++ b/daemon/stream.c
|
||||
@@ -104,6 +104,15 @@ daemonStreamMessageFinished(virNetMessagePtr msg,
|
||||
daemonStreamUpdateEvents(stream);
|
||||
}
|
||||
|
||||
+
|
||||
+static void
|
||||
+daemonStreamEventFreeFunc(void *opaque)
|
||||
+{
|
||||
+ virNetServerClientPtr client = opaque;
|
||||
+
|
||||
+ virNetServerClientFree(client);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Callback that gets invoked when a stream becomes writable/readable
|
||||
*/
|
||||
@@ -361,9 +370,11 @@ int daemonAddClientStream(virNetServerClientPtr client,
|
||||
}
|
||||
|
||||
if (virStreamEventAddCallback(stream->st, 0,
|
||||
- daemonStreamEvent, client, NULL) < 0)
|
||||
+ daemonStreamEvent, client,
|
||||
+ daemonStreamEventFreeFunc) < 0)
|
||||
return -1;
|
||||
|
||||
+ virNetServerClientRef(client);
|
||||
if ((stream->filterID = virNetServerClientAddFilter(client,
|
||||
daemonStreamFilter,
|
||||
stream)) < 0) {
|
141
41828514-skip-xen-tests.patch
Normal file
141
41828514-skip-xen-tests.patch
Normal file
@ -0,0 +1,141 @@
|
||||
commit 41828514bb91953e9a47453d5d4e667ccfd74b71
|
||||
Author: Jim Fehlig <jfehlig@novell.com>
|
||||
Date: Thu Jul 7 15:53:41 2011 -0600
|
||||
|
||||
Skip some xen tests if xend is not running
|
||||
|
||||
Currently, the xen statstest and reconnect tests are only compiled
|
||||
if xend is running. Compile them unconditionally if xen headers
|
||||
are present, but skip the tests at runtime if xend is not running.
|
||||
|
||||
This is in response to Eric's suggestion here
|
||||
|
||||
https://www.redhat.com/archives/libvir-list/2011-July/msg00367.html
|
||||
|
||||
Index: libvirt-0.9.3/configure.ac
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/configure.ac
|
||||
+++ libvirt-0.9.3/configure.ac
|
||||
@@ -1982,30 +1982,6 @@ AM_CONDITIONAL([WITH_PYTHON], [test "$wi
|
||||
AC_SUBST([PYTHON_VERSION])
|
||||
AC_SUBST([PYTHON_INCLUDES])
|
||||
|
||||
-
|
||||
-
|
||||
-AC_MSG_CHECKING([whether this host is running a Xen kernel])
|
||||
-RUNNING_XEN=
|
||||
-if test -d /proc/sys/xen
|
||||
-then
|
||||
- RUNNING_XEN=yes
|
||||
-else
|
||||
- RUNNING_XEN=no
|
||||
-fi
|
||||
-AC_MSG_RESULT($RUNNING_XEN)
|
||||
-
|
||||
-AC_MSG_CHECKING([If XenD UNIX socket /var/run/xend/xmlrpc.sock is accessible])
|
||||
-RUNNING_XEND=
|
||||
-if test -S /var/run/xend/xmlrpc.sock
|
||||
-then
|
||||
- RUNNING_XEND=yes
|
||||
-else
|
||||
- RUNNING_XEND=no
|
||||
-fi
|
||||
-AC_MSG_RESULT($RUNNING_XEND)
|
||||
-
|
||||
-AM_CONDITIONAL([ENABLE_XEN_TESTS], [test "$RUNNING_XEN" != "no" && test "$RUNNING_XEND" != "no"])
|
||||
-
|
||||
AC_ARG_ENABLE([test-coverage],
|
||||
AC_HELP_STRING([--enable-test-coverage], [turn on code coverage instrumentation @<:@default=no@:>@]),
|
||||
[case "${enableval}" in
|
||||
Index: libvirt-0.9.3/tests/Makefile.am
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/tests/Makefile.am
|
||||
+++ libvirt-0.9.3/tests/Makefile.am
|
||||
@@ -93,10 +93,7 @@ ssh_LDADD = $(COVERAGE_LDFLAGS)
|
||||
|
||||
if WITH_XEN
|
||||
check_PROGRAMS += xml2sexprtest sexpr2xmltest \
|
||||
- xmconfigtest xencapstest
|
||||
-if ENABLE_XEN_TESTS
|
||||
-check_PROGRAMS += statstest reconnect
|
||||
-endif
|
||||
+ xmconfigtest xencapstest statstest reconnect
|
||||
endif
|
||||
if WITH_QEMU
|
||||
check_PROGRAMS += qemuxml2argvtest qemuxml2xmltest qemuargv2xmltest qemuhelptest
|
||||
@@ -214,10 +211,9 @@ if WITH_XEN
|
||||
TESTS += xml2sexprtest \
|
||||
sexpr2xmltest \
|
||||
xmconfigtest \
|
||||
- xencapstest
|
||||
-if ENABLE_XEN_TESTS
|
||||
-TESTS += reconnect statstest
|
||||
-endif
|
||||
+ xencapstest \
|
||||
+ reconnect \
|
||||
+ statstest
|
||||
endif
|
||||
|
||||
if WITH_QEMU
|
||||
Index: libvirt-0.9.3/tests/reconnect.c
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/tests/reconnect.c
|
||||
+++ libvirt-0.9.3/tests/reconnect.c
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "internal.h"
|
||||
+#include "testutils.h"
|
||||
+#include "command.h"
|
||||
|
||||
static void errorHandler(void *userData ATTRIBUTE_UNUSED,
|
||||
virErrorPtr error ATTRIBUTE_UNUSED) {
|
||||
@@ -14,6 +16,16 @@ int main(void) {
|
||||
int ro = 0;
|
||||
virConnectPtr conn;
|
||||
virDomainPtr dom;
|
||||
+ int status;
|
||||
+ virCommandPtr cmd;
|
||||
+
|
||||
+ /* skip test if xend is not running */
|
||||
+ cmd = virCommandNewArgList("/usr/sbin/xend", "status", NULL);
|
||||
+ if (virCommandRun(cmd, &status) != 0 || status != 0) {
|
||||
+ virCommandFree(cmd);
|
||||
+ return EXIT_AM_SKIP;
|
||||
+ }
|
||||
+ virCommandFree(cmd);
|
||||
|
||||
virSetErrorFunc(NULL, errorHandler);
|
||||
|
||||
Index: libvirt-0.9.3/tests/statstest.c
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/tests/statstest.c
|
||||
+++ libvirt-0.9.3/tests/statstest.c
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "internal.h"
|
||||
#include "xen/block_stats.h"
|
||||
#include "testutils.h"
|
||||
+#include "command.h"
|
||||
|
||||
static void testQuietError(void *userData ATTRIBUTE_UNUSED,
|
||||
virErrorPtr error ATTRIBUTE_UNUSED)
|
||||
@@ -44,7 +45,18 @@ static int
|
||||
mymain(void)
|
||||
{
|
||||
int ret = 0;
|
||||
- /* Some of our tests delibrately test failure cases, so
|
||||
+ int status;
|
||||
+ virCommandPtr cmd;
|
||||
+
|
||||
+ /* skip test if xend is not running */
|
||||
+ cmd = virCommandNewArgList("/usr/sbin/xend", "status", NULL);
|
||||
+ if (virCommandRun(cmd, &status) != 0 || status != 0) {
|
||||
+ virCommandFree(cmd);
|
||||
+ return EXIT_AM_SKIP;
|
||||
+ }
|
||||
+ virCommandFree(cmd);
|
||||
+
|
||||
+ /* Some of our tests deliberately test failure cases, so
|
||||
* register a handler to stop error messages cluttering
|
||||
* up display
|
||||
*/
|
115
7518ad75-remote-mem-leak.patch
Normal file
115
7518ad75-remote-mem-leak.patch
Normal file
@ -0,0 +1,115 @@
|
||||
commit 7518ad753fbad5ab0991b7bb189a69db0975c6e8
|
||||
Author: Alex Jia <ajia@redhat.com>
|
||||
Date: Mon Jul 11 13:14:45 2011 +0800
|
||||
|
||||
remote: Fix memory leak
|
||||
|
||||
Detected in valgrind run:
|
||||
|
||||
==9184== 1 bytes in 1 blocks are definitely lost in loss record 1 of 19
|
||||
==9184== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
|
||||
==9184== by 0x3073715F78: xdr_array (xdr_array.c:97)
|
||||
==9184== by 0x4CF97C9: xdr_remote_domain_get_security_label_ret (remote_protocol.c:1696)
|
||||
==9184== by 0x4D08741: virNetMessageDecodePayload (virnetmessage.c:286)
|
||||
==9184== by 0x4D00F78: virNetClientProgramCall (virnetclientprogram.c:318)
|
||||
==9184== by 0x4CE3887: call (remote_driver.c:3933)
|
||||
==9184== by 0x4CF71C6: remoteDomainGetSecurityLabel (remote_driver.c:1580)
|
||||
==9184== by 0x4CCA480: virDomainGetSecurityLabel (libvirt.c:7340)
|
||||
==9184== by 0x41993A: cmdDominfo (virsh.c:2414)
|
||||
==9184== by 0x411E92: vshCommandRun (virsh.c:12730)
|
||||
==9184== by 0x4211ED: main (virsh.c:14076)
|
||||
==9184==
|
||||
==9184== 2 bytes in 1 blocks are definitely lost in loss record 2 of 19
|
||||
==9184== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
|
||||
==9184== by 0x3073715F78: xdr_array (xdr_array.c:97)
|
||||
==9184== by 0x4CF974F: xdr_remote_node_get_security_model_ret (remote_protocol.c:1713)
|
||||
==9184== by 0x4D08741: virNetMessageDecodePayload (virnetmessage.c:286)
|
||||
==9184== by 0x4D00F78: virNetClientProgramCall (virnetclientprogram.c:318)
|
||||
==9184== by 0x4CE3887: call (remote_driver.c:3933)
|
||||
==9184== by 0x4CF6F96: remoteNodeGetSecurityModel (remote_driver.c:1648)
|
||||
==9184== by 0x4CBF799: virNodeGetSecurityModel (libvirt.c:7382)
|
||||
==9184== by 0x4197D7: cmdDominfo (virsh.c:2394)
|
||||
==9184== by 0x411E92: vshCommandRun (virsh.c:12730)
|
||||
==9184== by 0x4211ED: main (virsh.c:14076)
|
||||
==9184==
|
||||
==9184== 8 bytes in 1 blocks are definitely lost in loss record 3 of 19
|
||||
==9184== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
|
||||
==9184== by 0x3073715F78: xdr_array (xdr_array.c:97)
|
||||
==9184== by 0x4CF9729: xdr_remote_node_get_security_model_ret (remote_protocol.c:1710)
|
||||
==9184== by 0x4D08741: virNetMessageDecodePayload (virnetmessage.c:286)
|
||||
==9184== by 0x4D00F78: virNetClientProgramCall (virnetclientprogram.c:318)
|
||||
==9184== by 0x4CE3887: call (remote_driver.c:3933)
|
||||
==9184== by 0x4CF6F96: remoteNodeGetSecurityModel (remote_driver.c:1648)
|
||||
==9184== by 0x4CBF799: virNodeGetSecurityModel (libvirt.c:7382)
|
||||
==9184== by 0x4197D7: cmdDominfo (virsh.c:2394)
|
||||
==9184== by 0x411E92: vshCommandRun (virsh.c:12730)
|
||||
==9184== by 0x4211ED: main (virsh.c:14076)
|
||||
==9184==
|
||||
==9184== LEAK SUMMARY:
|
||||
==9184== definitely lost: 11 bytes in 3 blocks
|
||||
|
||||
* src/remote/remote_driver.c: Avoid leak on remoteDomainGetSecurityLabel
|
||||
and remoteNodeGetSecurityModel.
|
||||
|
||||
Index: libvirt-0.9.3/AUTHORS
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/AUTHORS
|
||||
+++ libvirt-0.9.3/AUTHORS
|
||||
@@ -180,6 +180,7 @@ Patches have also been contributed by:
|
||||
David S. Wang <dwang2@cisco.com>
|
||||
Ruben Kerkhof <ruben@rubenkerkhof.com>
|
||||
Scott Moser <smoser@ubuntu.com>
|
||||
+ Alex Jia <ajia@redhat.com>
|
||||
|
||||
[....send patches to get your name here....]
|
||||
|
||||
Index: libvirt-0.9.3/src/remote/remote_driver.c
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/src/remote/remote_driver.c
|
||||
+++ libvirt-0.9.3/src/remote/remote_driver.c
|
||||
@@ -1587,7 +1587,7 @@ remoteDomainGetSecurityLabel (virDomainP
|
||||
if (strlen (ret.label.label_val) >= sizeof seclabel->label) {
|
||||
remoteError(VIR_ERR_RPC, _("security label exceeds maximum: %zd"),
|
||||
sizeof seclabel->label - 1);
|
||||
- goto done;
|
||||
+ goto cleanup;
|
||||
}
|
||||
strcpy (seclabel->label, ret.label.label_val);
|
||||
seclabel->enforcing = ret.enforcing;
|
||||
@@ -1595,6 +1595,9 @@ remoteDomainGetSecurityLabel (virDomainP
|
||||
|
||||
rv = 0;
|
||||
|
||||
+cleanup:
|
||||
+ xdr_free((xdrproc_t) xdr_remote_domain_get_security_label_ret, (char *)&ret);
|
||||
+
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
@@ -1655,7 +1658,7 @@ remoteNodeGetSecurityModel (virConnectPt
|
||||
if (strlen (ret.model.model_val) >= sizeof secmodel->model) {
|
||||
remoteError(VIR_ERR_RPC, _("security model exceeds maximum: %zd"),
|
||||
sizeof secmodel->model - 1);
|
||||
- goto done;
|
||||
+ goto cleanup;
|
||||
}
|
||||
strcpy (secmodel->model, ret.model.model_val);
|
||||
}
|
||||
@@ -1664,13 +1667,16 @@ remoteNodeGetSecurityModel (virConnectPt
|
||||
if (strlen (ret.doi.doi_val) >= sizeof secmodel->doi) {
|
||||
remoteError(VIR_ERR_RPC, _("security doi exceeds maximum: %zd"),
|
||||
sizeof secmodel->doi - 1);
|
||||
- goto done;
|
||||
+ goto cleanup;
|
||||
}
|
||||
strcpy (secmodel->doi, ret.doi.doi_val);
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
|
||||
+cleanup:
|
||||
+ xdr_free((xdrproc_t) xdr_remote_node_get_security_model_ret, (char *)&ret);
|
||||
+
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
51
927dfcf6-rpc-2.patch
Normal file
51
927dfcf6-rpc-2.patch
Normal file
@ -0,0 +1,51 @@
|
||||
commit 927dfcf693165f5b08efba0d031d4cc43e6f9c37
|
||||
Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Date: Fri Jul 8 12:35:36 2011 +0100
|
||||
|
||||
Fix leak of 'msg' object in client stream code
|
||||
|
||||
In one exit path we forgot to free the virNetMessage object causing
|
||||
a large memory leak for streams which send a lot of data. Some other
|
||||
paths were calling VIR_FREE directly instead of virNetMessageFree
|
||||
although this was (currently) harmless.
|
||||
|
||||
* src/rpc/virnetclientstream.c: Fix leak of msg object
|
||||
* src/rpc/virnetclientprogram.c: Call virNetMessageFree instead
|
||||
of VIR_FREE
|
||||
|
||||
diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c
|
||||
index 8414ad8..c39520a 100644
|
||||
--- a/src/rpc/virnetclientprogram.c
|
||||
+++ b/src/rpc/virnetclientprogram.c
|
||||
@@ -329,11 +329,11 @@ int virNetClientProgramCall(virNetClientProgramPtr prog,
|
||||
goto error;
|
||||
}
|
||||
|
||||
- VIR_FREE(msg);
|
||||
+ virNetMessageFree(msg);
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
- VIR_FREE(msg);
|
||||
+ virNetMessageFree(msg);
|
||||
return -1;
|
||||
}
|
||||
diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
|
||||
index d5efab1..fe15acd 100644
|
||||
--- a/src/rpc/virnetclientstream.c
|
||||
+++ b/src/rpc/virnetclientstream.c
|
||||
@@ -361,11 +361,12 @@ int virNetClientStreamSendPacket(virNetClientStreamPtr st,
|
||||
if (virNetClientSend(client, msg, wantReply) < 0)
|
||||
goto error;
|
||||
|
||||
+ virNetMessageFree(msg);
|
||||
|
||||
return nbytes;
|
||||
|
||||
error:
|
||||
- VIR_FREE(msg);
|
||||
+ virNetMessageFree(msg);
|
||||
return -1;
|
||||
}
|
||||
|
19
a34e193f-statstest.patch
Normal file
19
a34e193f-statstest.patch
Normal file
@ -0,0 +1,19 @@
|
||||
commit a34e193fb7ac887bb25ac47450bae14dbc829cc8
|
||||
Author: Jim Fehlig <jfehlig@novell.com>
|
||||
Date: Thu Jul 7 10:15:05 2011 -0600
|
||||
|
||||
Fix compilation of statstest.c during make check
|
||||
|
||||
diff --git a/tests/statstest.c b/tests/statstest.c
|
||||
index d18bb0c..c989992 100644
|
||||
--- a/tests/statstest.c
|
||||
+++ b/tests/statstest.c
|
||||
@@ -17,7 +17,7 @@ static void testQuietError(void *userData ATTRIBUTE_UNUSED,
|
||||
|
||||
static int testDevice(const char *path, int expect)
|
||||
{
|
||||
- int actual = xenLinuxDomainDeviceID(NULL, 1, path);
|
||||
+ int actual = xenLinuxDomainDeviceID(1, path);
|
||||
|
||||
if (actual == expect) {
|
||||
return 0;
|
43
afe8839f-rpc-4.patch
Normal file
43
afe8839f-rpc-4.patch
Normal file
@ -0,0 +1,43 @@
|
||||
commit afe8839f011c8c54c429f33ca0e6515fceb4e0fd
|
||||
Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Date: Fri Jul 8 12:41:06 2011 +0100
|
||||
|
||||
Fix leak of remote driver if final 'CLOSE' RPC call fails
|
||||
|
||||
When closing a remote connection we issue a (fairly pointless)
|
||||
'CLOSE' RPC call to the daemon. If this fails we skip all the
|
||||
cleanup of private data, but the virConnectPtr object still
|
||||
gets released as normal. This causes a memory leak. Since the
|
||||
CLOSE RPC call is pretty pointless, just carry on freeing the
|
||||
remote driver if it fails.
|
||||
|
||||
* src/remote/remote_driver.c: Ignore failure to issue CLOSE
|
||||
RPC call
|
||||
|
||||
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
|
||||
index 199d8f8..8dff6a8 100644
|
||||
--- a/src/remote/remote_driver.c
|
||||
+++ b/src/remote/remote_driver.c
|
||||
@@ -824,10 +824,12 @@ get_transport_from_scheme (char *scheme)
|
||||
static int
|
||||
doRemoteClose (virConnectPtr conn, struct private_data *priv)
|
||||
{
|
||||
+ int ret = 0;
|
||||
+
|
||||
if (call (conn, priv, 0, REMOTE_PROC_CLOSE,
|
||||
(xdrproc_t) xdr_void, (char *) NULL,
|
||||
(xdrproc_t) xdr_void, (char *) NULL) == -1)
|
||||
- return -1;
|
||||
+ ret = -1;
|
||||
|
||||
virNetTLSContextFree(priv->tls);
|
||||
priv->tls = NULL;
|
||||
@@ -846,7 +848,7 @@ doRemoteClose (virConnectPtr conn, struct private_data *priv)
|
||||
virDomainEventStateFree(priv->domainEventState);
|
||||
priv->domainEventState = NULL;
|
||||
|
||||
- return 0;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static int
|
22
b2534529-unused-param.patch
Normal file
22
b2534529-unused-param.patch
Normal file
@ -0,0 +1,22 @@
|
||||
commit b25345294201031656d4f0059153bc683182b5e4
|
||||
Author: Matthias Bolte <matthias.bolte@googlemail.com>
|
||||
Date: Tue Jul 12 17:06:16 2011 +0200
|
||||
|
||||
rpc: Fix compile error due to potentially unused parameter
|
||||
|
||||
connectDBus is only used if HAVE_DBUS is set. Therefore mark
|
||||
it as potentially unused.
|
||||
|
||||
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
|
||||
index 94d46f6..66edd11 100644
|
||||
--- a/src/rpc/virnetserver.c
|
||||
+++ b/src/rpc/virnetserver.c
|
||||
@@ -277,7 +277,7 @@ virNetServerPtr virNetServerNew(size_t min_workers,
|
||||
size_t max_workers,
|
||||
size_t max_clients,
|
||||
const char *mdnsGroupName,
|
||||
- bool connectDBus,
|
||||
+ bool connectDBus ATTRIBUTE_UNUSED,
|
||||
virNetServerClientInitHook clientInitHook)
|
||||
{
|
||||
virNetServerPtr srv;
|
319
b8adfcc6-fix-polkit0-build.patch
Normal file
319
b8adfcc6-fix-polkit0-build.patch
Normal file
@ -0,0 +1,319 @@
|
||||
commit b8adfcc60ccf4a2fabcac3692a958d2c063d8336
|
||||
Author: Jim Fehlig <jfehlig@novell.com>
|
||||
Date: Thu Jul 7 15:12:26 2011 -0600
|
||||
|
||||
Fix build when using polkit0
|
||||
|
||||
V2: Remove policy kit references from virNetServer and use DBus APIs
|
||||
directly, if available.
|
||||
|
||||
Index: libvirt-0.9.3/configure.ac
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/configure.ac
|
||||
+++ libvirt-0.9.3/configure.ac
|
||||
@@ -1010,6 +1010,7 @@ AC_ARG_WITH([polkit],
|
||||
[with_polkit=check])
|
||||
|
||||
with_polkit0=no
|
||||
+with_dbus=no
|
||||
with_polkit1=no
|
||||
if test "x$with_polkit" = "xyes" || test "x$with_polkit" = "xcheck"; then
|
||||
dnl Check for new polkit first - just a binary
|
||||
@@ -1038,6 +1039,8 @@ if test "x$with_polkit" = "xyes" || test
|
||||
[use PolicyKit for UNIX socket access checks])
|
||||
AC_DEFINE_UNQUOTED([HAVE_POLKIT0], 1,
|
||||
[use PolicyKit for UNIX socket access checks])
|
||||
+ AC_DEFINE_UNQUOTED([HAVE_DBUS], 1,
|
||||
+ [use DBus for PolicyKit])
|
||||
|
||||
old_CFLAGS=$CFLAGS
|
||||
old_LIBS=$LIBS
|
||||
@@ -1052,11 +1055,13 @@ if test "x$with_polkit" = "xyes" || test
|
||||
AC_DEFINE_UNQUOTED([POLKIT_AUTH],["$POLKIT_AUTH"],[Location of polkit-auth program])
|
||||
fi
|
||||
with_polkit0="yes"
|
||||
+ with_dbus="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_DBUS], [test "x$with_dbus" = "xyes"])
|
||||
AM_CONDITIONAL([HAVE_POLKIT1], [test "x$with_polkit1" = "xyes"])
|
||||
AC_SUBST([POLKIT_CFLAGS])
|
||||
AC_SUBST([POLKIT_LIBS])
|
||||
Index: libvirt-0.9.3/daemon/libvirtd.c
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/daemon/libvirtd.c
|
||||
+++ libvirt-0.9.3/daemon/libvirtd.c
|
||||
@@ -576,26 +576,6 @@ static int daemonSetupNetworking(virNetS
|
||||
}
|
||||
#endif
|
||||
|
||||
-#if HAVE_POLKIT0
|
||||
- if (auth_unix_rw == REMOTE_AUTH_POLKIT ||
|
||||
- auth_unix_ro == REMOTE_AUTH_POLKIT) {
|
||||
- DBusError derr;
|
||||
-
|
||||
- dbus_connection_set_change_sigpipe(FALSE);
|
||||
- dbus_threads_init_default();
|
||||
-
|
||||
- dbus_error_init(&derr);
|
||||
- server->sysbus = dbus_bus_get(DBUS_BUS_SYSTEM, &derr);
|
||||
- if (!(server->sysbus)) {
|
||||
- VIR_ERROR(_("Failed to connect to system bus for PolicyKit auth: %s"),
|
||||
- derr.message);
|
||||
- dbus_error_free(&derr);
|
||||
- goto error;
|
||||
- }
|
||||
- dbus_connection_set_exit_on_disconnect(server->sysbus, FALSE);
|
||||
- }
|
||||
-#endif
|
||||
-
|
||||
return 0;
|
||||
|
||||
error:
|
||||
@@ -1278,6 +1258,7 @@ int main(int argc, char **argv) {
|
||||
int ipsock = 0;
|
||||
struct daemonConfig *config;
|
||||
bool privileged = geteuid() == 0 ? true : false;
|
||||
+ bool use_polkit_dbus;
|
||||
|
||||
struct option opts[] = {
|
||||
{ "verbose", no_argument, &verbose, 1},
|
||||
@@ -1436,10 +1417,13 @@ int main(int argc, char **argv) {
|
||||
umask(old_umask);
|
||||
}
|
||||
|
||||
+ use_polkit_dbus = config->auth_unix_rw == REMOTE_AUTH_POLKIT ||
|
||||
+ config->auth_unix_ro == REMOTE_AUTH_POLKIT;
|
||||
if (!(srv = virNetServerNew(config->min_workers,
|
||||
config->max_workers,
|
||||
config->max_clients,
|
||||
config->mdns_adv ? config->mdns_name : NULL,
|
||||
+ use_polkit_dbus,
|
||||
remoteClientInitHook))) {
|
||||
ret = VIR_DAEMON_ERR_INIT;
|
||||
goto cleanup;
|
||||
Index: libvirt-0.9.3/daemon/remote.c
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/daemon/remote.c
|
||||
+++ libvirt-0.9.3/daemon/remote.c
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "command.h"
|
||||
#include "intprops.h"
|
||||
#include "virnetserverservice.h"
|
||||
+#include "virnetserver.h"
|
||||
|
||||
#include "remote_protocol.h"
|
||||
#include "qemu_protocol.h"
|
||||
@@ -2115,7 +2116,7 @@ authdeny:
|
||||
}
|
||||
#elif HAVE_POLKIT0
|
||||
static int
|
||||
-remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
+remoteDispatchAuthPolkit(virNetServerPtr server,
|
||||
virNetServerClientPtr client,
|
||||
virNetMessageHeaderPtr hdr ATTRIBUTE_UNUSED,
|
||||
virNetMessageErrorPtr rerr,
|
||||
@@ -2137,21 +2138,19 @@ remoteDispatchAuthPolkit(virNetServerPtr
|
||||
|
||||
memset(ident, 0, sizeof ident);
|
||||
|
||||
- virMutexLock(&server->lock);
|
||||
- virMutexLock(&client->lock);
|
||||
- virMutexUnlock(&server->lock);
|
||||
+ virMutexLock(&priv->lock);
|
||||
|
||||
- action = client->readonly ?
|
||||
+ action = virNetServerClientGetReadonly(client) ?
|
||||
"org.libvirt.unix.monitor" :
|
||||
"org.libvirt.unix.manage";
|
||||
|
||||
VIR_DEBUG("Start PolicyKit auth %d", virNetServerClientGetFD(client));
|
||||
- if (client->auth != REMOTE_AUTH_POLKIT) {
|
||||
+ if (virNetServerClientGetAuth(client) != VIR_NET_SERVER_SERVICE_AUTH_POLKIT) {
|
||||
VIR_ERROR(_("client tried invalid PolicyKit init request"));
|
||||
goto authfail;
|
||||
}
|
||||
|
||||
- if (qemudGetSocketIdentity(virNetServerClientGetFD(client), &callerUid, &callerPid) < 0) {
|
||||
+ if (virNetServerClientGetLocalIdentity(client, &callerUid, &callerPid) < 0) {
|
||||
VIR_ERROR(_("cannot get peer socket identity"));
|
||||
goto authfail;
|
||||
}
|
||||
@@ -2164,7 +2163,7 @@ remoteDispatchAuthPolkit(virNetServerPtr
|
||||
|
||||
VIR_INFO("Checking PID %d running as %d", callerPid, callerUid);
|
||||
dbus_error_init(&err);
|
||||
- if (!(pkcaller = polkit_caller_new_from_pid(server->sysbus,
|
||||
+ if (!(pkcaller = polkit_caller_new_from_pid(virNetServerGetDBusConn(server),
|
||||
callerPid, &err))) {
|
||||
VIR_ERROR(_("Failed to lookup policy kit caller: %s"), err.message);
|
||||
dbus_error_free(&err);
|
||||
@@ -2226,9 +2225,9 @@ remoteDispatchAuthPolkit(virNetServerPtr
|
||||
action, callerPid, callerUid,
|
||||
polkit_result_to_string_representation(pkresult));
|
||||
ret->complete = 1;
|
||||
- client->auth = REMOTE_AUTH_NONE;
|
||||
+ virNetServerClientSetIdentity(client, ident);
|
||||
|
||||
- virMutexUnlock(&client->lock);
|
||||
+ virMutexUnlock(&priv->lock);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
@@ -2236,7 +2235,7 @@ error:
|
||||
virNetError(VIR_ERR_AUTH_FAILED, "%s",
|
||||
_("authentication failed"));
|
||||
virNetMessageSaveError(rerr);
|
||||
- virMutexUnlock(&client->lock);
|
||||
+ virMutexUnlock(&priv->lock);
|
||||
return -1;
|
||||
|
||||
authfail:
|
||||
Index: libvirt-0.9.3/src/Makefile.am
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/src/Makefile.am
|
||||
+++ libvirt-0.9.3/src/Makefile.am
|
||||
@@ -1268,10 +1268,12 @@ EXTRA_DIST += \
|
||||
endif
|
||||
libvirt_net_rpc_server_la_CFLAGS = \
|
||||
$(AVAHI_CFLAGS) \
|
||||
- $(AM_CFLAGS)
|
||||
+ $(AM_CFLAGS) \
|
||||
+ $(POLKIT_CFLAGS)
|
||||
libvirt_net_rpc_server_la_LDFLAGS = \
|
||||
$(AM_LDFLAGS) \
|
||||
$(AVAHI_LIBS) \
|
||||
+ $(POLKIT_LIBS) \
|
||||
$(CYGWIN_EXTRA_LDFLAGS) \
|
||||
$(MINGW_EXTRA_LDFLAGS)
|
||||
libvirt_net_rpc_server_la_LIBADD = \
|
||||
Index: libvirt-0.9.3/src/rpc/virnetserver.c
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/src/rpc/virnetserver.c
|
||||
+++ libvirt-0.9.3/src/rpc/virnetserver.c
|
||||
@@ -39,6 +39,9 @@
|
||||
#if HAVE_AVAHI
|
||||
# include "virnetservermdns.h"
|
||||
#endif
|
||||
+#if HAVE_DBUS
|
||||
+# include <dbus/dbus.h>
|
||||
+#endif
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_RPC
|
||||
#define virNetError(code, ...) \
|
||||
@@ -84,6 +87,10 @@ struct _virNetServer {
|
||||
virNetServerMDNSGroupPtr mdnsGroup;
|
||||
#endif
|
||||
|
||||
+#if HAVE_DBUS
|
||||
+ DBusConnection *sysbus;
|
||||
+#endif
|
||||
+
|
||||
size_t nservices;
|
||||
virNetServerServicePtr *services;
|
||||
|
||||
@@ -270,6 +277,7 @@ virNetServerPtr virNetServerNew(size_t m
|
||||
size_t max_workers,
|
||||
size_t max_clients,
|
||||
const char *mdnsGroupName,
|
||||
+ bool connectDBus,
|
||||
virNetServerClientInitHook clientInitHook)
|
||||
{
|
||||
virNetServerPtr srv;
|
||||
@@ -306,6 +314,25 @@ virNetServerPtr virNetServerNew(size_t m
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if HAVE_DBUS
|
||||
+ if (connectDBus) {
|
||||
+ DBusError derr;
|
||||
+
|
||||
+ dbus_connection_set_change_sigpipe(FALSE);
|
||||
+ dbus_threads_init_default();
|
||||
+
|
||||
+ dbus_error_init(&derr);
|
||||
+ srv->sysbus = dbus_bus_get(DBUS_BUS_SYSTEM, &derr);
|
||||
+ if (!(srv->sysbus)) {
|
||||
+ VIR_ERROR(_("Failed to connect to system bus for PolicyKit auth: %s"),
|
||||
+ derr.message);
|
||||
+ dbus_error_free(&derr);
|
||||
+ goto error;
|
||||
+ }
|
||||
+ dbus_connection_set_exit_on_disconnect(srv->sysbus, FALSE);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if (virMutexInit(&srv->lock) < 0) {
|
||||
virNetError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("cannot initialize mutex"));
|
||||
@@ -363,6 +390,14 @@ bool virNetServerIsPrivileged(virNetServ
|
||||
}
|
||||
|
||||
|
||||
+#if HAVE_DBUS
|
||||
+DBusConnection* virNetServerGetDBusConn(virNetServerPtr srv)
|
||||
+{
|
||||
+ return srv->sysbus;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
void virNetServerAutoShutdown(virNetServerPtr srv,
|
||||
unsigned int timeout,
|
||||
virNetServerAutoShutdownFunc func,
|
||||
@@ -377,7 +412,6 @@ void virNetServerAutoShutdown(virNetServ
|
||||
virNetServerUnlock(srv);
|
||||
}
|
||||
|
||||
-
|
||||
static sig_atomic_t sigErrors = 0;
|
||||
static int sigLastErrno = 0;
|
||||
static int sigWrite = -1;
|
||||
@@ -747,6 +781,11 @@ void virNetServerFree(virNetServerPtr sr
|
||||
|
||||
VIR_FREE(srv->mdnsGroupName);
|
||||
|
||||
+#if HAVE_DBUS
|
||||
+ if (srv->sysbus)
|
||||
+ dbus_connection_unref(srv->sysbus);
|
||||
+#endif
|
||||
+
|
||||
virNetServerUnlock(srv);
|
||||
virMutexDestroy(&srv->lock);
|
||||
VIR_FREE(srv);
|
||||
Index: libvirt-0.9.3/src/rpc/virnetserver.h
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/src/rpc/virnetserver.h
|
||||
+++ libvirt-0.9.3/src/rpc/virnetserver.h
|
||||
@@ -25,6 +25,9 @@
|
||||
# define __VIR_NET_SERVER_H__
|
||||
|
||||
# include <signal.h>
|
||||
+# if HAVE_DBUS
|
||||
+# include <dbus/dbus.h>
|
||||
+# endif
|
||||
|
||||
# include "virnettlscontext.h"
|
||||
# include "virnetserverprogram.h"
|
||||
@@ -38,6 +41,7 @@ virNetServerPtr virNetServerNew(size_t m
|
||||
size_t max_workers,
|
||||
size_t max_clients,
|
||||
const char *mdnsGroupName,
|
||||
+ bool connectDBus,
|
||||
virNetServerClientInitHook clientInitHook);
|
||||
|
||||
typedef int (*virNetServerAutoShutdownFunc)(virNetServerPtr srv, void *opaque);
|
||||
@@ -46,6 +50,10 @@ void virNetServerRef(virNetServerPtr srv
|
||||
|
||||
bool virNetServerIsPrivileged(virNetServerPtr srv);
|
||||
|
||||
+# if HAVE_DBUS
|
||||
+DBusConnection* virNetServerGetDBusConn(virNetServerPtr srv);
|
||||
+# endif
|
||||
+
|
||||
void virNetServerAutoShutdown(virNetServerPtr srv,
|
||||
unsigned int timeout,
|
||||
virNetServerAutoShutdownFunc func,
|
43
c2ddd536-cert-key-order.patch
Normal file
43
c2ddd536-cert-key-order.patch
Normal file
@ -0,0 +1,43 @@
|
||||
commit c2ddd536145f36e400a93a1c77f9f0044bfdf068
|
||||
Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Date: Fri Jul 8 11:14:20 2011 +0100
|
||||
|
||||
Fix mistaken order of server cert/key parameters in constructor
|
||||
|
||||
The virNetTLSContextNew was being passed key/cert parameters in
|
||||
the wrong order. This wasn't immediately visible because if
|
||||
virNetTLSContextNewPath was used, a second bug reversed the order
|
||||
of those parameters again.
|
||||
|
||||
Only if the paths were manually specified in /etc/libvirt/libvirtd.conf
|
||||
did the bug appear
|
||||
|
||||
* src/rpc/virnettlscontext.c: Fix order of params passed to
|
||||
virNetTLSContextNew
|
||||
|
||||
diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
|
||||
index ad8e2dc..1120e1e 100644
|
||||
--- a/src/rpc/virnettlscontext.c
|
||||
+++ b/src/rpc/virnettlscontext.c
|
||||
@@ -396,10 +396,10 @@ static virNetTLSContextPtr virNetTLSContextNewPath(const char *pkipath,
|
||||
virNetTLSContextPtr ctxt = NULL;
|
||||
|
||||
if (virNetTLSContextLocateCredentials(pkipath, tryUserPkiPath, isServer,
|
||||
- &cacert, &cacrl, &key, &cert) < 0)
|
||||
+ &cacert, &cacrl, &cert, &key) < 0)
|
||||
return NULL;
|
||||
|
||||
- ctxt = virNetTLSContextNew(cacert, cacrl, key, cert,
|
||||
+ ctxt = virNetTLSContextNew(cacert, cacrl, cert, key,
|
||||
x509dnWhitelist, requireValidCert, isServer);
|
||||
|
||||
VIR_FREE(cacert);
|
||||
@@ -435,7 +435,7 @@ virNetTLSContextPtr virNetTLSContextNewServer(const char *cacert,
|
||||
const char *const*x509dnWhitelist,
|
||||
bool requireValidCert)
|
||||
{
|
||||
- return virNetTLSContextNew(cacert, cacrl, key, cert,
|
||||
+ return virNetTLSContextNew(cacert, cacrl, cert, key,
|
||||
x509dnWhitelist, requireValidCert, true);
|
||||
}
|
||||
|
168
eb314315-pv-kernel-cmdline.patch
Normal file
168
eb314315-pv-kernel-cmdline.patch
Normal file
@ -0,0 +1,168 @@
|
||||
commit eb3143154e4ecedf3a97445b3b90bd135a564431
|
||||
Author: Jim Fehlig <jfehlig@novell.com>
|
||||
Date: Wed Jul 6 19:17:16 2011 -0600
|
||||
|
||||
Do not drop kernel cmdline for xen pv domains
|
||||
|
||||
Kernel cmdline args can be passed to xen pv domains even when a
|
||||
bootloader is specified. The current config-to-sxpr mapping
|
||||
ignores cmdline when bootloader is present.
|
||||
|
||||
Since the xend sub-driver is used with many xen toolstack versions,
|
||||
this patch takes conservative approach of adding an else block to
|
||||
existing !def->os.bootloader, and only appends sxpr if def->os.cmdline
|
||||
is non-NULL.
|
||||
|
||||
V2: Fix existing testcase broken by this patch and add new testcases
|
||||
|
||||
Index: libvirt-0.9.3/docs/schemas/domain.rng
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/docs/schemas/domain.rng
|
||||
+++ libvirt-0.9.3/docs/schemas/domain.rng
|
||||
@@ -543,9 +543,11 @@
|
||||
</define>
|
||||
<define name="osbootkernel">
|
||||
<interleave>
|
||||
- <element name="kernel">
|
||||
- <ref name="absFilePath"/>
|
||||
- </element>
|
||||
+ <optional>
|
||||
+ <element name="kernel">
|
||||
+ <ref name="absFilePath"/>
|
||||
+ </element>
|
||||
+ </optional>
|
||||
<optional>
|
||||
<element name="initrd">
|
||||
<ref name="absFilePath"/>
|
||||
Index: libvirt-0.9.3/src/xenxs/xen_sxpr.c
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/src/xenxs/xen_sxpr.c
|
||||
+++ libvirt-0.9.3/src/xenxs/xen_sxpr.c
|
||||
@@ -2261,6 +2261,12 @@ xenFormatSxpr(virConnectPtr conn,
|
||||
}
|
||||
|
||||
virBufferAddLit(&buf, "))");
|
||||
+ } else {
|
||||
+ /* PV domains accept kernel cmdline args */
|
||||
+ if (def->os.cmdline) {
|
||||
+ virBufferEscapeSexpr(&buf, "(image (linux (args '%s')))",
|
||||
+ def->os.cmdline);
|
||||
+ }
|
||||
}
|
||||
|
||||
for (i = 0 ; i < def->ndisks ; i++)
|
||||
Index: libvirt-0.9.3/tests/sexpr2xmldata/sexpr2xml-pv-bootloader-cmdline.sexpr
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ libvirt-0.9.3/tests/sexpr2xmldata/sexpr2xml-pv-bootloader-cmdline.sexpr
|
||||
@@ -0,0 +1,5 @@
|
||||
+(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)\
|
||||
+(uuid '596a5d2171f48fb2e068e2386a5c413e')(bootloader '/usr/bin/pygrub')\
|
||||
+(bootloader_args '-q')(image (linux (args 'xenfb.video=8,1280,1024')))\
|
||||
+(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')\
|
||||
+(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
|
||||
Index: libvirt-0.9.3/tests/sexpr2xmldata/sexpr2xml-pv-bootloader-cmdline.xml
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ libvirt-0.9.3/tests/sexpr2xmldata/sexpr2xml-pv-bootloader-cmdline.xml
|
||||
@@ -0,0 +1,27 @@
|
||||
+<domain type='xen' id='6'>
|
||||
+ <name>pvtest</name>
|
||||
+ <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
|
||||
+ <memory>430080</memory>
|
||||
+ <currentMemory>430080</currentMemory>
|
||||
+ <vcpu>2</vcpu>
|
||||
+ <bootloader>/usr/bin/pygrub</bootloader>
|
||||
+ <bootloader_args>-q</bootloader_args>
|
||||
+ <os>
|
||||
+ <type>linux</type>
|
||||
+ <cmdline>xenfb.video=8,1280,1024</cmdline>
|
||||
+ </os>
|
||||
+ <clock offset='utc'/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>destroy</on_reboot>
|
||||
+ <on_crash>destroy</on_crash>
|
||||
+ <devices>
|
||||
+ <disk type='file' device='disk'>
|
||||
+ <driver name='file'/>
|
||||
+ <source file='/root/some.img'/>
|
||||
+ <target dev='xvda' bus='xen'/>
|
||||
+ </disk>
|
||||
+ <console type='pty'>
|
||||
+ <target type='xen' port='0'/>
|
||||
+ </console>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
Index: libvirt-0.9.3/tests/sexpr2xmltest.c
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/tests/sexpr2xmltest.c
|
||||
+++ libvirt-0.9.3/tests/sexpr2xmltest.c
|
||||
@@ -134,6 +134,7 @@ mymain(void)
|
||||
DO_TEST("pv-vfb-type-crash", "pv-vfb-type-crash", 3);
|
||||
DO_TEST("fv-autoport", "fv-autoport", 3);
|
||||
DO_TEST("pv-bootloader", "pv-bootloader", 1);
|
||||
+ DO_TEST("pv-bootloader-cmdline", "pv-bootloader-cmdline", 1);
|
||||
DO_TEST("pv-vcpus", "pv-vcpus", 1);
|
||||
|
||||
DO_TEST("disk-file", "disk-file", 2);
|
||||
Index: libvirt-0.9.3/tests/xml2sexprdata/xml2sexpr-disk-block-shareable.sexpr
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/tests/xml2sexprdata/xml2sexpr-disk-block-shareable.sexpr
|
||||
+++ libvirt-0.9.3/tests/xml2sexprdata/xml2sexpr-disk-block-shareable.sexpr
|
||||
@@ -1,6 +1,7 @@
|
||||
(vm (name 'pvtest')(memory 384)(maxmem 512)(vcpus 1)\
|
||||
(uuid '49a0c6ff-c066-5392-6498-3632d093c2e7')(bootloader '/usr/bin/pygrub')\
|
||||
(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')\
|
||||
+(image (linux (args 'ro root=/dev/VolGroup00/LogVol00')))\
|
||||
(device (tap (dev 'xvda')(uname 'tap:aio:/var/lib/xen/images/rhel5pv.img')\
|
||||
(mode 'w!')))(device (vif (mac '00:16:3e:23:9e:eb')(bridge 'xenbr0')\
|
||||
(script 'vif-bridge'))))\
|
||||
Index: libvirt-0.9.3/tests/xml2sexprdata/xml2sexpr-pv-bootloader-cmdline.sexpr
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ libvirt-0.9.3/tests/xml2sexprdata/xml2sexpr-pv-bootloader-cmdline.sexpr
|
||||
@@ -0,0 +1,5 @@
|
||||
+(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)\
|
||||
+(uuid '596a5d21-71f4-8fb2-e068-e2386a5c413e')(bootloader '/usr/bin/pygrub')\
|
||||
+(bootloader_args '-q')(on_poweroff 'destroy')(on_reboot 'destroy')\
|
||||
+(on_crash 'destroy')(image (linux (args 'xenfb.video=8,1280,1024')))\
|
||||
+(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))\
|
||||
Index: libvirt-0.9.3/tests/xml2sexprdata/xml2sexpr-pv-bootloader-cmdline.xml
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ libvirt-0.9.3/tests/xml2sexprdata/xml2sexpr-pv-bootloader-cmdline.xml
|
||||
@@ -0,0 +1,22 @@
|
||||
+<domain type='xen' id='15'>
|
||||
+ <name>pvtest</name>
|
||||
+ <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
+ <bootloader>/usr/bin/pygrub</bootloader>
|
||||
+ <bootloader_args>-q</bootloader_args>
|
||||
+ <os>
|
||||
+ <type>linux</type>
|
||||
+ <cmdline>xenfb.video=8,1280,1024</cmdline>
|
||||
+ </os>
|
||||
+ <memory>430080</memory>
|
||||
+ <vcpu>2</vcpu>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>destroy</on_reboot>
|
||||
+ <on_crash>destroy</on_crash>
|
||||
+ <devices>
|
||||
+ <disk type='file' device='disk'>
|
||||
+ <source file='/root/some.img'/>
|
||||
+ <target dev='xvda'/>
|
||||
+ </disk>
|
||||
+ <console tty='/dev/pts/4'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
Index: libvirt-0.9.3/tests/xml2sexprtest.c
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/tests/xml2sexprtest.c
|
||||
+++ libvirt-0.9.3/tests/xml2sexprtest.c
|
||||
@@ -116,6 +116,7 @@ mymain(void)
|
||||
DO_TEST("pv-vfb-new", "pv-vfb-new", "pvtest", 3);
|
||||
DO_TEST("pv-vfb-new-auto", "pv-vfb-new-auto", "pvtest", 3);
|
||||
DO_TEST("pv-bootloader", "pv-bootloader", "pvtest", 1);
|
||||
+ DO_TEST("pv-bootloader-cmdline", "pv-bootloader-cmdline", "pvtest", 1);
|
||||
DO_TEST("pv-vcpus", "pv-vcpus", "pvtest", 1);
|
||||
|
||||
DO_TEST("disk-file", "disk-file", "pvtest", 2);
|
@ -1,3 +1,15 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 13 14:37:42 MDT 2011 - jfehlig@suse.de
|
||||
|
||||
- Add some upstream patches to fix memory leaks and some bugs
|
||||
in new rpc code
|
||||
c2ddd536-cert-key-order.patch 3e5d48ef-rpc-1.patch
|
||||
927dfcf6-rpc-2.patch 2c85644b-rpc-3.patch afe8839f-rpc-4.patch
|
||||
3cfdc57b-rpc-5.patch 7518ad75-remote-mem-leak.patch
|
||||
a34e193f-statstest.patch 41828514-skip-xen-tests.patch
|
||||
eb314315-pv-kernel-cmdline.patch 00d3c5a6-remove-dead-code.patch
|
||||
b8adfcc6-fix-polkit0-build.patch b2534529-unused-param.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 5 14:15:22 MDT 2011 - jfehlig@suse.de
|
||||
|
||||
|
26
libvirt.spec
26
libvirt.spec
@ -352,6 +352,19 @@ Source0: %{name}-%{version}.tar.bz2
|
||||
Source1: libvirtd.init
|
||||
Source2: libvirtd-relocation-server.fw
|
||||
# Upstream patches
|
||||
Patch0: c2ddd536-cert-key-order.patch
|
||||
Patch1: 3e5d48ef-rpc-1.patch
|
||||
Patch2: 927dfcf6-rpc-2.patch
|
||||
Patch3: 2c85644b-rpc-3.patch
|
||||
Patch4: afe8839f-rpc-4.patch
|
||||
Patch5: 3cfdc57b-rpc-5.patch
|
||||
Patch6: 7518ad75-remote-mem-leak.patch
|
||||
Patch7: a34e193f-statstest.patch
|
||||
Patch8: 41828514-skip-xen-tests.patch
|
||||
Patch9: eb314315-pv-kernel-cmdline.patch
|
||||
Patch10: 00d3c5a6-remove-dead-code.patch
|
||||
Patch11: b8adfcc6-fix-polkit0-build.patch
|
||||
Patch12: b2534529-unused-param.patch
|
||||
# Need to go upstream
|
||||
Patch100: xen-name-for-devid.patch
|
||||
Patch101: clone.patch
|
||||
@ -467,6 +480,19 @@ Authors:
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch100 -p1
|
||||
%patch101
|
||||
%patch102 -p1
|
||||
|
@ -32,7 +32,7 @@ Index: libvirt-0.9.3/daemon/libvirtd.c
|
||||
===================================================================
|
||||
--- libvirt-0.9.3.orig/daemon/libvirtd.c
|
||||
+++ libvirt-0.9.3/daemon/libvirtd.c
|
||||
@@ -897,7 +897,7 @@ daemonConfigNew(bool privileged ATTRIBUT
|
||||
@@ -877,7 +877,7 @@ daemonConfigNew(bool privileged ATTRIBUT
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ Index: libvirt-0.9.3/daemon/libvirtd.c
|
||||
data->listen_tcp = 0;
|
||||
|
||||
if (!(data->tls_port = strdup(LIBVIRTD_TLS_PORT)))
|
||||
@@ -934,7 +934,7 @@ daemonConfigNew(bool privileged ATTRIBUT
|
||||
@@ -914,7 +914,7 @@ daemonConfigNew(bool privileged ATTRIBUT
|
||||
#endif
|
||||
data->auth_tls = REMOTE_AUTH_NONE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user