Skip to content
Snippets Groups Projects
Commit c45a88f4 authored by Hanna Reitz's avatar Hanna Reitz Committed by Kevin Wolf
Browse files

iotests: Check that @replaces can replace filters


Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200218103454.296704-20-mreitz@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent a1da1878
No related branches found
No related tags found
No related merge requests found
......@@ -1190,6 +1190,52 @@ class TestOrphanedSource(iotests.QMPTestCase):
self.assertFalse('mirror-filter' in nodes,
'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__':
iotests.main(supported_fmts=['qcow2', 'qed'],
supported_protocols=['file'],
......
.............................................................................................
..............................................................................................
----------------------------------------------------------------------
Ran 93 tests
Ran 94 tests
OK
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment