Re: [PATCH v3 09/18] blockjob: add new --bytes flag to virsh blockjob

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

 



On 09/05/2014 03:05 AM, Peter Krempa wrote:
> On 08/31/14 06:02, Eric Blake wrote:
>> Expose the new flag just added to virDomainGetBlockJobInfo.
>> With --raw, the presence or absence of --bytes determines which
>> flag to use in the single API call.  Without --raw, the use of
>> --bytes forces an error if the server doesn't support it,
>> otherwise, the code tries to silently fall back to scaling the
>> MiB/s value.
>>
>> My goal is to eventually also support --bytes in bandwidth mode;
>> but that's a bit further down the road (and needs a new API flag
>> added in libvirt.h first).

the new flag hinted at is patch 14/14; I'm still working on the code for
a v4 patch for actually setting in byte mode.

> 
> ACK
> 

Pushed with a tweak I found during self-review:

diff --git i/tools/virsh-domain.c w/tools/virsh-domain.c
index 749fa67..2bb3bbc 100644
--- i/tools/virsh-domain.c
+++ w/tools/virsh-domain.c
@@ -2121,7 +2121,7 @@ cmdBlockJob(vshControl *ctl, const vshCmd *cmd)
     if (vshCommandOptStringReq(ctl, cmd, "path", &path) < 0)
         goto cleanup;

-    /* If bytes were requested, or if raw mode is not forcing MiB/s
+    /* If bytes were requested, or if raw mode is not forcing a MiB/s
      * query and cache can't prove failure, then query bytes/sec.  */
     if (bytes || !(raw || ctl->blockJobNoBytes)) {
         flags |= VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES;
@@ -2154,9 +2154,11 @@ cmdBlockJob(vshControl *ctl, const vshCmd *cmd)
         /* Scale to bytes/s unless in raw mode */
         if (!raw) {
             speed <<= 20;
-            if (speed >> 20 != info.bandwidth)
+            if (speed >> 20 != info.bandwidth) {
                 vshError(ctl, _("overflow in converting %ld MiB/s to
bytes\n"),
                          info.bandwidth);
+                goto cleanup;
+            }
         }
     }


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]