[Libvir] PATCH: Fix QEMU autostart/network behaviour
Daniel P. Berrange
berrange at redhat.com
Thu Mar 8 14:48:38 UTC 2007
In my testing there appeared to be a couple of bugs with the QEMU driver
and the interaction with networking
- It was auto-starting the daemon even with qemu://system
- It was opening the QEMU connection twice due to inverted check, and
not opening it at all in the non-QEMU hv case.
- Once that is fixed, then it SEGVs when using a Xen connection
as uri->scheme is NULL
That attached patch rectifies those flaws - Mark can you double check this
just in case I've missed some edge case for the networking stuff - I have
strace'd virsh when doing
virsh list (as root & non-root)
virsh --connect test://default list (as root & non-root)
virsh --connect xen list (as root & non-root)
virsh --connect qemu://session list (as non-root)
virsh --connect qemu://system list (as root)
virsh --connect qemu://session --readonly list (as non-root)
virsh --connect qemu://system --readonly list (as root & non-root)
And it appears to now be making the correct connectiosn to the QEMU daemons
in all cases
Regards,
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
-------------- next part --------------
Index: qemu_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_internal.c,v
retrieving revision 1.15
diff -u -p -r1.15 qemu_internal.c
--- qemu_internal.c 8 Mar 2007 08:31:07 -0000 1.15
+++ qemu_internal.c 8 Mar 2007 14:36:12 -0000
@@ -329,6 +329,7 @@ static int qemuProcessRequest(virConnect
*/
static int qemuOpenConnection(virConnectPtr conn, xmlURIPtr uri, int readonly) {
char path[PATH_MAX];
+ int autostart = 0;
if (uri->server != NULL) {
return -1;
@@ -358,8 +359,9 @@ static int qemuOpenConnection(virConnect
if (snprintf(path, sizeof(path), "@%s/.libvirt/qemud-sock", pw->pw_dir) == sizeof(path)) {
return -1;
}
+ autostart = 1;
}
- return qemuOpenClientUNIX(conn, path, 1);
+ return qemuOpenClientUNIX(conn, path, autostart);
}
@@ -845,13 +847,13 @@ static int qemuNetworkOpen(virConnectPtr
xmlURIPtr uri = NULL;
int ret = -1;
- if (conn->qemud_fd == -1)
+ if (conn->qemud_fd != -1)
return 0;
if (name)
uri = xmlParseURI(name);
- if (uri && !strcmp(uri->scheme, "qemu"))
+ if (uri && uri->scheme && !strcmp(uri->scheme, "qemu"))
ret = qemuOpen(conn, name, flags);
else if (geteuid() == 0)
ret = qemuOpen(conn, "qemu:///system", flags);
More information about the libvir-list
mailing list