Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 83ba258549 | |||
| 50fe0d263a | |||
| 0c26bd4a4f | |||
| 638904efc6 | |||
| 47e1b69fe8 | |||
| a97e8a832b | |||
| ad7d10defd | |||
| 944583a781 | |||
| b5384b6962 | |||
| e161c35538 |
@@ -1,27 +0,0 @@
|
||||
From 37865f1dead1fac2ee34af48f96d19d686296e04 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 13 Sep 2012 14:37:22 +0100
|
||||
Subject: [PATCH] Use 'qemu-system-i386' as binary instead of 'qemu'.
|
||||
|
||||
---
|
||||
src/qemu/qemu_capabilities.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index af3b0b2..179b3d2 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -244,8 +244,8 @@ static const struct qemu_feature_flags const arch_info_x86_64_flags [] = {
|
||||
|
||||
/* The archicture tables for supported QEMU archs */
|
||||
static const struct qemu_arch_info const arch_info_hvm[] = {
|
||||
- { "i686", 32, NULL, "qemu",
|
||||
- "qemu-system-x86_64", arch_info_i686_flags, 4 },
|
||||
+ { "i686", 32, NULL, "qemu-system-i386",
|
||||
+ NULL, arch_info_i686_flags, 4 },
|
||||
{ "x86_64", 64, NULL, "qemu-system-x86_64",
|
||||
NULL, arch_info_x86_64_flags, 2 },
|
||||
{ "arm", 32, NULL, "qemu-system-arm", NULL, NULL, 0 },
|
||||
--
|
||||
1.7.11.4
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From 452bf160e5bbe0789d706fda95f5919551eb2cac Mon Sep 17 00:00:00 2001
|
||||
From: Jiri Denemark <jdenemar@redhat.com>
|
||||
Date: Fri, 25 Mar 2011 16:45:45 +0100
|
||||
Subject: [PATCH 2/2] daemon: Avoid resetting errors before they are reported
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=690733
|
||||
|
||||
Commit f44bfb7 was supposed to make sure no additional libvirt API (esp.
|
||||
*Free) is called before remoteDispatchConnError() is called on error.
|
||||
However, the patch missed two instances.
|
||||
(cherry picked from commit 55cc591fc18e87b29febf78dc5b424b7c12f7349)
|
||||
---
|
||||
daemon/remote.c | 6 ++++--
|
||||
1 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/daemon/remote.c b/daemon/remote.c
|
||||
index a8258ca..7464957 100644
|
||||
--- a/daemon/remote.c
|
||||
+++ b/daemon/remote.c
|
||||
@@ -4547,12 +4547,13 @@ remoteDispatchStoragePoolListVolumes (struct qemud_server *server ATTRIBUTE_UNUS
|
||||
ret->names.names_len =
|
||||
virStoragePoolListVolumes (pool,
|
||||
ret->names.names_val, args->maxnames);
|
||||
- virStoragePoolFree(pool);
|
||||
if (ret->names.names_len == -1) {
|
||||
VIR_FREE(ret->names.names_val);
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
+ virStoragePoolFree(pool);
|
||||
return -1;
|
||||
}
|
||||
+ virStoragePoolFree(pool);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -4576,11 +4577,12 @@ remoteDispatchStoragePoolNumOfVolumes (struct qemud_server *server ATTRIBUTE_UNU
|
||||
}
|
||||
|
||||
ret->num = virStoragePoolNumOfVolumes (pool);
|
||||
- virStoragePoolFree(pool);
|
||||
if (ret->num == -1) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
+ virStoragePoolFree(pool);
|
||||
return -1;
|
||||
}
|
||||
+ virStoragePoolFree(pool);
|
||||
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
1.7.3.4
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -rup libvirt-0.8.3.orig/src/qemu/qemu_conf.c libvirt-0.8.3.new/src/qemu/qemu_conf.c
|
||||
--- libvirt-0.8.3.orig/src/qemu/qemu_conf.c 2010-08-04 13:21:27.000000000 +0100
|
||||
+++ libvirt-0.8.3.new/src/qemu/qemu_conf.c 2010-08-23 21:08:13.239794362 +0100
|
||||
@@ -3651,7 +3651,7 @@ int qemudBuildCommandLine(virConnectPtr
|
||||
{
|
||||
int i;
|
||||
char memory[50];
|
||||
- char boot[VIR_DOMAIN_BOOT_LAST];
|
||||
+ char boot[VIR_DOMAIN_BOOT_LAST+1];
|
||||
struct utsname ut;
|
||||
int disableKQEMU = 0;
|
||||
int disableKVM = 0;
|
||||
@@ -0,0 +1,44 @@
|
||||
From f970d802ab805f1a37af384f148f34e108714034 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Wed, 3 Nov 2010 15:20:24 -0600
|
||||
Subject: [PATCH] rpm: fix /var/lib/libvirt permissions
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=649511
|
||||
|
||||
Regression of forcing 0700 permissions (which breaks guest startup
|
||||
because the qemu user can't see /var/lib/libvirt/*.monitor) was
|
||||
introduced in commit 66823690e, as part of libvirt 0.8.2.
|
||||
|
||||
* libvirt.spec.in (%files): Drop %{_localstatedir}/lib/libvirt,
|
||||
since libvirt depends on libvirt-client.
|
||||
(%files client): Guarantee 755 permissions on
|
||||
%(_localstatedir}/lib/libvirt, since the qemu user must be able to
|
||||
do pathname resolution to a subdirectory.
|
||||
---
|
||||
libvirt.spec.in | 3 +--
|
||||
1 files changed, 1 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libvirt.spec.in b/libvirt.spec.in
|
||||
index 813e0c0..f77626e 100644
|
||||
--- a/libvirt.spec.in
|
||||
+++ b/libvirt.spec.in
|
||||
@@ -793,7 +793,6 @@ fi
|
||||
|
||||
%dir %{_localstatedir}/run/libvirt/
|
||||
|
||||
-%dir %{_localstatedir}/lib/libvirt/
|
||||
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/images/
|
||||
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/boot/
|
||||
%dir %attr(0700, root, root) %{_localstatedir}/cache/libvirt/
|
||||
@@ -883,7 +882,7 @@ fi
|
||||
|
||||
%{_sysconfdir}/rc.d/init.d/libvirt-guests
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/libvirt-guests
|
||||
-%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt
|
||||
+%dir %attr(0755, root, root) %{_localstatedir}/lib/libvirt/
|
||||
|
||||
%if %{with_sasl}
|
||||
%config(noreplace) %{_sysconfdir}/sasl2/libvirt.conf
|
||||
--
|
||||
1.7.3.4
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
From 8efebd1761700a0cc32736829aead7807cc7865d Mon Sep 17 00:00:00 2001
|
||||
From: =?utf8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes@gmail.com>
|
||||
Date: Tue, 26 Oct 2010 14:45:03 +0200
|
||||
Subject: [PATCH] qemu: don't use %.3d format for bus/addr of USB devices
|
||||
|
||||
When using 0-prefixed numbers, QEmu will interpret them as octal numbers
|
||||
(as C convention says); this means that if you attach a device that has
|
||||
addr > 10 (decimal) you're going to attach a different device.
|
||||
---
|
||||
src/qemu/qemu_conf.c | 4 ++--
|
||||
.../qemuxml2argv-hostdev-usb-address-device.args | 2 +-
|
||||
.../qemuxml2argv-hostdev-usb-address.args | 2 +-
|
||||
3 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
||||
index 00e89a1..5bd3d4c 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -3266,7 +3266,7 @@ qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if (virAsprintf(&ret, "usb-host,hostbus=%.3d,hostaddr=%.3d,id=%s",
|
||||
+ if (virAsprintf(&ret, "usb-host,hostbus=%d,hostaddr=%d,id=%s",
|
||||
dev->source.subsys.u.usb.bus,
|
||||
dev->source.subsys.u.usb.device,
|
||||
dev->info.alias) < 0)
|
||||
@@ -3288,7 +3288,7 @@ qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if (virAsprintf(&ret, "host:%.3d.%.3d",
|
||||
+ if (virAsprintf(&ret, "host:%d.%d",
|
||||
dev->source.subsys.u.usb.bus,
|
||||
dev->source.subsys.u.usb.device) < 0)
|
||||
virReportOOMError();
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.args
|
||||
index 6900fd3..7e42542 100644
|
||||
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.args
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.args
|
||||
@@ -1 +1 @@
|
||||
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -device usb-host,hostbus=014,hostaddr=006,id=hostdev0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -usb -device usb-host,hostbus=14,hostaddr=6,id=hostdev0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args
|
||||
index e57bec1..96e004d 100644
|
||||
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args
|
||||
@@ -1 +1 @@
|
||||
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice host:014.006
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -usbdevice host:14.6
|
||||
--
|
||||
1.7.3.4
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
From: Guido Günther <agx@sigxcpu.org>
|
||||
Date: Mon, 14 Mar 2011 02:56:28 +0000 (+0800)
|
||||
Subject: Add missing checks for read only connections
|
||||
X-Git-Url: http://libvirt.org/git/?p=libvirt.git;a=commitdiff_plain;h=71753cb7f7a16ff800381c0b5ee4e99eea92fed3;hp=13c00dde3171b3a38d23cceb3f9151cb6cac3dad
|
||||
|
||||
Add missing checks for read only connections
|
||||
|
||||
As pointed on CVE-2011-1146, some API forgot to check the read-only
|
||||
status of the connection for entry point which modify the state
|
||||
of the system or may lead to a remote execution using user data.
|
||||
The entry points concerned are:
|
||||
- virConnectDomainXMLToNative
|
||||
- virNodeDeviceDettach
|
||||
- virNodeDeviceReAttach
|
||||
- virNodeDeviceReset
|
||||
- virDomainRevertToSnapshot
|
||||
- virDomainSnapshotDelete
|
||||
|
||||
* src/libvirt.c: fix the above set of entry points to error on read-only
|
||||
connections
|
||||
|
||||
Rebased to 0.8.2, mostly changed the call of the error routines
|
||||
---
|
||||
|
||||
--- src/libvirt.c.orig 2011-03-14 17:03:45.000000000 +0800
|
||||
+++ src/libvirt.c 2011-03-14 17:10:41.000000000 +0800
|
||||
@@ -3190,6 +3190,10 @@ char *virConnectDomainXMLToNative(virCon
|
||||
virDispatchError(NULL);
|
||||
return (NULL);
|
||||
}
|
||||
+ if (conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibConnError(NULL, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
|
||||
if (nativeFormat == NULL || domainXml == NULL) {
|
||||
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
@@ -9432,6 +9436,11 @@ virNodeDeviceDettach(virNodeDevicePtr de
|
||||
return (-1);
|
||||
}
|
||||
|
||||
+ if (dev->conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibConnError(dev->conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
if (dev->conn->driver->nodeDeviceDettach) {
|
||||
int ret;
|
||||
ret = dev->conn->driver->nodeDeviceDettach (dev);
|
||||
@@ -9475,6 +9484,11 @@ virNodeDeviceReAttach(virNodeDevicePtr d
|
||||
return (-1);
|
||||
}
|
||||
|
||||
+ if (dev->conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibConnError(dev->conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
if (dev->conn->driver->nodeDeviceReAttach) {
|
||||
int ret;
|
||||
ret = dev->conn->driver->nodeDeviceReAttach (dev);
|
||||
@@ -9520,6 +9534,11 @@ virNodeDeviceReset(virNodeDevicePtr dev)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
+ if (dev->conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibConnError(dev->conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
if (dev->conn->driver->nodeDeviceReset) {
|
||||
int ret;
|
||||
ret = dev->conn->driver->nodeDeviceReset (dev);
|
||||
@@ -12775,6 +12794,10 @@ virDomainRevertToSnapshot(virDomainSnaps
|
||||
}
|
||||
|
||||
conn = snapshot->domain->conn;
|
||||
+ if (conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
|
||||
if (conn->driver->domainRevertToSnapshot) {
|
||||
int ret = conn->driver->domainRevertToSnapshot(snapshot, flags);
|
||||
@@ -12821,6 +12844,10 @@ virDomainSnapshotDelete(virDomainSnapsho
|
||||
}
|
||||
|
||||
conn = snapshot->domain->conn;
|
||||
+ if (conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
|
||||
if (conn->driver->domainSnapshotDelete) {
|
||||
int ret = conn->driver->domainSnapshotDelete(snapshot, flags);
|
||||
@@ -0,0 +1,106 @@
|
||||
From 584f9cee6926b57a19cc8bb36ea77124bdcfed94 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Fri, 24 Jun 2011 12:16:05 -0600
|
||||
Subject: [PATCH] remote: protect against integer overflow
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=717204
|
||||
CVE-2011-2511 - integer overflow in VirDomainGetVcpus
|
||||
|
||||
Integer overflow and remote code are never a nice mix.
|
||||
|
||||
This has existed since commit 56cd414.
|
||||
|
||||
* src/libvirt.c (virDomainGetVcpus): Reject overflow up front.
|
||||
* src/remote/remote_driver.c (remoteDomainGetVcpus): Avoid overflow
|
||||
on sending rpc.
|
||||
* daemon/remote.c (remoteDispatchDomainGetVcpus): Avoid overflow on
|
||||
receiving rpc.
|
||||
|
||||
(cherry picked from commit 774b21c163845170c9ffa873f5720d318812eaf6)
|
||||
|
||||
Conflicts:
|
||||
|
||||
daemon/remote.c
|
||||
src/remote/remote_driver.c
|
||||
src/libvirt.c
|
||||
|
||||
Change to internal.h required to avoid backporting 89d994ad.
|
||||
---
|
||||
daemon/remote.c | 3 ++-
|
||||
src/internal.h | 17 +++++++++++++++++
|
||||
src/libvirt.c | 4 ++--
|
||||
src/remote/remote_driver.c | 3 ++-
|
||||
4 files changed, 23 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/daemon/remote.c b/daemon/remote.c
|
||||
index 7464957..c6f7007 100644
|
||||
--- a/daemon/remote.c
|
||||
+++ b/daemon/remote.c
|
||||
@@ -1697,7 +1697,8 @@ remoteDispatchDomainGetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) {
|
||||
+ if (INT_MULTIPLY_OVERFLOW(args->maxinfo, args->maplen) ||
|
||||
+ args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) {
|
||||
virDomainFree(dom);
|
||||
remoteDispatchFormatError (rerr, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX"));
|
||||
return -1;
|
||||
diff --git a/src/internal.h b/src/internal.h
|
||||
index fab3e11..53447a9 100644
|
||||
--- a/src/internal.h
|
||||
+++ b/src/internal.h
|
||||
@@ -226,4 +226,21 @@
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
+/* branch-specific: we don't want to update gnulib on the branch, so this
|
||||
+ * backports just one required macro from newer gnulib's intprops.h.
|
||||
+ * This version requires that both a and b are 'int', rather than
|
||||
+ * the fully type-generic version from gnulib. */
|
||||
+# define INT_MULTIPLY_OVERFLOW(a, b) \
|
||||
+ ((b) < 0 \
|
||||
+ ? ((a) < 0 \
|
||||
+ ? (a) < INT_MAX / (b) \
|
||||
+ : (b) == -1 \
|
||||
+ ? 0 \
|
||||
+ : INT_MIN / (b) < (a)) \
|
||||
+ : (b) == 0 \
|
||||
+ ? 0 \
|
||||
+ : ((a) < 0 \
|
||||
+ ? (a) < INT_MIN / (b) \
|
||||
+ : INT_MAX / (b) < (a)))
|
||||
+
|
||||
#endif /* __VIR_INTERNAL_H__ */
|
||||
diff --git a/src/libvirt.c b/src/libvirt.c
|
||||
index 1213ecf..6a584fb 100644
|
||||
--- a/src/libvirt.c
|
||||
+++ b/src/libvirt.c
|
||||
@@ -5218,8 +5218,8 @@ virDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
|
||||
|
||||
/* Ensure that domainGetVcpus (aka remoteDomainGetVcpus) does not
|
||||
try to memcpy anything into a NULL pointer. */
|
||||
- if ((cpumaps == NULL && maplen != 0)
|
||||
- || (cpumaps && maplen <= 0)) {
|
||||
+ if (!cpumaps ? maplen != 0
|
||||
+ : (maplen <= 0 || INT_MULTIPLY_OVERFLOW(maxinfo, maplen))) {
|
||||
virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
|
||||
index cb0d8e1..0d9b425 100644
|
||||
--- a/src/remote/remote_driver.c
|
||||
+++ b/src/remote/remote_driver.c
|
||||
@@ -2467,7 +2467,8 @@ remoteDomainGetVcpus (virDomainPtr domain,
|
||||
maxinfo, REMOTE_VCPUINFO_MAX);
|
||||
goto done;
|
||||
}
|
||||
- if (maxinfo * maplen > REMOTE_CPUMAPS_MAX) {
|
||||
+ if (INT_MULTIPLY_OVERFLOW(maxinfo, maplen) ||
|
||||
+ maxinfo * maplen > REMOTE_CPUMAPS_MAX) {
|
||||
remoteError(VIR_ERR_RPC,
|
||||
_("vCPU map buffer length exceeds maximum: %d > %d"),
|
||||
maxinfo * maplen, REMOTE_CPUMAPS_MAX);
|
||||
--
|
||||
1.7.3.4
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,225 +0,0 @@
|
||||
Return-Path: alexl@redhat.com
|
||||
Received: from zmta04.collab.prod.int.phx2.redhat.com (LHLO
|
||||
zmta04.collab.prod.int.phx2.redhat.com) (10.5.81.11) by
|
||||
zmail20.collab.prod.int.phx2.redhat.com with LMTP; Tue, 9 Oct 2012 11:26:38
|
||||
-0400 (EDT)
|
||||
Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
|
||||
by zmta04.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id D4096D0927
|
||||
for <alexl@mail.corp.redhat.com>; Tue, 9 Oct 2012 11:26:38 -0400 (EDT)
|
||||
Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1])
|
||||
by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q99FQV93016417;
|
||||
Tue, 9 Oct 2012 11:26:33 -0400
|
||||
From: Alexander Larsson <alexl@redhat.com>
|
||||
To: libvir-list@redhat.com
|
||||
Cc: Alexander Larsson <alexl@redhat.com>
|
||||
Subject: [PATCH 1/2] virdbus: Add virDBusGetSessionBus helper
|
||||
Date: Tue, 9 Oct 2012 17:26:28 +0200
|
||||
Message-Id: <1349796389-6122-2-git-send-email-alexl@redhat.com>
|
||||
In-Reply-To: <1349796389-6122-1-git-send-email-alexl@redhat.com>
|
||||
References: <1349796389-6122-1-git-send-email-alexl@redhat.com>
|
||||
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
|
||||
|
||||
This splits out some common code from virDBusGetSystemBus and
|
||||
uses it to implement a new virDBusGetSessionBus helper.
|
||||
---
|
||||
src/libvirt_private.syms | 1 +
|
||||
src/util/virdbus.c | 84 ++++++++++++++++++++++++++++++++++++------------
|
||||
src/util/virdbus.h | 1 +
|
||||
3 files changed, 66 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index a8c81e7..88f1b2f 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -1310,6 +1310,7 @@ virConsoleOpen;
|
||||
|
||||
# virdbus.h
|
||||
virDBusGetSystemBus;
|
||||
+virDBusGetSessionBus;
|
||||
|
||||
|
||||
# virdomainlist.h
|
||||
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
|
||||
index 4acce12..2dc7265 100644
|
||||
--- a/src/util/virdbus.c
|
||||
+++ b/src/util/virdbus.c
|
||||
@@ -32,40 +32,49 @@
|
||||
#ifdef HAVE_DBUS
|
||||
|
||||
static DBusConnection *systembus = NULL;
|
||||
-static virOnceControl once = VIR_ONCE_CONTROL_INITIALIZER;
|
||||
-static DBusError dbuserr;
|
||||
+static DBusConnection *sessionbus = NULL;
|
||||
+static virOnceControl systemonce = VIR_ONCE_CONTROL_INITIALIZER;
|
||||
+static virOnceControl sessiononce = VIR_ONCE_CONTROL_INITIALIZER;
|
||||
+static DBusError systemdbuserr;
|
||||
+static DBusError sessiondbuserr;
|
||||
|
||||
static dbus_bool_t virDBusAddWatch(DBusWatch *watch, void *data);
|
||||
static void virDBusRemoveWatch(DBusWatch *watch, void *data);
|
||||
static void virDBusToggleWatch(DBusWatch *watch, void *data);
|
||||
|
||||
-static void virDBusSystemBusInit(void)
|
||||
+static DBusConnection *virDBusBusInit(DBusBusType type, DBusError *dbuserr)
|
||||
{
|
||||
+ DBusConnection *bus;
|
||||
+
|
||||
/* Allocate and initialize a new HAL context */
|
||||
dbus_connection_set_change_sigpipe(FALSE);
|
||||
dbus_threads_init_default();
|
||||
|
||||
- dbus_error_init(&dbuserr);
|
||||
- if (!(systembus = dbus_bus_get(DBUS_BUS_SYSTEM, &dbuserr)))
|
||||
- return;
|
||||
+ dbus_error_init(dbuserr);
|
||||
+ if (!(bus = dbus_bus_get(type, dbuserr)))
|
||||
+ return NULL;
|
||||
|
||||
- dbus_connection_set_exit_on_disconnect(systembus, FALSE);
|
||||
+ dbus_connection_set_exit_on_disconnect(bus, FALSE);
|
||||
|
||||
/* Register dbus watch callbacks */
|
||||
- if (!dbus_connection_set_watch_functions(systembus,
|
||||
+ if (!dbus_connection_set_watch_functions(bus,
|
||||
virDBusAddWatch,
|
||||
virDBusRemoveWatch,
|
||||
virDBusToggleWatch,
|
||||
- NULL, NULL)) {
|
||||
- systembus = NULL;
|
||||
- return;
|
||||
+ bus, NULL)) {
|
||||
+ return NULL;
|
||||
}
|
||||
+ return bus;
|
||||
}
|
||||
|
||||
+static void virDBusSystemBusInit(void)
|
||||
+{
|
||||
+ systembus = virDBusBusInit (DBUS_BUS_SYSTEM, &systemdbuserr);
|
||||
+}
|
||||
|
||||
DBusConnection *virDBusGetSystemBus(void)
|
||||
{
|
||||
- if (virOnce(&once, virDBusSystemBusInit) < 0) {
|
||||
+ if (virOnce(&systemonce, virDBusSystemBusInit) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to run one time DBus initializer"));
|
||||
return NULL;
|
||||
@@ -74,7 +83,7 @@ DBusConnection *virDBusGetSystemBus(void)
|
||||
if (!systembus) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to get DBus system bus connection: %s"),
|
||||
- dbuserr.message ? dbuserr.message : "watch setup failed");
|
||||
+ systemdbuserr.message ? systemdbuserr.message : "watch setup failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -82,13 +91,45 @@ DBusConnection *virDBusGetSystemBus(void)
|
||||
}
|
||||
|
||||
|
||||
+static void virDBusSessionBusInit(void)
|
||||
+{
|
||||
+ sessionbus = virDBusBusInit (DBUS_BUS_SESSION, &sessiondbuserr);
|
||||
+}
|
||||
+
|
||||
+DBusConnection *virDBusGetSessionBus(void)
|
||||
+{
|
||||
+ if (virOnce(&sessiononce, virDBusSessionBusInit) < 0) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("Unable to run one time DBus initializer"));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (!sessionbus) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("Unable to get DBus session bus connection: %s"),
|
||||
+ sessiondbuserr.message ? sessiondbuserr.message : "watch setup failed");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return sessionbus;
|
||||
+}
|
||||
+
|
||||
+struct virDBusWatch
|
||||
+{
|
||||
+ int watch;
|
||||
+ DBusConnection *bus;
|
||||
+};
|
||||
+
|
||||
static void virDBusWatchCallback(int fdatch ATTRIBUTE_UNUSED,
|
||||
int fd ATTRIBUTE_UNUSED,
|
||||
int events, void *opaque)
|
||||
{
|
||||
DBusWatch *watch = opaque;
|
||||
+ struct virDBusWatch *info;
|
||||
int dbus_flags = 0;
|
||||
|
||||
+ info = dbus_watch_get_data(watch);
|
||||
+
|
||||
if (events & VIR_EVENT_HANDLE_READABLE)
|
||||
dbus_flags |= DBUS_WATCH_READABLE;
|
||||
if (events & VIR_EVENT_HANDLE_WRITABLE)
|
||||
@@ -100,7 +141,7 @@ static void virDBusWatchCallback(int fdatch ATTRIBUTE_UNUSED,
|
||||
|
||||
(void)dbus_watch_handle(watch, dbus_flags);
|
||||
|
||||
- while (dbus_connection_dispatch(systembus) == DBUS_DISPATCH_DATA_REMAINS)
|
||||
+ while (dbus_connection_dispatch(info->bus) == DBUS_DISPATCH_DATA_REMAINS)
|
||||
/* keep dispatching while data remains */;
|
||||
}
|
||||
|
||||
@@ -120,18 +161,13 @@ static int virDBusTranslateWatchFlags(int dbus_flags)
|
||||
}
|
||||
|
||||
|
||||
-struct virDBusWatch
|
||||
-{
|
||||
- int watch;
|
||||
-};
|
||||
-
|
||||
static void virDBusWatchFree(void *data) {
|
||||
struct virDBusWatch *info = data;
|
||||
VIR_FREE(info);
|
||||
}
|
||||
|
||||
static dbus_bool_t virDBusAddWatch(DBusWatch *watch,
|
||||
- void *data ATTRIBUTE_UNUSED)
|
||||
+ void *data)
|
||||
{
|
||||
int flags = 0;
|
||||
int fd;
|
||||
@@ -148,6 +184,7 @@ static dbus_bool_t virDBusAddWatch(DBusWatch *watch,
|
||||
# else
|
||||
fd = dbus_watch_get_fd(watch);
|
||||
# endif
|
||||
+ info->bus = (DBusConnection *)data;
|
||||
info->watch = virEventAddHandle(fd, flags,
|
||||
virDBusWatchCallback,
|
||||
watch, NULL);
|
||||
@@ -194,4 +231,11 @@ DBusConnection *virDBusGetSystemBus(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+DBusConnection *virDBusGetSessionBus(void)
|
||||
+{
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ "%s", _("DBus support not compiled into this binary"));
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
#endif /* ! HAVE_DBUS */
|
||||
diff --git a/src/util/virdbus.h b/src/util/virdbus.h
|
||||
index 27dca00..e443fbe 100644
|
||||
--- a/src/util/virdbus.h
|
||||
+++ b/src/util/virdbus.h
|
||||
@@ -30,5 +30,6 @@
|
||||
# include "internal.h"
|
||||
|
||||
DBusConnection *virDBusGetSystemBus(void);
|
||||
+DBusConnection *virDBusGetSessionBus(void);
|
||||
|
||||
#endif /* __VIR_DBUS_H__ */
|
||||
--
|
||||
1.7.12.1
|
||||
|
||||
@@ -1,303 +0,0 @@
|
||||
Return-Path: alexl@redhat.com
|
||||
Received: from zmta06.collab.prod.int.phx2.redhat.com (LHLO
|
||||
zmta06.collab.prod.int.phx2.redhat.com) (10.5.81.13) by
|
||||
zmail20.collab.prod.int.phx2.redhat.com with LMTP; Tue, 9 Oct 2012 11:26:39
|
||||
-0400 (EDT)
|
||||
Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
|
||||
by zmta06.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id D4A8516044F
|
||||
for <alexl@mail.corp.redhat.com>; Tue, 9 Oct 2012 11:26:39 -0400 (EDT)
|
||||
Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1])
|
||||
by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q99FQV94016417;
|
||||
Tue, 9 Oct 2012 11:26:34 -0400
|
||||
From: Alexander Larsson <alexl@redhat.com>
|
||||
To: libvir-list@redhat.com
|
||||
Cc: Alexander Larsson <alexl@redhat.com>
|
||||
Subject: [PATCH 2/2] Shut down session libvirtd cleanly
|
||||
Date: Tue, 9 Oct 2012 17:26:29 +0200
|
||||
Message-Id: <1349796389-6122-3-git-send-email-alexl@redhat.com>
|
||||
In-Reply-To: <1349796389-6122-1-git-send-email-alexl@redhat.com>
|
||||
References: <1349796389-6122-1-git-send-email-alexl@redhat.com>
|
||||
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
|
||||
|
||||
When the session dies or when the system is going to be shut down
|
||||
we save all active VMs and exit libvirtd.
|
||||
|
||||
Additionally whenever there is an active domain we hold a
|
||||
shutdown inhibitor to avoid shutting down before all the
|
||||
VMs are saved.
|
||||
---
|
||||
daemon/libvirtd.c | 244 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 244 insertions(+)
|
||||
|
||||
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
|
||||
index b49acc5..c3bf2ce 100644
|
||||
--- a/daemon/libvirtd.c
|
||||
+++ b/daemon/libvirtd.c
|
||||
@@ -98,6 +98,11 @@
|
||||
|
||||
#include "configmake.h"
|
||||
|
||||
+#ifdef HAVE_DBUS
|
||||
+# include <dbus/dbus.h>
|
||||
+# include "virdbus.h"
|
||||
+#endif
|
||||
+
|
||||
#if HAVE_SASL
|
||||
virNetSASLContextPtr saslCtxt = NULL;
|
||||
#endif
|
||||
@@ -769,6 +774,212 @@ static int daemonSetupSignals(virNetServerPtr srv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_DBUS
|
||||
+
|
||||
+static DBusConnection *sessionBus;
|
||||
+static DBusConnection *systemBus;
|
||||
+static virConnectPtr sessionConnection;
|
||||
+static int numActiveDomains;
|
||||
+static bool hasInhibit;
|
||||
+static bool callingInhibit;
|
||||
+static int inhibitFd = -1;
|
||||
+
|
||||
+static void runSaveAllDomains(void *opaque)
|
||||
+{
|
||||
+ virNetServerPtr srv = opaque;
|
||||
+ int numDomains, i;
|
||||
+ int state;
|
||||
+ virDomainPtr *domains = NULL;
|
||||
+ unsigned int *flags = NULL;
|
||||
+
|
||||
+ numDomains = virConnectListAllDomains(sessionConnection, &domains, VIR_CONNECT_LIST_DOMAINS_ACTIVE);
|
||||
+ if (numDomains < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if (VIR_ALLOC_N(flags, numDomains) < 0) {
|
||||
+ virReportOOMError();
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ /* First we pause all VMs to make them stop dirtying
|
||||
+ pages, etc. We remember if any VMs were paused so
|
||||
+ we can restore that on resume. */
|
||||
+ for (i = 0 ; i < numDomains ; i++) {
|
||||
+ flags[i] = VIR_DOMAIN_SAVE_RUNNING;
|
||||
+ if (virDomainGetState (domains[i], &state, NULL, 0) == 0) {
|
||||
+ if (state == VIR_DOMAIN_PAUSED) {
|
||||
+ flags[i] = VIR_DOMAIN_SAVE_PAUSED;
|
||||
+ }
|
||||
+ }
|
||||
+ virDomainSuspend (domains[i]);
|
||||
+ }
|
||||
+
|
||||
+ /* Then we save the VMs to disk */
|
||||
+ for (i = 0 ; i < numDomains ; i++)
|
||||
+ virDomainManagedSave (domains[i], flags[i]);
|
||||
+
|
||||
+ VIR_FREE (domains);
|
||||
+ VIR_FREE (flags);
|
||||
+
|
||||
+ cleanup:
|
||||
+ if (domains != NULL) {
|
||||
+ for (i = 0 ; i < numDomains ; i++)
|
||||
+ virDomainFree (domains[i]);
|
||||
+ VIR_FREE (domains);
|
||||
+ }
|
||||
+ if (flags != NULL)
|
||||
+ VIR_FREE (flags);
|
||||
+
|
||||
+ /* We don't need any shutdown inhibit lock anymore now */
|
||||
+ if (inhibitFd != -1) {
|
||||
+ if (VIR_CLOSE (inhibitFd) < 0)
|
||||
+ virReportSystemError(errno, "%s", _("failed to close file"));
|
||||
+ inhibitFd = -1;
|
||||
+ }
|
||||
+
|
||||
+ /* Exit libvirtd cleanly */
|
||||
+ virNetServerQuit (srv);
|
||||
+}
|
||||
+
|
||||
+/* We do this in a thread to not block the main loop */
|
||||
+static void saveAllDomains(virNetServerPtr srv)
|
||||
+{
|
||||
+ virThread thr;
|
||||
+ virObjectRef(srv);
|
||||
+ if (virThreadCreate(&thr, false, runSaveAllDomains, srv) < 0) {
|
||||
+ virObjectUnref(srv);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void gotInhibitReply (DBusPendingCall *pending,
|
||||
+ void *opaque ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+ DBusMessage *reply;
|
||||
+ int fd;
|
||||
+
|
||||
+ callingInhibit = false;
|
||||
+
|
||||
+ reply = dbus_pending_call_steal_reply (pending);
|
||||
+ if (reply == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ if (dbus_message_get_args (reply, NULL,
|
||||
+ DBUS_TYPE_UNIX_FD, &fd,
|
||||
+ DBUS_TYPE_INVALID)) {
|
||||
+ if (hasInhibit)
|
||||
+ inhibitFd = fd;
|
||||
+ else {
|
||||
+ /* We stopped the last VM since we made the inhibit call */
|
||||
+ if (VIR_CLOSE (fd) < 0) {
|
||||
+ virReportSystemError(errno, "%s", _("failed to close file"));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ dbus_message_unref (reply);
|
||||
+}
|
||||
+
|
||||
+/* As per: http://www.freedesktop.org/wiki/Software/systemd/inhibit */
|
||||
+static void callInhibit(const char *what,
|
||||
+ const char *who,
|
||||
+ const char *why,
|
||||
+ const char *mode)
|
||||
+{
|
||||
+ DBusMessage *message;
|
||||
+ DBusPendingCall *pendingReply;
|
||||
+
|
||||
+ if (systemBus == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ /* Only one outstanding call at a time */
|
||||
+ if (callingInhibit)
|
||||
+ return;
|
||||
+
|
||||
+ message = dbus_message_new_method_call ("org.freedesktop.login1",
|
||||
+ "/org/freedesktop/login1",
|
||||
+ "org.freedesktop.login1.Manager",
|
||||
+ "Inhibit");
|
||||
+ if (message == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ dbus_message_append_args (message,
|
||||
+ DBUS_TYPE_STRING, &what,
|
||||
+ DBUS_TYPE_STRING, &who,
|
||||
+ DBUS_TYPE_STRING, &why,
|
||||
+ DBUS_TYPE_STRING, &mode,
|
||||
+ DBUS_TYPE_INVALID);
|
||||
+
|
||||
+ pendingReply = NULL;
|
||||
+ if (dbus_connection_send_with_reply (systemBus, message,
|
||||
+ &pendingReply,
|
||||
+ 25*1000)) {
|
||||
+ dbus_pending_call_set_notify (pendingReply,
|
||||
+ gotInhibitReply,
|
||||
+ NULL, NULL);
|
||||
+ callingInhibit = true;
|
||||
+ }
|
||||
+ dbus_message_unref (message);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void numActiveDomainsChanged(void)
|
||||
+{
|
||||
+ if (numActiveDomains > 0 && !hasInhibit) {
|
||||
+ callInhibit("shutdown", _("Libvirt"), _("Virtual machines need to be saved"), "delay");
|
||||
+ hasInhibit = true;
|
||||
+ } else if (numActiveDomains == 0 && hasInhibit) {
|
||||
+ if (inhibitFd != -1) {
|
||||
+ if (VIR_CLOSE (inhibitFd) < 0) {
|
||||
+ virReportSystemError(errno, "%s", _("failed to close file"));
|
||||
+ }
|
||||
+ inhibitFd = -1;
|
||||
+ }
|
||||
+ hasInhibit = false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int lifecycleEventCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
+ virDomainPtr dom ATTRIBUTE_UNUSED,
|
||||
+ int event,
|
||||
+ int detail ATTRIBUTE_UNUSED,
|
||||
+ void *opaque ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+ if (event == VIR_DOMAIN_EVENT_STOPPED)
|
||||
+ numActiveDomains--;
|
||||
+ else if (event == VIR_DOMAIN_EVENT_STARTED)
|
||||
+ numActiveDomains++;
|
||||
+
|
||||
+ numActiveDomainsChanged();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static DBusHandlerResult handleSessionMessageFunc(DBusConnection *connection ATTRIBUTE_UNUSED,
|
||||
+ DBusMessage *message,
|
||||
+ void *userData)
|
||||
+{
|
||||
+ virNetServerPtr srv = userData;
|
||||
+
|
||||
+ if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
|
||||
+ saveAllDomains (srv);
|
||||
+ }
|
||||
+
|
||||
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
+}
|
||||
+
|
||||
+static DBusHandlerResult handleSystemMessageFunc(DBusConnection *connection ATTRIBUTE_UNUSED,
|
||||
+ DBusMessage *message,
|
||||
+ void *userData)
|
||||
+{
|
||||
+ virNetServerPtr srv = userData;
|
||||
+
|
||||
+ if (dbus_message_is_signal(message, "org.freedesktop.login1.Manager", "PrepareForShutdown")) {
|
||||
+ saveAllDomains (srv);
|
||||
+ }
|
||||
+
|
||||
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static void daemonRunStateInit(void *opaque)
|
||||
{
|
||||
virNetServerPtr srv = opaque;
|
||||
@@ -785,6 +996,39 @@ static void daemonRunStateInit(void *opaque)
|
||||
return;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_DBUS
|
||||
+ /* Tie the non-priviledged libvirtd to the session/shutdown lifecycle */
|
||||
+ if (!virNetServerIsPrivileged(srv)) {
|
||||
+
|
||||
+ sessionBus = virDBusGetSessionBus ();
|
||||
+ if (sessionBus != NULL) {
|
||||
+ dbus_connection_add_filter(sessionBus,
|
||||
+ handleSessionMessageFunc, srv, NULL);
|
||||
+ }
|
||||
+
|
||||
+ systemBus = virDBusGetSystemBus ();
|
||||
+ if (systemBus != NULL) {
|
||||
+ dbus_connection_add_filter(systemBus,
|
||||
+ handleSystemMessageFunc, srv, NULL);
|
||||
+ dbus_bus_add_match(systemBus,
|
||||
+ "type='signal',sender='org.freedesktop.login1', interface='org.freedesktop.login1.Manager'",
|
||||
+ NULL);
|
||||
+ }
|
||||
+
|
||||
+ sessionConnection = virConnectOpen("qemu:///session");
|
||||
+ if (sessionConnection != NULL) {
|
||||
+ numActiveDomains = virConnectNumOfDomains(sessionConnection);
|
||||
+ virConnectDomainEventRegisterAny(sessionConnection,
|
||||
+ NULL,
|
||||
+ VIR_DOMAIN_EVENT_ID_LIFECYCLE,
|
||||
+ VIR_DOMAIN_EVENT_CALLBACK (lifecycleEventCallback),
|
||||
+ NULL, NULL);
|
||||
+ numActiveDomainsChanged();
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
/* Only now accept clients from network */
|
||||
virNetServerUpdateServices(srv, true);
|
||||
virObjectUnref(srv);
|
||||
--
|
||||
1.7.12.1
|
||||
|
||||
+236
-1623
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user