Lines Matching +full:drive +full:- +full:open +full:- +full:source

5 # mirror block job; in "existing" modes (drive-mirror with
6 # mode=existing and blockdev-mirror) the backing chain should not be
32 source_img = os.path.join(iotests.test_dir, 'source.' + iotests.imgfmt)
38 # existing: If True, explicitly create the target image and blockdev-add it
43 # for the blockdev-add command
50 # chain opened right away. If False, blockdev-add
52 # is supposed to open the backing chain.
53 # use_iothread: If True, an iothread is configured for the virtio-blk device
63 qemu_img('create', '-f', iotests.imgfmt, back0_img, '1440K')
64 qemu_img('create', '-f', iotests.imgfmt, '-b', back0_img,
65 '-F', iotests.imgfmt, back1_img)
66 qemu_img('create', '-f', iotests.imgfmt, '-b', back1_img,
67 '-F', iotests.imgfmt, back2_img)
68 qemu_img('create', '-f', iotests.imgfmt, '-b', back2_img,
69 '-F', iotests.imgfmt, source_img)
72 # Add the BDS via blockdev-add so it stays around after the mirror block
74 blockdev = {'node-name': 'source',
86 self.vm.add_device('virtio-scsi%s' % iothread)
87 self.vm.add_device('scsi-hd,id=qdev0,drive=source')
95 qemu_img('create', '-f', iotests.imgfmt,
96 '-b', self.target_backing, '-F', 'raw',
99 qemu_img('create', '-f', iotests.imgfmt, target_img, '1440K')
101 if self.cmd == 'blockdev-mirror':
102 options = { 'node-name': 'target',
105 'node-name': 'target-file',
113 self.vm.cmd('blockdev-add', options)
128 result = self.vm.qmp('query-block')
132 self.assert_qmp(device, 'inserted/node-name', node_name)
135 result = self.vm.qmp('query-named-block-nodes')
137 if node['node-name'] == node_name:
143 node = self.findBlockNode('source')
145 self.assert_qmp(node, 'image' + '/backing-image' * 0 + '/filename',
147 self.assert_qmp(node, 'image' + '/backing-image' * 1 + '/filename',
149 self.assert_qmp(node, 'image' + '/backing-image' * 2 + '/filename',
151 self.assert_qmp(node, 'image' + '/backing-image' * 3 + '/filename',
153 self.assert_qmp_absent(node, 'image' + '/backing-image' * 4)
165 self.assert_qmp(node, 'image/backing-image/filename', image)
167 self.assert_qmp_absent(node, 'image/backing-image')
172 # cmd: Mirroring command to execute, either drive-mirror or blockdev-mirror
179 if self.cmd == 'blockdev-mirror':
180 self.vm.cmd(self.cmd, job_id='mirror-job', device='source',
187 mode = 'absolute-paths'
188 self.vm.cmd(self.cmd, job_id='mirror-job', device='source',
193 self.vm.run_job('mirror-job', auto_finalize=False,
219 cmd = 'drive-mirror'
223 cmd = 'drive-mirror'
228 cmd = 'drive-mirror'
230 target_backing = 'null-co://'
233 cmd = 'blockdev-mirror'
238 cmd = 'blockdev-mirror'
240 target_backing = 'null-co://'
243 cmd = 'blockdev-mirror'
246 target_blockdev_backing = { 'driver': 'null-co' }
247 target_real_backing = 'null-co://'
249 # Attach the backing chain only during completion, with blockdev-reopen
251 cmd = 'blockdev-mirror'
253 target_backing = 'null-co://'
258 self.vm.cmd('blockdev-add', node_name="backing",
259 driver="null-co")
260 self.vm.cmd('blockdev-reopen', options=[{
261 'node-name': "target",
263 'file': "target-file",
270 # Attach the backing chain only during completion, with blockdev-snapshot
272 cmd = 'blockdev-mirror'
274 target_backing = 'null-co://'
279 self.vm.cmd('blockdev-add', node_name="backing",
280 driver="null-co")
281 self.vm.cmd('blockdev-snapshot', node="backing",
291 self.vm.cmd('block-commit', job_id='commit-job',
292 device='source', base=back1_img)
296 self.vm.cmd('block-job-complete', device='commit-job')
301 self.assert_qmp(node, 'image' + '/backing-image' * 0 + '/filename',
303 self.assert_qmp(node, 'image' + '/backing-image' * 1 + '/filename',
305 self.assert_qmp_absent(node, 'image' + '/backing-image' * 2 +