mirror of
https://github.com/qemu/qemu.git
synced 2024-11-27 05:43:47 +08:00
iotests: Check that @replaces can replace filters
Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20200218103454.296704-20-mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
a1da187860
commit
c45a88f442
@ -1190,6 +1190,52 @@ class TestOrphanedSource(iotests.QMPTestCase):
|
|||||||
self.assertFalse('mirror-filter' in nodes,
|
self.assertFalse('mirror-filter' in nodes,
|
||||||
'Mirror filter node did not disappear')
|
'Mirror filter node did not disappear')
|
||||||
|
|
||||||
|
# Test cases for @replaces that do not necessarily involve Quorum
|
||||||
|
class TestReplaces(iotests.QMPTestCase):
|
||||||
|
# Each of these test cases needs their own block graph, so do not
|
||||||
|
# create any nodes here
|
||||||
|
def setUp(self):
|
||||||
|
self.vm = iotests.VM()
|
||||||
|
self.vm.launch()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.vm.shutdown()
|
||||||
|
for img in (test_img, target_img):
|
||||||
|
try:
|
||||||
|
os.remove(img)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
@iotests.skip_if_unsupported(['copy-on-read'])
|
||||||
|
def test_replace_filter(self):
|
||||||
|
"""
|
||||||
|
Check that we can replace filter nodes.
|
||||||
|
"""
|
||||||
|
result = self.vm.qmp('blockdev-add', **{
|
||||||
|
'driver': 'copy-on-read',
|
||||||
|
'node-name': 'filter0',
|
||||||
|
'file': {
|
||||||
|
'driver': 'copy-on-read',
|
||||||
|
'node-name': 'filter1',
|
||||||
|
'file': {
|
||||||
|
'driver': 'null-co'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
self.assert_qmp(result, 'return', {})
|
||||||
|
|
||||||
|
result = self.vm.qmp('blockdev-add',
|
||||||
|
node_name='target', driver='null-co')
|
||||||
|
self.assert_qmp(result, 'return', {})
|
||||||
|
|
||||||
|
result = self.vm.qmp('blockdev-mirror', job_id='mirror', device='filter0',
|
||||||
|
target='target', sync='full', replaces='filter1')
|
||||||
|
self.assert_qmp(result, 'return', {})
|
||||||
|
|
||||||
|
self.complete_and_wait('mirror')
|
||||||
|
|
||||||
|
self.vm.assert_block_path('filter0', '/file', 'target')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
iotests.main(supported_fmts=['qcow2', 'qed'],
|
iotests.main(supported_fmts=['qcow2', 'qed'],
|
||||||
supported_protocols=['file'],
|
supported_protocols=['file'],
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
.............................................................................................
|
..............................................................................................
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
Ran 93 tests
|
Ran 94 tests
|
||||||
|
|
||||||
OK
|
OK
|
||||||
|
Loading…
Reference in New Issue
Block a user