From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKrsh-0003oD-GM for qemu-devel@nongnu.org; Mon, 09 Feb 2015 12:12:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKrsg-0006YE-CZ for qemu-devel@nongnu.org; Mon, 09 Feb 2015 12:12:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKrsg-0006Y3-45 for qemu-devel@nongnu.org; Mon, 09 Feb 2015 12:12:18 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t19HCHSP014944 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 9 Feb 2015 12:12:17 -0500 From: Max Reitz Date: Mon, 9 Feb 2015 12:11:36 -0500 Message-Id: <1423501897-30410-37-git-send-email-mreitz@redhat.com> In-Reply-To: <1423501897-30410-1-git-send-email-mreitz@redhat.com> References: <1423501897-30410-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v2 36/37] iotests: More options for VM.add_drive() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Markus Armbruster , Max Reitz , Stefan Hajnoczi , 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 241b5ee..5191a65 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 path is not None: + options.append('file=%s' % path) + if opts: options.append(opts) -- 2.1.0