[libvirt] [PATCH 0/3] virNetDaemonCallInhibit: check for logind availability
by Ján Tomko
* get rid of a pointless error logged when system D-Bus is not available
* do not send messages on systems without logind
* remove four extra dbus calls on libvirtd startup when checking for
logind availability
Ján Tomko (3):
util: introduce virSystemdHasLogind
util: cache the result of whether logind is available
rpc: make virNetDaemonCallInhibit a no-op with no logind
src/libvirt_private.syms | 2 ++
src/rpc/virnetdaemon.c | 3 +++
src/util/virsystemd.c | 37 ++++++++++++++++++++++++++++++++-----
src/util/virsystemd.h | 2 ++
src/util/virsystemdpriv.h | 1 +
tests/virsystemdtest.c | 3 +++
6 files changed, 43 insertions(+), 5 deletions(-)
--
2.19.2
5 years, 3 months
[libvirt] [PATCH 0/3] quietly ignore missing pm-is-supported
by Ján Tomko
On systems with no logind or pm-is-supported binary, stop spamming
the logs about a missing executable.
Ján Tomko (3):
util: use VIR_AUTOPTR virNodeSuspendSupportsTargetPMUtils
util: do not repeat the pm-is-supported string
util: be quiet when pm-is-supported is unavailable
src/util/virnodesuspend.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
--
2.19.2
5 years, 3 months
[libvirt] [PATCH 0/3] qemu: Allow migration with disk cache on
by Jiri Denemark
QEMU 4.0.0 and newer automatically drops caches at the end of migration,
which means we can safely allow migration even if disk/driver/@cache is
not none nor directsync.
Jiri Denemark (3):
qemu: Clarify error message in qemuMigrationSrcIsSafe
qemu: Check for drop-cache capability
qemu: Allow migration with disk cache on
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_migration.c | 14 +++++++++++---
tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml | 1 +
tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml | 1 +
tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml | 1 +
10 files changed, 21 insertions(+), 3 deletions(-)
--
2.22.1
5 years, 3 months
[libvirt] [PATCH] qemu: Fix crash on incoming migration
by Jiri Denemark
In the first stage of incoming migration (qemuMigrationDstPrepareAny) we
call qemuMigrationEatCookie when there's no vm object created yet and
thus we don't have any private data to pass.
Broken by me in commit v5.6.0-109-gbf15b145ec.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_migration_cookie.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
index da5bc8d05f..25d3fecd74 100644
--- a/src/qemu/qemu_migration_cookie.c
+++ b/src/qemu/qemu_migration_cookie.c
@@ -1507,7 +1507,7 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver,
if (cookiein && cookieinlen &&
qemuMigrationCookieXMLParseStr(mig,
driver,
- priv->qemuCaps,
+ priv ? priv->qemuCaps : NULL,
cookiein,
flags) < 0)
goto error;
--
2.22.1
5 years, 3 months
[libvirt] [PATCH v2 0/2] Revert "configure: Remove --enable-test-coverage"
by Jiri Denemark
Gnulib's make coverage (or init-coverage, build-coverage, gen-coverage)
is not a 1-1 replacement for the original configure option. Our old
--enable-test-coverage seems to be close to gnulib's make build-coverage
except gnulib runs lcov in that phase and the build actually fails for
me even before lcov is run. And since we want to be able to just build
libvirt without running lcov, I suggest reverting to our own
implementation.
I admit the best solution would be to somehow make gnulib support what
we need (and fix the actual build), but I don't feel brave enough to do
that. Eric? :-)
Also if we ever switch to glib and drop gnulib completely, we would need
to reintroduce our own implementation anyway.
I had to do some changes to resolve conflicts. The changes were not too
big, but I figured I'd rather resend this patch especially when I
originally forgot to Cc the original author of the reverted patch.
Jiri Denemark (2):
Revert "configure: Remove --enable-test-coverage"
Revert "docs: hacking: Add 'Code coverage reports' section"
Makefile.am | 20 +++++++++++++++++---
configure.ac | 18 ++++++++++++++++++
docs/hacking.html.in | 29 -----------------------------
src/Makefile.am | 2 ++
src/remote/Makefile.inc.am | 2 ++
tests/Makefile.am | 2 ++
tools/Makefile.am | 6 ++++++
7 files changed, 47 insertions(+), 32 deletions(-)
--
2.22.1
5 years, 3 months
[libvirt] [PATCH] test_driver: implement virDomainSetLifecycleAction
by Ilias Stamatis
Signed-off-by: Ilias Stamatis <stamatis.iliass(a)gmail.com>
---
src/test/test_driver.c | 58 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index aae9875194..71d6baa3da 100755
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -7404,6 +7404,63 @@ testDomainMemoryPeek(virDomainPtr dom,
}
+static void
+testDomainModifyLifecycleAction(virDomainDefPtr def,
+ virDomainLifecycle type,
+ virDomainLifecycleAction action)
+{
+ switch (type) {
+ case VIR_DOMAIN_LIFECYCLE_POWEROFF:
+ def->onPoweroff = action;
+ break;
+ case VIR_DOMAIN_LIFECYCLE_REBOOT:
+ def->onReboot = action;
+ break;
+ case VIR_DOMAIN_LIFECYCLE_CRASH:
+ def->onCrash = action;
+ break;
+ case VIR_DOMAIN_LIFECYCLE_LAST:
+ break;
+ }
+}
+
+
+static int
+testDomainSetLifecycleAction(virDomainPtr dom,
+ unsigned int type,
+ unsigned int action,
+ unsigned int flags)
+{
+ virDomainObjPtr vm = NULL;
+ virDomainDefPtr def = NULL;
+ virDomainDefPtr persistentDef = NULL;
+ int ret = -1;
+
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+ if (!virDomainDefLifecycleActionAllowed(type, action))
+ return -1;
+
+ if (!(vm = testDomObjFromDomain(dom)))
+ return -1;
+
+ if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0)
+ goto cleanup;
+
+ if (def)
+ testDomainModifyLifecycleAction(def, type, action);
+
+ if (persistentDef)
+ testDomainModifyLifecycleAction(persistentDef, type, action);
+
+ ret = 0;
+ cleanup:
+ virDomainObjEndAPI(&vm);
+ return ret;
+}
+
+
/*
* Snapshot APIs
*/
@@ -8698,6 +8755,7 @@ static virHypervisorDriver testHypervisorDriver = {
.domainHasManagedSaveImage = testDomainHasManagedSaveImage, /* 1.1.4 */
.domainManagedSaveRemove = testDomainManagedSaveRemove, /* 1.1.4 */
.domainMemoryPeek = testDomainMemoryPeek, /* 5.4.0 */
+ .domainSetLifecycleAction = testDomainSetLifecycleAction, /* 5.7.0 */
.domainSnapshotNum = testDomainSnapshotNum, /* 1.1.4 */
.domainSnapshotListNames = testDomainSnapshotListNames, /* 1.1.4 */
--
2.22.0
5 years, 3 months
[libvirt] [PATCH v2]daemon: Fix a crash during virNetlinkEventServiceStopAll
by Liu Haitao
When reboot the host, a core dump file would be generated.
The call traces are:
Note.In this case, the main thread is thread 5.
(gdb) thread 5
[Switching to thread 5 (LWP 4142)]
(gdb) bt
0 0x00007f00a6838273 in futex_wait_cancelable (private=<optimized out>,
expected=0, futex_word=0x7f004c0125c0)
at /usr/src/debug/glibc/2.24-r0/git/sysdeps/unix/sysv/linux/futex-internal.h:88
1 __pthread_cond_wait_common (abstime=0x0, mutex=0x7f004c012540,
cond=0x7f004c012598)
at /usr/src/debug/glibc/2.24-r0/git/nptl/pthread_cond_wait.c:502
2 __pthread_cond_wait (cond=0x7f004c012598, mutex=0x7f004c012540)
at /usr/src/debug/glibc/2.24-r0/git/nptl/pthread_cond_wait.c:655
3 0x00007f00aa467246 in virCondWait (c=<optimized out>, m=<optimized out>)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virthread.c:154
4 0x00007f00aa467eb0 in virThreadPoolFree (pool=<optimized out>)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virthreadpool.c:286
5 0x00007f0074349f9d in qemuStateCleanup ()
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/qemu/qemu_driver.c:1036
6 0x00007f00aa5e9486 in virStateCleanup ()
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/libvirt.c:682
7 0x000055a687ab86a4 in main (argc=<optimized out>, argv=<optimized out>)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/remote/remote_daemon.c:1473
(gdb) thread 1
[Switching to thread 1 (LWP 4403)]
(gdb) bt
0 __GI___pthread_mutex_lock (mutex=mutex@entry=0x0)
at /usr/src/debug/glibc/2.24-r0/git/nptl/pthread_mutex_lock.c:67
1 0x00007f00aa467165 in virMutexLock (m=m@entry=0x0)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virthread.c:89
2 0x00007f00aa43c0f9 in virNetlinkEventServerLock (driver=<optimized out>)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virnetlink.c:799
3 virNetlinkEventRemoveClient (watch=watch@entry=0,
macaddr=macaddr@entry=0x7f0088014944, protocol=protocol@entry=0)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virnetlink.c:1197
4 0x00007f00aa4341df in virNetDevMacVLanDeleteWithVPortProfile (
ifname=<optimized out>, macaddr=macaddr@entry=0x7f0088014944,
linkdev=0x7f0088014920 "eth1", mode=mode@entry=1,
virtPortProfile=virtPortProfile@entry=0x0,
stateDir=stateDir@entry=0x7f004c12fa90 "/var/run/libvirt/qemu")
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virnetdevmacvlan.c:1112
5 0x00007f0074312251 in qemuProcessStop (driver=driver@entry=0x7f004c0ecef0,
vm=vm@entry=0x7f0088000b00,
reason=reason@entry=VIR_DOMAIN_SHUTOFF_SHUTDOWN,
asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_NONE, flags=<optimized out>)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/qemu/qemu_process.c:7291
6 0x00007f007437a5ea in processMonitorEOFEvent (vm=0x7f0088000b00, driver=0x7f004c0ecef0)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/qemu/qemu_driver.c:4756
7 qemuProcessEventHandler (data=0x55a687d6df10, opaque=0x7f004c0ecef0)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/qemu/qemu_driver.c:4859
8 0x00007f00aa467c5b in virThreadPoolWorker (
opaque=opaque@entry=0x55a687d6c110)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virthreadpool.c:163
9 0x00007f00aa466fe8 in virThreadHelper (data=<optimized out>)
at /usr/src/debug/libvirt/5.3.0-r0/libvirt-5.3.0/src/util/virthread.c:206
10 0x00007f00a68323f4 in start_thread (arg=0x7f00699df700)
at /usr/src/debug/glibc/2.24-r0/git/nptl/pthread_create.c:456
11 0x00007f00a616e10f in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105
1. The execution flow of main thread (Thread 5 LWP 4142):
main()
-->virNetDaemonRun()
-->virNetDaemonClose(dmn) //cleanup
-->virNetlinkEventServiceStopAll()
-->virStateCleanup()
-->qemuStateCleanup()
-->virThreadPoolFree()
-->__pthread_cond_wait()
virNetDaemonRun()
-->virEventRunDefaultImpl
-->virEventPollRunOnce
-->virEventPollDispatchHandles
-->qemuMonitorIO
-->qemuProcessHandleMonitorEOF
-->processEvent->eventType = QEMU_PROCESS_EVENT_MONITOR_EOF
-->virThreadPoolSendJob()
After typing reboot command on the host, the main thread would send an event message to another thread.
Here it would let thread 1 to handle the shutdown of qemu process. But it could
not be executed immediately.
virNetlinkEventServiceStopAll()
--> virNetlinkEventServiceStop()
--> server[protocol] = NULL; // set server to null
IN virNetlinkEventServiceStopAll(), some variables related to network are freed,
like (static virNetlinkEventSrvPrivatePtr server).
virStateCleanup()
-->qemuStateCleanup()
-->virThreadPoolFree()
-->__pthread_cond_wait()
In virThreadPoolFree() it will wait other thread to end up.
2. The execution flow of thread 5 (LWP 4403):
qemuProcessStop()
-->virNetDevMacVLanDeleteWithVPortProfile()
-->virNetlinkEventRemoveClient()
--> srv = server[protocol]
Although the main thread had sent the message to thread 1(4403), it could not be
run instantly. It means that the virNetlinkEventServiceStopAll() might be
executed earlier than virNetlinkEventRemoveClient(). We could get it from the log file.
""
2019-06-12 00:10:09.230+0000: 4142: info : virNetlinkEventServiceStopAll:941 : stopping all netlink event services
2019-06-12 00:10:09.230+0000: 4142: info : virNetlinkEventServiceStop:904 : stopping netlink event service
2019-06-12 00:10:21.165+0000: 4403: debug : virNetlinkEventRemoveClient:1190 : removing client watch=0, mac=0x7f0088014944.
"
In virNetlinkEventRemoveClient() the variable server is used again, but now it
is null that is freed by virNetlinkEventServiceStopAll().So it would case a crash .
The virNetlinkEventServiceStopAll() should be executed behind virStateCleanup(),
Signed-off-by: Liu Haitao <haitao.liu(a)windriver.com>
---
src/remote/remote_daemon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index c3782971f1..7da20a6644 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -1464,8 +1464,6 @@ int main(int argc, char **argv) {
/* Keep cleanup order in inverse order of startup */
virNetDaemonClose(dmn);
- virNetlinkEventServiceStopAll();
-
if (driversInitialized) {
/* NB: Possible issue with timing window between driversInitialized
* setting if virNetlinkEventServerStart fails */
@@ -1473,6 +1471,8 @@ int main(int argc, char **argv) {
virStateCleanup();
}
+ virNetlinkEventServiceStopAll();
+
virObjectUnref(adminProgram);
virObjectUnref(srvAdm);
virObjectUnref(qemuProgram);
--
2.21.0
5 years, 3 months
[libvirt] [PATCH] Revert "tpm: Check TPM XML device configuration changes after edit"
by Ján Tomko
Redefining a domain via virDomainDefineXML should not give different results
based on an already existing definition.
Also, there's a crasher somewhere in the code:
https://bugzilla.redhat.com/show_bug.cgi?id=1739338
This reverts commit 94b3aa55f83ada33a9fdda66068d58ef1a56c0a5
---
src/conf/domain_conf.c | 56 ---------------------------------------
src/conf/domain_conf.h | 3 ---
src/libvirt_private.syms | 1 -
src/qemu/qemu_driver.c | 28 --------------------
src/qemu/qemu_extdevice.c | 2 +-
src/qemu/qemu_extdevice.h | 3 ---
6 files changed, 1 insertion(+), 92 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0456369d55..f54acd0c2a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31461,59 +31461,3 @@ virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef *graphics)
return true;
}
-
-
-static int
-virDomainCheckTPMChanges(virDomainDefPtr def,
- virDomainDefPtr newDef)
-{
- bool oldEnc, newEnc;
-
- if (!def->tpm)
- return 0;
-
- switch (def->tpm->type) {
- case VIR_DOMAIN_TPM_TYPE_EMULATOR:
- if (virFileExists(def->tpm->data.emulator.storagepath)) {
- /* VM has been started */
- /* Once a VM was started with an encrypted state we allow
- * less configuration changes.
- */
- oldEnc = def->tpm->data.emulator.hassecretuuid;
- if (oldEnc && def->tpm->type != newDef->tpm->type) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Changing the type of TPM is not allowed"));
- return -1;
- }
- if (oldEnc && !newDef->tpm) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Removing an encrypted TPM is not allowed"));
- return -1;
- }
- newEnc = newDef->tpm->data.emulator.hassecretuuid;
- if (oldEnc != newEnc) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("TPM state encryption cannot be changed "
- "once VM was started"));
- return -1;
- }
- }
- break;
- case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
- case VIR_DOMAIN_TPM_TYPE_LAST:
- break;
- }
-
- return 0;
-}
-
-
-int
-virDomainCheckDeviceChanges(virDomainDefPtr def,
- virDomainDefPtr newDef)
-{
- if (!def || !newDef)
- return 0;
-
- return virDomainCheckTPMChanges(def, newDef);
-}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 57ca2a8ad1..2d7350e675 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3641,6 +3641,3 @@ virDomainGraphicsGetRenderNode(const virDomainGraphicsDef *graphics);
bool
virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef *graphics);
-
-int
-virDomainCheckDeviceChanges(virDomainDefPtr def, virDomainDefPtr newDef);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index cae8febf8d..7a3feb8efa 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -217,7 +217,6 @@ virDomainBootTypeFromString;
virDomainBootTypeToString;
virDomainCapabilitiesPolicyTypeToString;
virDomainCapsFeatureTypeToString;
-virDomainCheckDeviceChanges;
virDomainChrConsoleTargetTypeFromString;
virDomainChrConsoleTargetTypeToString;
virDomainChrDefForeach;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ff83d1c024..0fccf3dc37 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -53,7 +53,6 @@
#include "qemu_migration_params.h"
#include "qemu_blockjob.h"
#include "qemu_security.h"
-#include "qemu_extdevice.h"
#include "virerror.h"
#include "virlog.h"
@@ -7760,30 +7759,6 @@ qemuDomainCreate(virDomainPtr dom)
return qemuDomainCreateWithFlags(dom, 0);
}
-static int
-qemuDomainCheckDeviceChanges(virQEMUDriverPtr driver,
- virDomainDefPtr def)
-{
- virDomainObjPtr vm;
- int ret;
-
- vm = virDomainObjListFindByUUID(driver->domains, def->uuid);
- if (!vm)
- return 0;
-
- if (qemuExtDevicesInitPaths(driver, vm->def) < 0) {
- ret = -1;
- goto cleanup;
- }
-
- ret = virDomainCheckDeviceChanges(vm->def, def);
-
- cleanup:
- virDomainObjEndAPI(&vm);
-
- return ret;
-}
-
static virDomainPtr
qemuDomainDefineXMLFlags(virConnectPtr conn,
const char *xml,
@@ -7820,9 +7795,6 @@ qemuDomainDefineXMLFlags(virConnectPtr conn,
if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0)
goto cleanup;
- if (qemuDomainCheckDeviceChanges(driver, def) < 0)
- goto cleanup;
-
if (!(vm = virDomainObjListAdd(driver->domains, def,
driver->xmlopt,
0, &oldDef)))
diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c
index af52466421..dc032aa60c 100644
--- a/src/qemu/qemu_extdevice.c
+++ b/src/qemu/qemu_extdevice.c
@@ -79,7 +79,7 @@ qemuExtDeviceLogCommand(qemuDomainLogContextPtr logCtxt,
* stored and we can remove directories and files in case of domain XML
* changes.
*/
-int
+static int
qemuExtDevicesInitPaths(virQEMUDriverPtr driver,
virDomainDefPtr def)
{
diff --git a/src/qemu/qemu_extdevice.h b/src/qemu/qemu_extdevice.h
index 5a53c79f38..039b3e60dd 100644
--- a/src/qemu/qemu_extdevice.h
+++ b/src/qemu/qemu_extdevice.h
@@ -54,6 +54,3 @@ bool qemuExtDevicesHasDevice(virDomainDefPtr def);
int qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver,
virDomainDefPtr def,
virCgroupPtr cgroup);
-
-int qemuExtDevicesInitPaths(virQEMUDriverPtr driver,
- virDomainDefPtr def);
--
2.19.2
5 years, 3 months
[libvirt] [PATCH v2 0/5] test_driver: implement IOThread related APIs
by Ilias Stamatis
Changes since v1:
- Use vm-private data for storing iothread parameters and implement virDomainSetIOThreadParams
Ilias Stamatis (5):
test_driver: implement virDomainAddIOThread
test_driver: implement virDomainDelIOThread
test_driver: implement virDomainPinIOThread
test_driver: implement virDomainGetIOThreadInfo
test_driver: implement virDomainSetIOThreadParams
src/test/test_driver.c | 362 +++++++++++++++++++++++++++++++++++++++++
src/test/test_driver.h | 11 ++
2 files changed, 373 insertions(+)
--
2.22.0
5 years, 3 months