]> xenbits.xensource.com Git - libvirt.git/commitdiff
inject-nmi: Expose the new API in virsh
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 10 May 2011 08:26:05 +0000 (16:26 +0800)
committerEric Blake <eblake@redhat.com>
Tue, 10 May 2011 17:40:51 +0000 (11:40 -0600)
tools/virsh.c
tools/virsh.pod

index 8b5572c8109990b01e19cd4defd7bc77b554790f..fbeb7c88f0f1b8435efd048a8223d17ba914a792 100644 (file)
@@ -2911,6 +2911,40 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
     return ret;
 }
 
+/*
+ * "inject-nmi" command
+ */
+static const vshCmdInfo info_inject_nmi[] = {
+    {"help", N_("Inject NMI to the guest")},
+    {"desc", N_("Inject NMI to the guest domain.")},
+    {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_inject_nmi[] = {
+    {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
+    {NULL, 0, 0, NULL}
+};
+
+
+static bool
+cmdInjectNMI(vshControl *ctl, const vshCmd *cmd)
+{
+    virDomainPtr dom;
+    int ret = true;
+
+    if (!vshConnectionUsability(ctl, ctl->conn))
+        return false;
+
+    if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
+        return false;
+
+    if (virDomainInjectNMI(dom, 0) < 0)
+            ret = false;
+
+    virDomainFree(dom);
+    return ret;
+}
+
 /*
  * "setmemory" command
  */
@@ -10720,6 +10754,7 @@ static const vshCmdDef domManagementCmds[] = {
     {"setmaxmem", cmdSetmaxmem, opts_setmaxmem, info_setmaxmem},
     {"setmem", cmdSetmem, opts_setmem, info_setmem},
     {"setvcpus", cmdSetvcpus, opts_setvcpus, info_setvcpus},
+    {"inject-nmi", cmdInjectNMI, opts_inject_nmi, info_inject_nmi},
     {"shutdown", cmdShutdown, opts_shutdown, info_shutdown},
     {"start", cmdStart, opts_start, info_start},
     {"suspend", cmdSuspend, opts_suspend, info_suspend},
index 2a708f66035b7a3576d41be432f1098ce79d89bb..f317c5729a72442fe2b585d1456a8ab89ec8baa2 100644 (file)
@@ -290,6 +290,10 @@ running B<virsh suspend>.  When in a paused state the domain will still
 consume allocated resources like memory, but will not be eligible for
 scheduling by the hypervisor.
 
+=item B<inject-nmi> I<domain-id>
+
+Inject NMI to the guest
+
 =item B<shutdown>
 
 The domain is in the process of shutting down, i.e. the guest operating system