[libvirt] [PATCH 02/21] virsh: Implement VIR_DOMAIN_JOB_DISK_TEMP_(USED|TOTAL) in cmdDomjobinfo

Peter Krempa posted 21 patches 6 years ago
There is a newer version of this series
[libvirt] [PATCH 02/21] virsh: Implement VIR_DOMAIN_JOB_DISK_TEMP_(USED|TOTAL) in cmdDomjobinfo
Posted by Peter Krempa 6 years ago
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 tools/virsh-domain.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 325d748b49..ec9292a5c1 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6388,6 +6388,24 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
         vshPrint(ctl, "%-17s %-13d\n", _("Auto converge throttle:"), ivalue);
     }

+    if ((rc = virTypedParamsGetULLong(params, nparams,
+                                      VIR_DOMAIN_JOB_DISK_TEMP_USED,
+                                      &value)) < 0) {
+        goto save_error;
+    } else if (rc) {
+        val = vshPrettyCapacity(value, &unit);
+        vshPrint(ctl, "%-17s %-.3lf %s\n", _("Temporary disk space use:"), val, unit);
+    }
+
+    if ((rc = virTypedParamsGetULLong(params, nparams,
+                                      VIR_DOMAIN_JOB_DISK_TEMP_TOTAL,
+                                      &value)) < 0) {
+        goto save_error;
+    } else if (rc) {
+        val = vshPrettyCapacity(value, &unit);
+        vshPrint(ctl, "%-17s %-.3lf %s\n", _("Temporary disk space total:"), val, unit);
+    }
+
     ret = true;

  cleanup:
-- 
2.23.0

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

Re: [libvirt] [PATCH 02/21] virsh: Implement VIR_DOMAIN_JOB_DISK_TEMP_(USED|TOTAL) in cmdDomjobinfo
Posted by Daniel P. Berrangé 6 years ago
On Tue, Nov 26, 2019 at 10:39:48PM +0100, Peter Krempa wrote:
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  tools/virsh-domain.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 02/21] virsh: Implement VIR_DOMAIN_JOB_DISK_TEMP_(USED|TOTAL) in cmdDomjobinfo
Posted by Eric Blake 6 years ago
On 11/26/19 3:39 PM, Peter Krempa wrote:
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>   tools/virsh-domain.c | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 325d748b49..ec9292a5c1 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -6388,6 +6388,24 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd)
>           vshPrint(ctl, "%-17s %-13d\n", _("Auto converge throttle:"), ivalue);
>       }
> 
> +    if ((rc = virTypedParamsGetULLong(params, nparams,
> +                                      VIR_DOMAIN_JOB_DISK_TEMP_USED,
> +                                      &value)) < 0) {
> +        goto save_error;
> +    } else if (rc) {
> +        val = vshPrettyCapacity(value, &unit);
> +        vshPrint(ctl, "%-17s %-.3lf %s\n", _("Temporary disk space use:"), val, unit);

Should we be using the table formatter, rather than formatting columns 
ourselves?  Particularly true since 'Temporary disk space use:' is 
longer than 17 bytes, so our format string is insufficient.

But seems to be pre-existing, so not a showstopper for this patch.

Reviewed-by: Eric Blake <eblake@redhat.com>

> +    }
> +
> +    if ((rc = virTypedParamsGetULLong(params, nparams,
> +                                      VIR_DOMAIN_JOB_DISK_TEMP_TOTAL,
> +                                      &value)) < 0) {
> +        goto save_error;
> +    } else if (rc) {
> +        val = vshPrettyCapacity(value, &unit);
> +        vshPrint(ctl, "%-17s %-.3lf %s\n", _("Temporary disk space total:"), val, unit);
> +    }
> +
>       ret = true;
> 
>    cleanup:
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

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