--- tools/virsh.c | 36 ++++++++++++++++++++++++++++++++++++ tools/virsh.pod | 4 ++++ 2 files changed, 40 insertions(+), 0 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 2e35021..5e3df8a 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2919,6 +2919,41 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd) } /* + * "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 int +cmdInjectNMI(vshControl *ctl, const vshCmd *cmd) +{ + virDomainPtr dom; + const char *type; + 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 */ static const vshCmdInfo info_setmem[] = { @@ -10733,6 +10768,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}, diff --git a/tools/virsh.pod b/tools/virsh.pod index 2a708f6..f317c57 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -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 -- 1.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list