From: Max Reitz Date: Wed, 2 Sep 2015 18:52:25 +0000 (+0200) Subject: iotests: More options for VM.add_drive() X-Git-Tag: TizenStudio_2.0_p2.3.2~120^2~1^2~214^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8e4922535b6479c7a2fa6b14b0148c6ae4fcc003;p=sdk%2Femulator%2Fqemu.git 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 Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 5579253..1f913a1 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)