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>
---
tests/qemu-iotests/tests/image-fleecing | 12 ++++++++----
tests/qemu-iotests/tests/image-fleecing.out | 2 +-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/tests/image-fleecing
index 799369e290..961941bb27 100755
--- a/tests/qemu-iotests/tests/image-fleecing
+++ b/tests/qemu-iotests/tests/image-fleecing
@@ -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])
diff --git a/tests/qemu-iotests/tests/image-fleecing.out b/tests/qemu-iotests/tests/image-fleecing.out
index 16643dde30..314a1b54e9 100644
--- a/tests/qemu-iotests/tests/image-fleecing.out
+++ b/tests/qemu-iotests/tests/image-fleecing.out
@@ -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": {}}
--
2.29.2