[PATCH 4/6] virsh: blockcommit: Support --bytes and scaled integers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reuse the approach and helper from the last patch.
---
 tools/virsh-domain.c | 10 +++++++++-
 tools/virsh.pod      |  9 ++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 5ea39f7..cd616a8 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2010,6 +2010,10 @@ static const vshCmdOptDef opts_block_commit[] = {
      .type = VSH_OT_BOOL,
      .help = N_("keep the backing chain relatively referenced")
     },
+    {.name = "bytes",
+     .type = VSH_OT_BOOL,
+     .help = N_("the bandwidth limit is in bytes/s rather than MiB/s")
+    },
     {.name = NULL}
 };

@@ -2024,6 +2028,7 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
     bool active = vshCommandOptBool(cmd, "active") || pivot || finish;
     bool blocking = vshCommandOptBool(cmd, "wait") || pivot || finish;
     bool async = vshCommandOptBool(cmd, "async");
+    bool bytes = vshCommandOptBool(cmd, "bytes");
     int timeout = 0;
     const char *path = NULL;
     const char *base = NULL;
@@ -2044,9 +2049,12 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
     if (vshCommandOptStringReq(ctl, cmd, "top", &top) < 0)
         return false;

-    if (vshCommandOptULWrap(ctl, cmd, "bandwidth", &bandwidth) < 0)
+    if (vshBlockJobOptionBandwidth(ctl, cmd, bytes, &bandwidth) < 0)
         return false;

+    if (bytes)
+        flags |= VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES;
+
     if (vshCommandOptBool(cmd, "shallow"))
         flags |= VIR_DOMAIN_BLOCK_COMMIT_SHALLOW;

diff --git a/tools/virsh.pod b/tools/virsh.pod
index edb9ce5..7d61f22 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -938,7 +938,7 @@ currently in use by a running domain. Other contexts that require a MAC
 address of virtual interface (such as I<detach-interface> or
 I<domif-setlink>) will accept the MAC address printed by this command.

-=item B<blockcommit> I<domain> I<path> [I<bandwidth>]
+=item B<blockcommit> I<domain> I<path> [I<bandwidth>] [I<--bytes>]
 [I<base>] [I<--shallow>] [I<top>] [I<--delete>] [I<--keep-relative>]
 [I<--wait> [I<--async>] [I<--verbose>]] [I<--timeout> B<seconds>]
 [I<--active>] [{I<--pivot> | I<--keep-overlay>}]
@@ -984,10 +984,9 @@ to a unique target name (<target dev='name'/>) or source file (<source
 file='name'/>) for one of the disk devices attached to I<domain> (see
 also B<domblklist> for listing these names).
 I<bandwidth> specifies copying bandwidth limit in MiB/s, although for
-qemu, it may be non-zero only for an online domain. Specifying a negative
-value is interpreted as an unsigned long long value or essentially
-unlimited. The hypervisor can choose whether to reject the value or
-convert it to the maximum value allowed.
+qemu, it may be non-zero only for an online domain. For further information
+on the I<bandwidth> argument see the corresponding section for the B<blockjob>
+command.

 =item B<blockcopy> I<domain> I<path> { I<dest> [I<format>] [I<--blockdev>]
 | I<--xml> B<file> } [I<--shallow>] [I<--reuse-external>] [I<bandwidth>]
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]