diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2011-05-10 16:26:05 +0800 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-05-10 11:40:51 -0600 |
commit | a083d44c87fd0bedccb2b8d06f461dcf3a69e9cf (patch) | |
tree | e4d47d2f4715ae0f85fe2c9660bf878d992a7cac /tools/virsh.c | |
parent | inject-nmi: Implementing the remote protocol (diff) | |
download | libvirt-a083d44c87fd0bedccb2b8d06f461dcf3a69e9cf.tar.gz libvirt-a083d44c87fd0bedccb2b8d06f461dcf3a69e9cf.tar.bz2 libvirt-a083d44c87fd0bedccb2b8d06f461dcf3a69e9cf.zip |
inject-nmi: Expose the new API in virsh
Diffstat (limited to 'tools/virsh.c')
-rw-r--r-- | tools/virsh.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/virsh.c b/tools/virsh.c index 8b5572c81..fbeb7c88f 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2912,6 +2912,40 @@ 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 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 */ static const vshCmdInfo info_setmem[] = { @@ -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}, |