[libvirt] [PATCH 03/13] virsh: blockjob: Split out vshBlockJobSetSpeed from blockJobImpl

Peter Krempa pkrempa at redhat.com
Tue Jul 21 06:12:41 UTC 2015


On Mon, Jul 20, 2015 at 16:47:38 -0400, John Ferlan wrote:
> 
> 
> On 07/15/2015 12:33 PM, Peter Krempa wrote:
> > ---
> >  tools/virsh-domain.c | 33 ++++++++++++++++++++++++---------
> >  1 file changed, 24 insertions(+), 9 deletions(-)
> > 
> > diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> > index 24f53ea..e3f7220 100644
> > --- a/tools/virsh-domain.c
> > +++ b/tools/virsh-domain.c
> > @@ -1666,7 +1666,6 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
> > 
> >  typedef enum {
> >      VSH_CMD_BLOCK_JOB_ABORT,
> > -    VSH_CMD_BLOCK_JOB_SPEED,
> >      VSH_CMD_BLOCK_JOB_PULL,
> >      VSH_CMD_BLOCK_JOB_COMMIT,
> >  } vshCmdBlockJobMode;
> > @@ -1701,10 +1700,6 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd,
> >          if (virDomainBlockJobAbort(dom, path, flags) < 0)
> >              goto cleanup;
> >          break;
> > -    case VSH_CMD_BLOCK_JOB_SPEED:
> > -        if (virDomainBlockJobSetSpeed(dom, path, bandwidth, 0) < 0)
> > -            goto cleanup;
> > -        break;
> >      case VSH_CMD_BLOCK_JOB_PULL:
> >          if (vshCommandOptStringReq(ctl, cmd, "base", &base) < 0)
> >              goto cleanup;
> > @@ -2537,6 +2532,26 @@ vshBlockJobInfo(vshControl *ctl,
> > 
> > 
> >  static bool
> > +vshBlockJobSetSpeed(vshControl *ctl,
> > +                    const vshCmd *cmd,
> > +                    virDomainPtr dom,
> > +                    const char *path)
> > +{
> > +    unsigned long bandwidth;
> > +
> > +    if (vshCommandOptULWrap(ctl, cmd, "bandwidth", &bandwidth) < 0) {
> > +        vshError(ctl, "%s", _("bandwidth must be a number"));
> 
> vshCommandOptULInternal already emits an error message when ret < 0:
> 
> "Numeric value '%s' for <%s> option is malformed or out of range"
> 
> This is repeated in patch 5/13 and 6/13
> 
> Did you intend to have two messages?

Actually no I didn't. This patch is pretty old and pre-dates the
refactor where vshCommandOptULWrap started reporting it's own error.
I've just added the new argument in conflict resolution, but didn't
bother checking why it was added. Thanks for pointing out.

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/20150721/0d78d22e/attachment-0001.sig>


More information about the libvir-list mailing list