Don't share virConnect->handle with the xen hypervisor socket so that we can have a qemud connection open at the same time as a xen hypervisor connection. Signed-off-by: Mark McLoughlin Index: libvirt-foo/src/internal.h =================================================================== --- libvirt-foo.orig/src/internal.h 2007-01-23 14:39:45.000000000 +0000 +++ libvirt-foo.orig/src/internal.h 2007-01-23 14:39:45.000000000 +0000 @@ -117,6 +117,8 @@ struct _virConnect { struct sockaddr_un addr_un; /* the unix address */ struct sockaddr_in addr_in; /* the inet address */ + int qemud_fd; /* connection to qemud */ + /* error stuff */ virError err; /* the last error */ virErrorFunc handler; /* associated handlet */ Index: libvirt-foo/src/qemu_internal.c =================================================================== --- libvirt-foo.orig/src/qemu_internal.c 2007-02-14 01:40:09.000000000 +0000 +++ libvirt-foo.orig/src/qemu_internal.c 2007-02-14 01:40:09.000000000 +0000 @@ -244,7 +244,7 @@ qemuOpenClientUNIX(virConnectPtr conn, c return (-1); } - conn->handle = fd; + conn->qemud_fd = fd; return (0); } @@ -269,7 +269,7 @@ static int qemuProcessRequest(virConnect /* Block sending entire outgoing packet */ while (outLeft) { - int got = write(conn->handle, out+outDone, outLeft); + int got = write(conn->qemud_fd, out+outDone, outLeft); if (got < 0) { return -1; } @@ -279,7 +279,7 @@ static int qemuProcessRequest(virConnect /* Block waiting for header to come back */ while (inLeft) { - int done = read(conn->handle, in+inGot, inLeft); + int done = read(conn->qemud_fd, in+inGot, inLeft); if (done <= 0) { return -1; } @@ -307,7 +307,7 @@ static int qemuProcessRequest(virConnect /* Now block reading in body */ inLeft = reply->header.dataSize; while (inLeft) { - int done = read(conn->handle, in+inGot, inLeft); + int done = read(conn->qemud_fd, in+inGot, inLeft); if (done <= 0) { return -1; } @@ -389,11 +389,11 @@ static int qemuOpen(virConnectPtr conn, return -1; } - conn->handle = -1; + conn->qemud_fd = -1; qemuOpenConnection(conn, uri, flags & VIR_DRV_OPEN_RO ? 1 : 0); xmlFreeURI(uri); - if (conn->handle < 0) { + if (conn->qemud_fd < 0) { return -1; } @@ -402,9 +402,9 @@ static int qemuOpen(virConnectPtr conn, static int qemuClose (virConnectPtr conn) { - if (conn->handle != -1) { - close(conn->handle); - conn->handle = -1; + if (conn->qemud_fd != -1) { + close(conn->qemud_fd); + conn->qemud_fd = -1; } return 0; } Index: libvirt-foo/src/hash.c =================================================================== --- libvirt-foo.orig/src/hash.c 2007-01-23 14:39:45.000000000 +0000 +++ libvirt-foo.orig/src/hash.c 2007-01-23 14:39:45.000000000 +0000 @@ -655,6 +655,8 @@ virGetConnect(void) { memset(ret, 0, sizeof(virConnect)); ret->magic = VIR_CONNECT_MAGIC; ret->nb_drivers = 0; + ret->handle = -1; + ret->qemud_fd = -1; ret->domains = virHashCreate(20); if (ret->domains == NULL) goto failed; --