diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 2dd3d06d91f3ea2029ff105e9992bd1d70f6d818..6c3adede77493052ebab8dad2a7667cfdf674646 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -337,6 +337,7 @@ typedef virDomainInterfaceStatsStruct *virDomainInterfaceStatsPtr; /* Domain core dump flags. */ typedef enum { VIR_DUMP_CRASH = (1 << 0), /* crash after dump */ + VIR_DUMP_LIVE = (1 << 1), /* live dump */ } virDomainCoreDumpFlags; /* Domain migration flags. */ diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 34fa582cb116d5a140f55db2b903308b3eb7bf25..3946c27665692d715e50fa52b14cde2fb3847335 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3856,15 +3856,14 @@ static int qemudDomainCoreDump(virDomainPtr dom, driver->securityDriver->domainSetSavedStateLabel(dom->conn, vm, path) == -1) goto endjob; - /* Migrate will always stop the VM, so once we support live dumping - the resume condition will stay the same, independent of whether - the stop command is issued. */ + /* Migrate will always stop the VM, so the resume condition is + independent of whether the stop command is issued. */ resume = (vm->state == VIR_DOMAIN_RUNNING); qemuDomainObjPrivatePtr priv = vm->privateData; /* Pause domain for non-live dump */ - if (vm->state == VIR_DOMAIN_RUNNING) { + if (!(flags & VIR_DUMP_LIVE) && vm->state == VIR_DOMAIN_RUNNING) { qemuDomainObjEnterMonitor(vm); if (qemuMonitorStopCPUs(priv->mon) < 0) { qemuDomainObjExitMonitor(vm); diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index 3ce4dc338ad378e61e8c3fd33523b3cdc565bfb4..d0142d1e520d409577b6773eb3c72bf1039fecf8 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -3255,6 +3255,7 @@ xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename, return xend_op(domain->conn, domain->name, "op", "dump", "file", filename, "live", "0", + "live", (flags & VIR_DUMP_LIVE ? "1" : "0"), "crash", (flags & VIR_DUMP_CRASH ? "1" : "0"), NULL); } diff --git a/tools/virsh.c b/tools/virsh.c index 62c127072e32be96dc046c8723c1d7a13950753c..9c9cd1ed11872fda54f83ab8a8068f38b8650288 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1431,6 +1431,7 @@ static const vshCmdInfo info_dump[] = { }; static const vshCmdOptDef opts_dump[] = { + {"live", VSH_OT_BOOL, 0, gettext_noop("perform a live core dump if supported")}, {"crash", VSH_OT_BOOL, 0, gettext_noop("crash the domain after core dump")}, {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")}, {"file", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("where to dump the core")}, @@ -1455,6 +1456,8 @@ cmdDump(vshControl *ctl, const vshCmd *cmd) if (!(dom = vshCommandOptDomain(ctl, cmd, &name))) return FALSE; + if (vshCommandOptBool (cmd, "live")) + flags |= VIR_DUMP_LIVE; if (vshCommandOptBool (cmd, "crash")) flags |= VIR_DUMP_CRASH;