|
|
7a3408 |
From d810a5a1890c7e0593fe914a4e5252963c758b69 Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <d810a5a1890c7e0593fe914a4e5252963c758b69@dist-git>
|
|
|
7a3408 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
7a3408 |
Date: Tue, 21 Jul 2015 16:18:25 +0200
|
|
|
7a3408 |
Subject: [PATCH] virsh: blockjob: Split out vshBlockJobSetSpeed from
|
|
|
7a3408 |
blockJobImpl
|
|
|
7a3408 |
|
|
|
7a3408 |
https://bugzilla.redhat.com/show_bug.cgi?id=1227551
|
|
|
7a3408 |
https://bugzilla.redhat.com/show_bug.cgi?id=1197592
|
|
|
7a3408 |
|
|
|
7a3408 |
(cherry picked from commit 42c9c6fcfcff88b6a8cc1261db46fb90e0fe7264)
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
---
|
|
|
7a3408 |
tools/virsh-domain.c | 31 ++++++++++++++++++++++---------
|
|
|
7a3408 |
1 file changed, 22 insertions(+), 9 deletions(-)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
|
|
|
7a3408 |
index 9a7cb84..fcb3121 100644
|
|
|
7a3408 |
--- a/tools/virsh-domain.c
|
|
|
7a3408 |
+++ b/tools/virsh-domain.c
|
|
|
7a3408 |
@@ -1666,7 +1666,6 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
|
|
|
7a3408 |
|
|
|
7a3408 |
typedef enum {
|
|
|
7a3408 |
VSH_CMD_BLOCK_JOB_ABORT,
|
|
|
7a3408 |
- VSH_CMD_BLOCK_JOB_SPEED,
|
|
|
7a3408 |
VSH_CMD_BLOCK_JOB_PULL,
|
|
|
7a3408 |
VSH_CMD_BLOCK_JOB_COMMIT,
|
|
|
7a3408 |
} vshCmdBlockJobMode;
|
|
|
7a3408 |
@@ -1701,10 +1700,6 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd,
|
|
|
7a3408 |
if (virDomainBlockJobAbort(dom, path, flags) < 0)
|
|
|
7a3408 |
goto cleanup;
|
|
|
7a3408 |
break;
|
|
|
7a3408 |
- case VSH_CMD_BLOCK_JOB_SPEED:
|
|
|
7a3408 |
- if (virDomainBlockJobSetSpeed(dom, path, bandwidth, 0) < 0)
|
|
|
7a3408 |
- goto cleanup;
|
|
|
7a3408 |
- break;
|
|
|
7a3408 |
case VSH_CMD_BLOCK_JOB_PULL:
|
|
|
7a3408 |
if (vshCommandOptStringReq(ctl, cmd, "base", &base) < 0)
|
|
|
7a3408 |
goto cleanup;
|
|
|
7a3408 |
@@ -2537,6 +2532,24 @@ vshBlockJobInfo(vshControl *ctl,
|
|
|
7a3408 |
|
|
|
7a3408 |
|
|
|
7a3408 |
static bool
|
|
|
7a3408 |
+vshBlockJobSetSpeed(vshControl *ctl,
|
|
|
7a3408 |
+ const vshCmd *cmd,
|
|
|
7a3408 |
+ virDomainPtr dom,
|
|
|
7a3408 |
+ const char *path)
|
|
|
7a3408 |
+{
|
|
|
7a3408 |
+ unsigned long bandwidth;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ if (vshCommandOptULWrap(ctl, cmd, "bandwidth", &bandwidth) < 0)
|
|
|
7a3408 |
+ return false;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ if (virDomainBlockJobSetSpeed(dom, path, bandwidth, 0) < 0)
|
|
|
7a3408 |
+ return false;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ return true;
|
|
|
7a3408 |
+}
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+static bool
|
|
|
7a3408 |
cmdBlockJob(vshControl *ctl, const vshCmd *cmd)
|
|
|
7a3408 |
{
|
|
|
7a3408 |
bool ret = false;
|
|
|
7a3408 |
@@ -2568,10 +2581,7 @@ cmdBlockJob(vshControl *ctl, const vshCmd *cmd)
|
|
|
7a3408 |
|
|
|
7a3408 |
if (abortMode || pivot || async)
|
|
|
7a3408 |
return blockJobImpl(ctl, cmd, VSH_CMD_BLOCK_JOB_ABORT, NULL);
|
|
|
7a3408 |
- if (bandwidth)
|
|
|
7a3408 |
- return blockJobImpl(ctl, cmd, VSH_CMD_BLOCK_JOB_SPEED, NULL);
|
|
|
7a3408 |
|
|
|
7a3408 |
- /* Everything below here is for --info mode */
|
|
|
7a3408 |
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
|
|
|
7a3408 |
goto cleanup;
|
|
|
7a3408 |
|
|
|
7a3408 |
@@ -2579,7 +2589,10 @@ cmdBlockJob(vshControl *ctl, const vshCmd *cmd)
|
|
|
7a3408 |
if (vshCommandOptStringReq(ctl, cmd, "path", &path) < 0)
|
|
|
7a3408 |
goto cleanup;
|
|
|
7a3408 |
|
|
|
7a3408 |
- ret = vshBlockJobInfo(ctl, dom, path, raw, bytes);
|
|
|
7a3408 |
+ if (bandwidth)
|
|
|
7a3408 |
+ ret = vshBlockJobSetSpeed(ctl, cmd, dom, path);
|
|
|
7a3408 |
+ else
|
|
|
7a3408 |
+ ret = vshBlockJobInfo(ctl, dom, path, raw, bytes);
|
|
|
7a3408 |
|
|
|
7a3408 |
cleanup:
|
|
|
7a3408 |
if (dom)
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.5.0
|
|
|
7a3408 |
|