Message ID | 1390984843-2101-4-git-send-email-famz@redhat.com |
---|---|
State | New |
Headers | show |
On 01/29/2014 01:40 AM, Fam Zheng wrote: s/convertion/conversion/ in the subject > QMP command "block_set_io_throttle" expects underscores in parameters > instead of dashes: {iops,bps}_{rd,wr,max}. > > Add optional argument conv_keys (defaults to True, backward compatible), > it will be used in IO throttling test case. > > Signed-off-by: Fam Zheng <famz@redhat.com> > --- > tests/qemu-iotests/iotests.py | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > You know, it might be nice to get the '-'/'_' looseness into QMP itself when invoked via JSON strings over the monitor, rather than just the testsuite wrapper, since we're already inconsistent in several commands. But that's a bigger project for another day.
On Wed, Jan 29, 2014 at 04:40:42PM +0800, Fam Zheng wrote: > QMP command "block_set_io_throttle" expects underscores in parameters > instead of dashes: {iops,bps}_{rd,wr,max}. > > Add optional argument conv_keys (defaults to True, backward compatible), > it will be used in IO throttling test case. > > Signed-off-by: Fam Zheng <famz@redhat.com> > --- > tests/qemu-iotests/iotests.py | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Le Wednesday 29 Jan 2014 à 16:40:42 (+0800), Fam Zheng a écrit : > QMP command "block_set_io_throttle" expects underscores in parameters > instead of dashes: {iops,bps}_{rd,wr,max}. > > Add optional argument conv_keys (defaults to True, backward compatible), > it will be used in IO throttling test case. > > Signed-off-by: Fam Zheng <famz@redhat.com> > --- > tests/qemu-iotests/iotests.py | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py > index ca79d09..c1f5427 100644 > --- a/tests/qemu-iotests/iotests.py > +++ b/tests/qemu-iotests/iotests.py > @@ -179,11 +179,14 @@ class VM(object): > self._popen = None > > underscore_to_dash = string.maketrans('_', '-') > - def qmp(self, cmd, **args): > + def qmp(self, cmd, conv_keys=True, **args): > '''Invoke a QMP command and return the result dict''' > qmp_args = dict() > for k in args.keys(): > - qmp_args[k.translate(self.underscore_to_dash)] = args[k] > + if conv_keys: > + qmp_args[k.translate(self.underscore_to_dash)] = args[k] > + else: > + qmp_args[k] = args[k] > > return self._qmp.cmd(cmd, args=qmp_args) > > -- > 1.8.5.3 > > Reviewed-by: Benoit Canet <benoit@irqsave.net>
On Wed, 01/29 07:09, Eric Blake wrote: > On 01/29/2014 01:40 AM, Fam Zheng wrote: > > s/convertion/conversion/ in the subject > > > QMP command "block_set_io_throttle" expects underscores in parameters > > instead of dashes: {iops,bps}_{rd,wr,max}. > > > > Add optional argument conv_keys (defaults to True, backward compatible), > > it will be used in IO throttling test case. > > > > Signed-off-by: Fam Zheng <famz@redhat.com> > > --- > > tests/qemu-iotests/iotests.py | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > You know, it might be nice to get the '-'/'_' looseness into QMP itself > when invoked via JSON strings over the monitor, rather than just the > testsuite wrapper, since we're already inconsistent in several commands. > But that's a bigger project for another day. > I agree. Let's stick to this now and leave the loosing in QMP for later. Fam
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index ca79d09..c1f5427 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -179,11 +179,14 @@ class VM(object): self._popen = None underscore_to_dash = string.maketrans('_', '-') - def qmp(self, cmd, **args): + def qmp(self, cmd, conv_keys=True, **args): '''Invoke a QMP command and return the result dict''' qmp_args = dict() for k in args.keys(): - qmp_args[k.translate(self.underscore_to_dash)] = args[k] + if conv_keys: + qmp_args[k.translate(self.underscore_to_dash)] = args[k] + else: + qmp_args[k] = args[k] return self._qmp.cmd(cmd, args=qmp_args)
QMP command "block_set_io_throttle" expects underscores in parameters instead of dashes: {iops,bps}_{rd,wr,max}. Add optional argument conv_keys (defaults to True, backward compatible), it will be used in IO throttling test case. Signed-off-by: Fam Zheng <famz@redhat.com> --- tests/qemu-iotests/iotests.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)