[libvirt] [PATCH v2] virsh: Fix job status indicator for 0 length block jobs

Peter Krempa pkrempa at redhat.com
Wed Sep 23 13:14:31 UTC 2015


On Tue, Sep 22, 2015 at 11:12:28 +0200, Erik Skultety wrote:
> 
> 
> On 21/09/15 19:46, Peter Krempa wrote:
> > Although 0 length block jobs aren't entirely useful, the output of virsh
> > blockjob is empty due to the condition that suppresses the output for
> > migration jobs that did not start. Since the only place that actually
> > uses the condition that suppresses the output is in migration, let's
> > move the check there and thus add support for 0 of 0 equaling to 100%.
> > 
> > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1196711
> > ---
> >  tools/virsh-domain.c | 6 +-----
> >  1 file changed, 1 insertion(+), 5 deletions(-)
> > 
> > diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> > index 73c476d..fb138d5 100644
> > --- a/tools/virsh-domain.c
> > +++ b/tools/virsh-domain.c
> > @@ -1700,10 +1700,6 @@ virshPrintJobProgress(const char *label, unsigned long long remaining,
> >  {
> >      int progress;
> > 
> > -    if (total == 0)
> > -        /* migration has not been started */
> > -        return;
> > -
> >      if (remaining == 0) {
> >          /* migration has completed */
> >          progress = 100;
> > @@ -4401,7 +4397,7 @@ virshWatchJob(vshControl *ctl,
> >              ret = virDomainGetJobInfo(dom, &jobinfo);
> >              pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
> >              if (ret == 0) {
> > -                if (verbose)
> > +                if (verbose && jobinfo.dataTotal > 0)
> >                      virshPrintJobProgress(label, jobinfo.dataRemaining,
> >                                            jobinfo.dataTotal);
> > 
> Seems reasonable to me, ACK.

Pushed; Thanks.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150923/664c8e08/attachment-0001.sig>


More information about the libvir-list mailing list