--- tools/virsh-domain.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index e3f7220..98b6870 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -1665,7 +1665,6 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) } typedef enum { - VSH_CMD_BLOCK_JOB_ABORT, VSH_CMD_BLOCK_JOB_PULL, VSH_CMD_BLOCK_JOB_COMMIT, } vshCmdBlockJobMode; @@ -1692,14 +1691,6 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd, goto cleanup; switch (mode) { - case VSH_CMD_BLOCK_JOB_ABORT: - if (vshCommandOptBool(cmd, "async")) - flags |= VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC; - if (vshCommandOptBool(cmd, "pivot")) - flags |= VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT; - if (virDomainBlockJobAbort(dom, path, flags) < 0) - goto cleanup; - break; case VSH_CMD_BLOCK_JOB_PULL: if (vshCommandOptStringReq(ctl, cmd, "base", &base) < 0) goto cleanup; @@ -2552,6 +2543,26 @@ vshBlockJobSetSpeed(vshControl *ctl, static bool +vshBlockJobAbort(virDomainPtr dom, + const char *path, + bool pivot, + bool async) +{ + unsigned int flags = 0; + + if (async) + flags |= VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC; + if (pivot) + flags |= VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT; + + if (virDomainBlockJobAbort(dom, path, flags) < 0) + return false; + + return true; +} + + +static bool cmdBlockJob(vshControl *ctl, const vshCmd *cmd) { bool ret = false; @@ -2581,9 +2592,6 @@ cmdBlockJob(vshControl *ctl, const vshCmd *cmd) /* XXX also support --bytes with bandwidth mode */ VSH_EXCLUSIVE_OPTIONS_VAR(bytes, bandwidth); - if (abort || pivot || async) - return blockJobImpl(ctl, cmd, VSH_CMD_BLOCK_JOB_ABORT, NULL); - if (!(dom = vshCommandOptDomain(ctl, cmd, NULL))) goto cleanup; @@ -2593,6 +2601,8 @@ cmdBlockJob(vshControl *ctl, const vshCmd *cmd) if (bandwidth) ret = vshBlockJobSetSpeed(ctl, cmd, dom, path); + else if (abort || pivot || async) + ret = vshBlockJobAbort(dom, path, pivot, async); else ret = vshBlockJobInfo(ctl, dom, path, raw, bytes); -- 2.4.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list