mirror of
https://github.com/qemu/qemu.git
synced 2024-11-24 11:23:43 +08:00
iotests.py: Add qemu_nbd function
Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
6b02b1f0a4
commit
bec87774c2
@ -39,6 +39,10 @@ qemu_io_args = [os.environ.get('QEMU_IO_PROG', 'qemu-io')]
|
||||
if os.environ.get('QEMU_IO_OPTIONS'):
|
||||
qemu_io_args += os.environ['QEMU_IO_OPTIONS'].strip().split(' ')
|
||||
|
||||
qemu_nbd_args = [os.environ.get('QEMU_NBD_PROG', 'qemu-nbd')]
|
||||
if os.environ.get('QEMU_NBD_OPTIONS'):
|
||||
qemu_nbd_args += os.environ['QEMU_NBD_OPTIONS'].strip().split(' ')
|
||||
|
||||
qemu_prog = os.environ.get('QEMU_PROG', 'qemu')
|
||||
qemu_opts = os.environ.get('QEMU_OPTIONS', '').strip().split(' ')
|
||||
|
||||
@ -87,6 +91,10 @@ def qemu_io(*args):
|
||||
sys.stderr.write('qemu-io received signal %i: %s\n' % (-exitcode, ' '.join(args)))
|
||||
return subp.communicate()[0]
|
||||
|
||||
def qemu_nbd(*args):
|
||||
'''Run qemu-nbd in daemon mode and return the parent's exit code'''
|
||||
return subprocess.call(qemu_nbd_args + ['--fork'] + list(args))
|
||||
|
||||
def compare_images(img1, img2, fmt1=imgfmt, fmt2=imgfmt):
|
||||
'''Return True if two image files are identical'''
|
||||
return qemu_img('compare', '-f', fmt1,
|
||||
|
Loading…
Reference in New Issue
Block a user