aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2015-09-02 20:52:25 +0200
committerKevin Wolf <kwolf@redhat.com>2015-09-04 20:59:48 +0200
commit8e4922535b6479c7a2fa6b14b0148c6ae4fcc003 (patch)
tree412dddf1eab20d5c1a632a1b529a4abdb37c1d45
parente814dffcc9810ed77fe99081be9751b620a894c4 (diff)
iotests: More options for VM.add_drive()
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> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--tests/qemu-iotests/iotests.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 557925314b..1f913a1b2c 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -118,13 +118,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 path is not None:
+ options.append('file=%s' % path)
+
if opts:
options.append(opts)