aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/155
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2017-11-10 23:42:59 +0100
committerMax Reitz <mreitz@redhat.com>2018-01-23 12:34:42 +0100
commit1d701e0e7e3cdae803481216f572b8e4263d2b42 (patch)
tree58637b45b1b8ca3e1b1201651a659526b6e0d36e /tests/qemu-iotests/155
parentac5b787a6ee57852021e4a5a6876759218fbbbb0 (diff)
iotests: Make BD-{remove,insert}-medium use @id
In some cases, these commands still use the deprecated @device parameter. Fix that so we can later drop that parameter from their interface. Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20171110224302.14424-2-mreitz@redhat.com Reviewed-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/155')
-rwxr-xr-xtests/qemu-iotests/15560
1 files changed, 28 insertions, 32 deletions
diff --git a/tests/qemu-iotests/155 b/tests/qemu-iotests/155
index 0b86ea4e5c..fc9fa975be 100755
--- a/tests/qemu-iotests/155
+++ b/tests/qemu-iotests/155
@@ -51,36 +51,30 @@ class BaseClass(iotests.QMPTestCase):
target_real_backing = None
def setUp(self):
- qemu_img('create', '-f', iotests.imgfmt, back0_img, '1M')
+ qemu_img('create', '-f', iotests.imgfmt, back0_img, '1440K')
qemu_img('create', '-f', iotests.imgfmt, '-b', back0_img, back1_img)
qemu_img('create', '-f', iotests.imgfmt, '-b', back1_img, back2_img)
qemu_img('create', '-f', iotests.imgfmt, '-b', back2_img, source_img)
self.vm = iotests.VM()
- self.vm.add_drive(None, '', 'none')
- self.vm.launch()
-
# Add the BDS via blockdev-add so it stays around after the mirror block
# job has been completed
- result = self.vm.qmp('blockdev-add',
- node_name='source',
- driver=iotests.imgfmt,
- file={'driver': 'file',
- 'filename': source_img})
- self.assert_qmp(result, 'return', {})
-
- result = self.vm.qmp('x-blockdev-insert-medium',
- device='drive0', node_name='source')
- self.assert_qmp(result, 'return', {})
+ blockdev = {'node-name': 'source',
+ 'driver': iotests.imgfmt,
+ 'file': {'driver': 'file',
+ 'filename': source_img}}
+ self.vm.add_blockdev(self.qmp_to_opts(blockdev))
+ self.vm.add_device('floppy,id=qdev0,drive=source')
+ self.vm.launch()
self.assertIntactSourceBackingChain()
if self.existing:
if self.target_backing:
qemu_img('create', '-f', iotests.imgfmt,
- '-b', self.target_backing, target_img, '1M')
+ '-b', self.target_backing, target_img, '1440K')
else:
- qemu_img('create', '-f', iotests.imgfmt, target_img, '1M')
+ qemu_img('create', '-f', iotests.imgfmt, target_img, '1440K')
if self.cmd == 'blockdev-mirror':
options = { 'node-name': 'target',
@@ -104,11 +98,11 @@ class BaseClass(iotests.QMPTestCase):
except OSError:
pass
- def findBlockNode(self, node_name, id=None):
- if id:
+ def findBlockNode(self, node_name, qdev=None):
+ if qdev:
result = self.vm.qmp('query-block')
for device in result['return']:
- if device['device'] == id:
+ if device['qdev'] == qdev:
if node_name:
self.assert_qmp(device, 'inserted/node-name', node_name)
return device['inserted']
@@ -118,7 +112,7 @@ class BaseClass(iotests.QMPTestCase):
if node['node-name'] == node_name:
return node
- self.fail('Cannot find node %s/%s' % (id, node_name))
+ self.fail('Cannot find node %s/%s' % (qdev, node_name))
def assertIntactSourceBackingChain(self):
node = self.findBlockNode('source')
@@ -155,22 +149,23 @@ class BaseClass(iotests.QMPTestCase):
class MirrorBaseClass(BaseClass):
def runMirror(self, sync):
if self.cmd == 'blockdev-mirror':
- result = self.vm.qmp(self.cmd, device='drive0', sync=sync,
- target='target')
+ result = self.vm.qmp(self.cmd, job_id='mirror-job', device='source',
+ sync=sync, target='target')
else:
if self.existing:
mode = 'existing'
else:
mode = 'absolute-paths'
- result = self.vm.qmp(self.cmd, device='drive0', sync=sync,
- target=target_img, format=iotests.imgfmt,
- mode=mode, node_name='target')
+ result = self.vm.qmp(self.cmd, job_id='mirror-job', device='source',
+ sync=sync, target=target_img,
+ format=iotests.imgfmt, mode=mode,
+ node_name='target')
self.assert_qmp(result, 'return', {})
self.vm.event_wait('BLOCK_JOB_READY')
- result = self.vm.qmp('block-job-complete', device='drive0')
+ result = self.vm.qmp('block-job-complete', device='mirror-job')
self.assert_qmp(result, 'return', {})
self.vm.event_wait('BLOCK_JOB_COMPLETED')
@@ -178,21 +173,21 @@ class MirrorBaseClass(BaseClass):
def testFull(self):
self.runMirror('full')
- node = self.findBlockNode('target', 'drive0')
+ node = self.findBlockNode('target', 'qdev0')
self.assertCorrectBackingImage(node, None)
self.assertIntactSourceBackingChain()
def testTop(self):
self.runMirror('top')
- node = self.findBlockNode('target', 'drive0')
+ node = self.findBlockNode('target', 'qdev0')
self.assertCorrectBackingImage(node, back2_img)
self.assertIntactSourceBackingChain()
def testNone(self):
self.runMirror('none')
- node = self.findBlockNode('target', 'drive0')
+ node = self.findBlockNode('target', 'qdev0')
self.assertCorrectBackingImage(node, source_img)
self.assertIntactSourceBackingChain()
@@ -233,17 +228,18 @@ class TestCommit(BaseClass):
existing = False
def testCommit(self):
- result = self.vm.qmp('block-commit', device='drive0', base=back1_img)
+ result = self.vm.qmp('block-commit', job_id='commit-job',
+ device='source', base=back1_img)
self.assert_qmp(result, 'return', {})
self.vm.event_wait('BLOCK_JOB_READY')
- result = self.vm.qmp('block-job-complete', device='drive0')
+ result = self.vm.qmp('block-job-complete', device='commit-job')
self.assert_qmp(result, 'return', {})
self.vm.event_wait('BLOCK_JOB_COMPLETED')
- node = self.findBlockNode(None, 'drive0')
+ node = self.findBlockNode(None, 'qdev0')
self.assert_qmp(node, 'image' + '/backing-image' * 0 + '/filename',
back1_img)
self.assert_qmp(node, 'image' + '/backing-image' * 1 + '/filename',