[libvirt] [PATCH] virsh: Improve the job type reported of virsh cmd blockcommit

Michal Privoznik mprivozn at redhat.com
Tue Oct 28 23:36:39 UTC 2014


On 23.10.2014 12:13, Shanzhi Yu wrote:
> When begin a blockcommit job(active) with virsh, it will report
> "Block Commit started"(it really donesn't matter much), but for
> more preciese it should report "Active Block Commit started"
>
> Signed-off-by: Shanzhi Yu <shyu at redhat.com>
> ---
>   tools/virsh-domain.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 94ae3d3..3416e31 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -1723,9 +1723,15 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
>           goto cleanup;
>
>       if (!blocking) {
> -        vshPrint(ctl, "%s", _("Block Commit started"));
> -        ret = true;
> -        goto cleanup;
> +        if (active) {
> +            vshPrint(ctl, "%s", _("Active Block Commit started"));
> +            ret = true;
> +            goto cleanup;
> +        } else {
> +            vshPrint(ctl, "%s", _("Block Commit started"));
> +            ret = true;
> +            goto cleanup;
> +        }
>       }
>
>       while (blocking) {
>

I think a smaller diff would suffice too:

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 94ae3d3..971af83 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1723,7 +1723,9 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd)
          goto cleanup;

      if (!blocking) {
-        vshPrint(ctl, "%s", _("Block Commit started"));
+        vshPrint(ctl, "%s", active ?
+                 _("Active Block Commit started") :
+                 _("Block Commit started"));
          ret = true;
          goto cleanup;
      }

Changed, ACKed and pushed.

Michal




More information about the libvir-list mailing list