[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] qemu: Allow domain reboot after core dump



yes, the patch can work, when I execute virsh dump --reboot <domain> <file>

and the type of file is: QEMU's suspend to disk image

but the guest does not reboot. The guest does nothing.

but I try  virsh shutdown <domain>,  the guest Ubuntu OS pop up a dialog box with four options: Shut Down, Restart, Suspend and HIbernate.

-------- 原始信息 --------
主题: [libvirt] [PATCH] qemu: Allow domain reboot after core dump
日期: Tue, 20 Sep 2011 13:34:27 +0200
发件人: Michal Privoznik <mprivozn redhat com>
收件人: libvir-list redhat com


This patch introduces possibility to reboot domain after core dump
finishes. The new flag VIR_DUMP_REBOOT was added to
virDomainCoreDumpFlags. The new functionality is accessible via virsh
too: virsh dump --reboot <domain>
---
 include/libvirt/libvirt.h.in |    1 +
 src/qemu/qemu_driver.c       |    8 +++++++-
 tools/virsh.c                |    3 +++
 3 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 39155a6..8c41f5a 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -748,6 +748,7 @@ typedef enum {
     VIR_DUMP_CRASH        = (1 << 0), /* crash after dump */
     VIR_DUMP_LIVE         = (1 << 1), /* live dump */
     VIR_DUMP_BYPASS_CACHE = (1 << 2), /* avoid file system cache pollution */
+    VIR_DUMP_REBOOT       = (1 << 3), /* reboot domain after dump finishes */
 } virDomainCoreDumpFlags;

 /* Domain migration flags. */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e2f428f..22576a8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3104,7 +3104,8 @@ static int qemudDomainCoreDump(virDomainPtr dom,
     int ret = -1;
     virDomainEventPtr event = NULL;

-    virCheckFlags(VIR_DUMP_LIVE | VIR_DUMP_CRASH | VIR_DUMP_BYPASS_CACHE, -1);
+    virCheckFlags(VIR_DUMP_LIVE | VIR_DUMP_CRASH |
+                  VIR_DUMP_BYPASS_CACHE | VIR_DUMP_REBOOT, -1);

     qemuDriverLock(driver);
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@@ -3189,6 +3190,11 @@ cleanup:
     if (event)
         qemuDomainEventQueue(driver, event);
     qemuDriverUnlock(driver);
+
+    if ((ret == 0) && (flags & VIR_DUMP_REBOOT)) {
+        qemuDomainReboot(dom, 0);
+    }
+
     return ret;
 }

diff --git a/tools/virsh.c b/tools/virsh.c
index d575425..74f6a79 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -2840,6 +2840,7 @@ static const vshCmdOptDef opts_dump[] = {
     {"crash", VSH_OT_BOOL, 0, N_("crash the domain after core dump")},
     {"bypass-cache", VSH_OT_BOOL, 0,
      N_("avoid file system cache when saving")},
+    {"reboot", VSH_OT_BOOL, 0, N_("reboot the domain after core dump")},
     {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
     {"file", VSH_OT_DATA, VSH_OFLAG_REQ, N_("where to dump the core")},
     {NULL, 0, 0, NULL}
@@ -2869,6 +2870,8 @@ cmdDump(vshControl *ctl, const vshCmd *cmd)
         flags |= VIR_DUMP_CRASH;
     if (vshCommandOptBool(cmd, "bypass-cache"))
         flags |= VIR_DUMP_BYPASS_CACHE;
+    if (vshCommandOptBool(cmd, "reboot"))
+        flags |= VIR_DUMP_REBOOT;

     if (virDomainCoreDump(dom, to, flags) < 0) {
         vshError(ctl, _("Failed to core dump domain %s to %s"), name, to);
-- 
1.7.3.4

--
libvir-list mailing list
libvir-list redhat com
https://www.redhat.com/mailman/listinfo/libvir-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]