iotests/image-fleecing: proper source device

Define scsi device to operate with it by qom-set in further patch.

Give a new node-name to source block node, to not look like device
name.

Job now don't want to work without giving explicit id, so, let's call
it "fleecing".

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210824083856.17408-31-vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
This commit is contained in:
Vladimir Sementsov-Ogievskiy 2021-08-24 11:38:52 +03:00 committed by Hanna Reitz
parent e89c0c8de3
commit b23c3b1459
2 changed files with 9 additions and 5 deletions

View File

@ -70,7 +70,11 @@ with iotests.FilePath('base.img') as base_img_path, \
log('--- Launching VM ---')
log('')
vm.add_drive(base_img_path)
src_node = 'source'
vm.add_blockdev(f'driver={iotests.imgfmt},file.driver=file,'
f'file.filename={base_img_path},node-name={src_node}')
vm.add_device('virtio-scsi')
vm.add_device(f'scsi-hd,id=sda,drive={src_node}')
vm.launch()
log('Done')
@ -78,7 +82,6 @@ with iotests.FilePath('base.img') as base_img_path, \
log('--- Setting up Fleecing Graph ---')
log('')
src_node = 'drive0'
tgt_node = 'fleeceNode'
# create tgt_node backed by src_node
@ -94,6 +97,7 @@ with iotests.FilePath('base.img') as base_img_path, \
# Establish COW from source to fleecing node
log(vm.qmp('blockdev-backup',
job_id='fleecing',
device=src_node,
target=tgt_node,
sync='none'))
@ -125,7 +129,7 @@ with iotests.FilePath('base.img') as base_img_path, \
for p in overwrite:
cmd = 'write -P%s %s %s' % p
log(cmd)
log(vm.hmp_qemu_io(src_node, cmd))
log(vm.hmp_qemu_io('/machine/peripheral/sda', cmd, qdev=True))
log('')
log('--- Verifying Data ---')
@ -140,7 +144,7 @@ with iotests.FilePath('base.img') as base_img_path, \
log('--- Cleanup ---')
log('')
log(vm.qmp('block-job-cancel', device=src_node))
log(vm.qmp('block-job-cancel', device='fleecing'))
e = vm.event_wait('BLOCK_JOB_CANCELLED')
assert e is not None
log(e, filters=[iotests.filter_qmp_event])

View File

@ -50,7 +50,7 @@ read -P0 0x3fe0000 64k
--- Cleanup ---
{"return": {}}
{"data": {"device": "drive0", "len": 67108864, "offset": 393216, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
{"data": {"device": "fleecing", "len": 67108864, "offset": 393216, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
{"return": {}}
{"return": {}}