static const vshCmdOptDef opts_destroy[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
+ {"graceful", VSH_OT_BOOL, VSH_OFLAG_NONE, N_("terminate gracefully")},
{NULL, 0, 0, NULL}
};
virDomainPtr dom;
bool ret = true;
const char *name;
+ unsigned int flags = 0;
+ int result;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
- if (virDomainDestroy(dom) == 0) {
+ if (vshCommandOptBool(cmd, "graceful"))
+ flags |= VIR_DOMAIN_DESTROY_GRACEFUL;
+
+ if (flags)
+ result = virDomainDestroyFlags(dom, VIR_DOMAIN_DESTROY_GRACEFUL);
+ else
+ result = virDomainDestroy(dom);
+
+ if (result == 0) {
vshPrint(ctl, _("Domain %s destroyed\n"), name);
} else {
vshError(ctl, _("Failed to destroy domain %s"), name);
If neither of I<--edit> and I<--new_desc> are specified the note or description
is displayed instead of being modified.
-=item B<destroy> I<domain-id>
+=item B<destroy> I<domain-id> [I<--graceful>]
Immediately terminate the domain domain-id. This doesn't give the domain
OS any chance to react, and it's the equivalent of ripping the power
exist, and a new domain with the same name and UUID can restore the
snapshot metadata with B<snapshot-create>.
+If I<--graceful> is specified, don't resort to extreme measures
+(e.g. SIGKILL) when the guest doesn't stop after a reasonable timeout;
+return an error instead.
+
=item B<domblkstat> I<domain> I<block-device> [I<--human>]
Get device block stats for a running domain. A I<block-device> corresponds