提交 8e492253 编写于 作者: M Max Reitz 提交者: Kevin Wolf

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: NMax Reitz <mreitz@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 e814dffc
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册