From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0EcC-0002cz-Qc for qemu-devel@nongnu.org; Wed, 03 Jun 2015 15:46:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0EcC-0001NN-1k for qemu-devel@nongnu.org; Wed, 03 Jun 2015 15:46:16 -0400 From: Max Reitz Date: Wed, 3 Jun 2015 21:44:18 +0200 Message-Id: <1433360659-1915-38-git-send-email-mreitz@redhat.com> In-Reply-To: <1433360659-1915-1-git-send-email-mreitz@redhat.com> References: <1433360659-1915-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v3 37/38] iotests: More options for VM.add_drive() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: Kevin Wolf , qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi , Max Reitz , John Snow 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 --- tests/qemu-iotests/iotests.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 04a294d..d991d2f 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -117,13 +117,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) -- 2.4.1