]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Expose virDomainPMWakeup
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 10 Feb 2012 12:07:24 +0000 (13:07 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 27 Feb 2012 10:44:10 +0000 (11:44 +0100)
tools/virsh.c
tools/virsh.pod

index 66bbb0c9b2fa3ac78169ce52c23e36fa2440c4d2..f5a1cb4339779235a82eac39cf47981ff94e8956 100644 (file)
@@ -2527,6 +2527,52 @@ cleanup:
     return ret;
 }
 
+/*
+ * "dompmwakeup" command
+ */
+
+static const vshCmdInfo info_dom_pm_wakeup[] = {
+    {"help", N_("wakeup a domain suspended by dompmsuspend command")},
+    {"desc", N_("Wakeup a domain previously suspended "
+                "by dompmsuspend command.")},
+    {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_dom_pm_wakeup[] = {
+    {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
+    {NULL, 0, 0, NULL}
+};
+
+static bool
+cmdDomPMWakeup(vshControl *ctl, const vshCmd *cmd)
+{
+    virDomainPtr dom;
+    const char *name;
+    bool ret = false;
+    unsigned int flags = 0;
+
+    if (!vshConnectionUsability(ctl, ctl->conn))
+        return false;
+
+    if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
+        return false;
+
+    if (virDomainPMWakeup(dom, flags) < 0) {
+        vshError(ctl, _("Domain %s could not be woken up"),
+                 virDomainGetName(dom));
+        goto cleanup;
+    }
+
+    vshPrint(ctl, _("Domain %s successfully woken up"),
+             virDomainGetName(dom));
+
+    ret = true;
+
+cleanup:
+    virDomainFree(dom);
+    return ret;
+}
+
 /*
  * "create" command
  */
@@ -16554,6 +16600,8 @@ static const vshCmdDef domManagementCmds[] = {
     {"domname", cmdDomname, opts_domname, info_domname, 0},
     {"dompmsuspend", cmdDomPMSuspend,
      opts_dom_pm_suspend, info_dom_pm_suspend, 0},
+    {"dompmwakeup", cmdDomPMWakeup,
+     opts_dom_pm_wakeup, info_dom_pm_wakeup, 0},
     {"domuuid", cmdDomuuid, opts_domuuid, info_domuuid, 0},
     {"domxml-from-native", cmdDomXMLFromNative, opts_domxmlfromnative,
      info_domxmlfromnative, 0},
index 2956c815cdc83d892dfdd96f9af738efc9be12f1..6f06b16179ff8d826fe8368e9a6b41d17721817d 100644 (file)
@@ -1313,6 +1313,12 @@ values):
     disk equivallent of S4 ACPI state
     hybrid RAM is saved to disk but not powered off
 
+=item B<dompmwakeup> I<domain-id>
+
+Wakeup a domain suspended by dompmsuspend command. Injects a wakeup
+into the guest that previously used dompmsuspend, rather than waiting
+for the previously requested duration (if any) to elapse.
+
 =item B<ttyconsole> I<domain-id>
 
 Output the device used for the TTY console of the domain. If the information