Message ID | 1422387983-32153-50-git-send-email-mreitz@redhat.com |
---|---|
State | New |
Headers | show |
On 01/27/2015 12:46 PM, Max Reitz wrote: > This patch allows specifying the interface to be used for the drive, and > makes specifying a path optional (if the path is None, the "file" option > will be omitted, thus creating an empty drive). > > Signed-off-by: Max Reitz <mreitz@redhat.com> > --- > tests/qemu-iotests/iotests.py | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > + > + if not path is None: > + options.append('file=%s' % path) Works, but it is more idiomatic to use 'if path is not None:', based on a grep of the source tree. With that minor switch, Reviewed-by: Eric Blake <eblake@redhat.com>
On 2015-01-28 at 16:27, Eric Blake wrote: > On 01/27/2015 12:46 PM, Max Reitz wrote: >> This patch allows specifying the interface to be used for the drive, and >> makes specifying a path optional (if the path is None, the "file" option >> will be omitted, thus creating an empty drive). >> >> Signed-off-by: Max Reitz <mreitz@redhat.com> >> --- >> tests/qemu-iotests/iotests.py | 9 ++++++--- >> 1 file changed, 6 insertions(+), 3 deletions(-) >> >> + >> + if not path is None: >> + options.append('file=%s' % path) > Works, but it is more idiomatic to use 'if path is not None:', based on > a grep of the source tree. Did I ever mention I don't know Python very well? That sounds a lot better, will do, thanks. > With that minor switch, > Reviewed-by: Eric Blake <eblake@redhat.com> On to the last patch! :-) Max
On 01/28/2015 02:28 PM, Max Reitz wrote: > On 2015-01-28 at 16:27, Eric Blake wrote: >> On 01/27/2015 12:46 PM, Max Reitz wrote: >>> This patch allows specifying the interface to be used for the drive, and >>> makes specifying a path optional (if the path is None, the "file" option >>> will be omitted, thus creating an empty drive). >>> >>> Signed-off-by: Max Reitz <mreitz@redhat.com> >>> --- >>> tests/qemu-iotests/iotests.py | 9 ++++++--- >>> 1 file changed, 6 insertions(+), 3 deletions(-) >>> >>> + >>> + if not path is None: >>> + options.append('file=%s' % path) >> Works, but it is more idiomatic to use 'if path is not None:', based on >> a grep of the source tree. > > Did I ever mention I don't know Python very well? The feeling is mutual. So it's the blind leading the blind :) > > That sounds a lot better, will do, thanks. > >> With that minor switch, >> Reviewed-by: Eric Blake <eblake@redhat.com> > > On to the last patch! :-) > > Max > >
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 241b5ee..27b2490 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -94,13 +94,16 @@ class VM(object): self._args.append('-monitor') self._args.append(args) - def add_drive(self, path, opts=''): + def add_drive(self, path, opts='', interface='virtio'): '''Add a virtio-blk drive to the VM''' - options = ['if=virtio', + options = ['if=%s' % interface, 'format=%s' % imgfmt, 'cache=%s' % cachemode, - 'file=%s' % path, 'id=drive%d' % self._num_drives] + + if not path is None: + options.append('file=%s' % path) + if opts: options.append(opts)
This patch allows specifying the interface to be used for the drive, and makes specifying a path optional (if the path is None, the "file" option will be omitted, thus creating an empty drive). Signed-off-by: Max Reitz <mreitz@redhat.com> --- tests/qemu-iotests/iotests.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)