On 03.02.2012 20:16, Laine Stump wrote:
This allows virsh to use the new VIR_DOMAIN_DESTROY_GRACEUL flag for
virDomainDestroyFlags.
---
tools/virsh.c | 7 ++++++-
tools/virsh.pod | 6 +++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 42985a9..3478185 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -4264,6 +4264,7 @@ static const vshCmdInfo info_destroy[] = {
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_("needs rawio
capability")},
{NULL, 0, 0, NULL}
};
@@ -4273,6 +4274,7 @@ cmdDestroy(vshControl *ctl, const vshCmd *cmd)
virDomainPtr dom;
bool ret = true;
const char *name;
+ unsigned int flags = 0;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
@@ -4280,7 +4282,10 @@ cmdDestroy(vshControl *ctl, const vshCmd *cmd)
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
- if (virDomainDestroy(dom) == 0) {
+ if (vshCommandOptBool(cmd, "graceful"))
+ flags |= VIR_DOMAIN_DESTROY_GRACEFUL;
+
+ if (virDomainDestroyFlags(dom, flags) == 0) {
NACK. This would break communication to those daemons which don't know
virDomainDestroyFlags(); In fact, we need this:
if (flags)
virDomainDestroyFlags();
else
virDomainDestroy();