Lines Matching +full:vm +full:- +full:map
37 qemu_img('create', '-f', iotests.imgfmt,
38 '-o', 'backing_file=%s' % backing_img,
39 '-F', 'raw', mid_img)
40 qemu_img('create', '-f', iotests.imgfmt,
41 '-o', 'backing_file=%s' % mid_img,
42 '-F', iotests.imgfmt, test_img)
43 qemu_io('-f', 'raw', '-c', 'write -P 0x1 0 512', backing_img)
44 qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0x1 524288 512', mid_img)
45 self.vm = iotests.VM().add_drive("blkdebug::" + test_img,
46 "backing.node-name=mid," +
47 "backing.backing.node-name=base")
48 self.vm.launch()
51 self.vm.shutdown()
59 self.vm.cmd('block-stream', device='drive0')
64 self.vm.shutdown()
67 qemu_io('-f', 'raw', '-c', 'map', backing_img).stdout,
68 qemu_io('-f', iotests.imgfmt, '-c', 'map', test_img).stdout,
69 'image file map does not match backing file after streaming')
75 qemu_io('-f', 'raw', '-rU', '-c', 'map', backing_img).stdout,
76 qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', mid_img).stdout,
77 'image file map matches backing file before streaming')
79 self.vm.cmd('block-stream', device='mid', job_id='stream-mid')
81 self.wait_until_completed(drive='stream-mid')
84 self.vm.shutdown()
87 qemu_io('-f', 'raw', '-c', 'map', backing_img).stdout,
88 qemu_io('-f', iotests.imgfmt, '-c', 'map', mid_img).stdout,
89 'image file map does not match backing file after streaming')
94 self.vm.pause_drive('drive0')
95 self.vm.cmd('block-stream', device='drive0')
98 self.vm.resume_drive('drive0')
101 result = self.vm.qmp('query-block-jobs')
105 result = self.vm.qmp('query-block-jobs')
108 self.vm.cmd('block-job-resume', device='drive0')
113 self.vm.shutdown()
116 qemu_io('-f', 'raw', '-c', 'map', backing_img).stdout,
117 qemu_io('-f', iotests.imgfmt, '-c', 'map', test_img).stdout,
118 'image file map does not match backing file after streaming')
123 # The image map is empty before the operation
125 '-f', iotests.imgfmt, '-rU', '-c', 'map', test_img).stdout
127 # This is a no-op: no data should ever be copied from the base image
128 self.vm.cmd('block-stream', device='drive0', base=mid_img)
133 self.vm.shutdown()
136 qemu_io('-f', iotests.imgfmt, '-c', 'map', test_img).stdout,
137 empty_map, 'image file map changed after a no-op')
142 self.vm.cmd('block-stream', device='drive0', base=backing_img)
147 self.vm.shutdown()
150 qemu_io('-f', iotests.imgfmt, '-c', 'map', mid_img).stdout,
151 qemu_io('-f', iotests.imgfmt, '-c', 'map', test_img).stdout,
152 'image file map does not match backing file after streaming')
155 result = self.vm.qmp('block-stream', device='nonexistent')
157 'Cannot find device=\'nonexistent\' nor node-name=\'nonexistent\'')
160 result = self.vm.qmp('block-stream', device='mid')
164 # Create a new file that we can attach (we need a read-only top)
165 with iotests.FilePath('ro-top.img') as ro_top_path:
166 qemu_img('create', '-f', iotests.imgfmt, ro_top_path,
169 self.vm.cmd('blockdev-add',
170 node_name='ro-top',
176 'read-only': True
180 result = self.vm.qmp('block-stream', job_id='stream',
181 device='ro-top', base_node='base')
182 self.assert_qmp(result, 'error/desc', 'Block node is read-only')
184 self.vm.cmd('blockdev-del', node_name='ro-top')
188 num_ops = 4 # Number of parallel block-stream operations
197 # Initialize file names and command-line options
199 img_depth = self.num_imgs - i - 1
200 opts.append("backing." * img_depth + "node-name=node%d" % i)
201 self.imgs.append(os.path.join(iotests.test_dir, 'img-%d.img' % i))
206 qemu_img('create', '-f', iotests.imgfmt,
207 '-o', 'backing_file=%s' % self.imgs[i-1],
208 '-F', 'raw' if i == 1 else iotests.imgfmt, self.imgs[i])
216 qemu_io('-f', iotests.imgfmt,
217 '-c', 'write -P 0xFF %dM %dM' % (i * 4, num_mb),
220 # Attach the drive to the VM
221 self.vm = iotests.VM()
222 self.vm.add_drive(self.imgs[-1], ','.join(opts))
223 self.vm.launch()
226 self.vm.shutdown()
230 # Test that it's possible to run several block-stream operations
239 qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', self.imgs[i]).stdout,
240 qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', self.imgs[i-1]).stdout,
241 'image file map matches backing file before streaming')
247 job_id = 'stream-%s' % node_name
249 self.vm.cmd('block-stream', device=node_name,
250 job_id=job_id, bottom=f'node{i-1}',
258 # advance so far that it completes before we can unthrottle it - which
263 self.vm.cmd('block-job-set-speed', device=job, speed=0)
267 for event in self.vm.get_qmp_events(wait=True):
275 self.vm.shutdown()
280 qemu_io('-f', iotests.imgfmt, '-c', 'map', self.imgs[i]).stdout,
281 qemu_io('-f', iotests.imgfmt, '-c', 'map', self.imgs[i-1]).stdout,
282 'image file map does not match backing file after streaming')
284 # Test that it's not possible to perform two block-stream
290 self.vm.cmd('block-stream', device='node4',
291 job_id='stream-node4', base=self.imgs[1],
292 filter_node_name='stream-filter', speed=1024*1024)
294 … result = self.vm.qmp('block-stream', device='node5', job_id='stream-node5', base=self.imgs[2])
296 "Node 'stream-filter' is busy: block device is in use by block job: stream")
298 … result = self.vm.qmp('block-stream', device='node3', job_id='stream-node3', base=self.imgs[2])
302 result = self.vm.qmp('block-stream', device='node4', job_id='stream-node4-v2')
306 # block-commit should also fail if it touches nodes used by the stream job
307 … result = self.vm.qmp('block-commit', device='drive0', base=self.imgs[4], job_id='commit-node4')
309 "Node 'stream-filter' is busy: block device is in use by block job: stream")
311 …result = self.vm.qmp('block-commit', device='drive0', base=self.imgs[1], top=self.imgs[3], job_id=…
316 …result = self.vm.qmp('block-commit', device='drive0', base=self.imgs[0], top=self.imgs[1], job_id=…
320 self.vm.cmd('block-job-set-speed', device='stream-node4', speed=0)
322 self.wait_until_completed(drive='stream-node4')
325 # Similar to test_overlapping_1, but with block-commit
332 …self.vm.cmd('block-commit', device='drive0', top=self.imgs[5], base=self.imgs[3], job_id='commit-n…
334 result = self.vm.qmp('block-stream', device='node3', job_id='stream-node3')
338 … result = self.vm.qmp('block-stream', device='node6', base=self.imgs[2], job_id='stream-node6')
342 … result = self.vm.qmp('block-stream', device='node4', base=self.imgs[2], job_id='stream-node4')
346 … result = self.vm.qmp('block-stream', device='node6', base=self.imgs[4], job_id='stream-node6-v2')
350 # This fails because block-commit currently blocks the active layer even if it's not used
351 … result = self.vm.qmp('block-stream', device='drive0', base=self.imgs[5], job_id='stream-drive0')
355 self.vm.cmd('block-job-set-speed', device='commit-node3', speed=0)
357 self.wait_until_completed(drive='commit-node3')
359 # Similar to test_overlapping_2, but here block-commit doesn't use the 'top' parameter.
366 …self.vm.cmd('block-commit', device='drive0', base=self.imgs[3], job_id='commit-drive0', speed=1024…
368 … result = self.vm.qmp('block-stream', device='node5', base=self.imgs[3], job_id='stream-node6')
372 self.vm.cmd('block-job-set-speed', device='commit-drive0', speed=0)
374 event = self.vm.event_wait(name='BLOCK_JOB_READY')
375 self.assert_qmp(event, 'data/device', 'commit-drive0')
379 self.vm.cmd('block-job-complete', device='commit-drive0')
381 self.wait_until_completed(drive='commit-drive0')
390 self.vm.cmd('block-commit', device='drive0',
392 filter_node_name='commit-filter', speed=1024*1024)
395 result = self.vm.qmp('block-stream', device='node4', base_node='node2', job_id='node4')
397 "Cannot freeze 'backing' link to 'commit-filter'")
399 self.vm.cmd('block-job-set-speed', device='drive0', speed=0)
412 self.vm.cmd('block-commit', device='drive0',
414 filter_node_name='commit-filter', speed=1024*1024)
417 self.vm.cmd('block-stream', device='node4',
418 base_node='commit-filter', job_id='node4')
420 self.vm.cmd('block-job-set-speed', device='drive0', speed=0)
422 self.vm.run_job(job='drive0', auto_dismiss=True)
423 self.vm.run_job(job='node4', auto_dismiss=True)
427 result = self.vm.qmp('query-named-block-nodes')
428 node4 = next(node for node in result['return'] if node['node-name'] == 'node4')
429 self.assertEqual(node4['image']['backing-image']['filename'], self.imgs[0])
431 # Test a block-stream and a block-commit job in parallel
439 self.vm.cmd('block-stream', device='node2', base_node='node0', job_id='node2')
442 self.vm.cmd('block-commit', device='drive0', base=self.imgs[3])
447 for event in self.vm.get_qmp_events(wait=True):
458 self.vm.qmp('block-job-complete', device='drive0')
469 … self.vm.cmd('block-stream', device='node4', base_node='node0', job_id='node4', speed=1024*1024)
472 self.vm.cmd('block-commit', device='drive0', base=self.imgs[5], speed=1024*1024)
475 self.vm.cmd('block-job-set-speed', device=job, speed=0)
480 for event in self.vm.get_qmp_events(wait=True):
491 self.vm.qmp('block-job-complete', device='drive0')
500 qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', self.imgs[4]).stdout,
501 qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', self.imgs[3]).stdout,
502 'image file map matches backing file before streaming')
505 result = self.vm.qmp('block-stream', device='node4', base_node='none', job_id='stream')
507 'Cannot find device=\'\' nor node-name=\'none\'')
510 result = self.vm.qmp('block-stream', device='node4', base_node='node6', job_id='stream')
515 result = self.vm.qmp('block-stream', device='node4', base_node='node4', job_id='stream')
519 # Error: cannot specify 'base' and 'base-node' at the same time
520 …result = self.vm.qmp('block-stream', device='node4', base=self.imgs[2], base_node='node2', job_id=…
522 "'base' and 'base-node' cannot be specified at the same time")
525 self.vm.cmd('block-stream', device='node4', base_node='node2', job_id='stream')
530 self.vm.shutdown()
533 qemu_io('-f', iotests.imgfmt, '-c', 'map', self.imgs[4]).stdout,
534 qemu_io('-f', iotests.imgfmt, '-c', 'map', self.imgs[3]).stdout,
535 'image file map matches backing file after streaming')
544 opts = ['driver=quorum', 'vote-threshold=2']
546 # Initialize file names and command-line options
548 child_img = os.path.join(iotests.test_dir, 'img-%d.img' % i)
549 backing_img = os.path.join(iotests.test_dir, 'backing-%d.img' % i)
552 qemu_img('create', '-f', iotests.imgfmt, backing_img, '1M')
553 qemu_io('-f', iotests.imgfmt,
554 '-c', 'write -P 0x55 0 1024', backing_img)
555 qemu_img('create', '-f', iotests.imgfmt,
556 '-o', 'backing_file=%s' % backing_img,
557 '-F', iotests.imgfmt, child_img)
559 opts.append("children.%d.node-name=node%d" % (i, i))
561 # Attach the drive to the VM
562 self.vm = iotests.VM()
563 self.vm.add_drive(path = None, opts = ','.join(opts))
564 self.vm.launch()
567 self.vm.shutdown()
575 qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', self.children[0]).stdout,
576 qemu_io('-f', iotests.imgfmt, '-rU', '-c', 'map', self.backing[0]).stdout,
577 'image file map matches backing file before streaming')
581 self.vm.cmd('block-stream', device='node0', job_id='stream-node0')
583 self.wait_until_completed(drive='stream-node0')
586 self.vm.shutdown()
589 qemu_io('-f', iotests.imgfmt, '-c', 'map', self.children[0]).stdout,
590 qemu_io('-f', iotests.imgfmt, '-c', 'map', self.backing[0]).stdout,
591 'image file map does not match backing file after streaming')
599 qemu_img('create', '-f', iotests.imgfmt,
600 '-o', 'backing_file=%s' % backing_img,
601 '-F', 'raw', test_img, str(self.image_len))
602 self.vm = iotests.VM().add_drive(test_img)
603 self.vm.launch()
610 self.vm.cmd('block-stream', device='drive0')
615 self.vm.shutdown()
626 [inject-error]
634 [set-state]
639 [set-state]
651 qemu_img('create', '-f', iotests.imgfmt,
652 '-o', 'backing_file=blkdebug:%s:%s,backing_fmt=raw'
655 self.vm = iotests.VM().add_drive(test_img)
656 self.vm.launch()
659 self.vm.shutdown()
667 self.vm.cmd('block-stream', device='drive0')
672 for event in self.vm.get_qmp_events(wait=True):
689 self.vm.shutdown()
694 self.vm.cmd('block-stream', device='drive0', on_error='ignore')
699 for event in self.vm.get_qmp_events(wait=True):
704 result = self.vm.qmp('query-block-jobs')
722 self.vm.shutdown()
727 self.vm.cmd('block-stream', device='drive0', on_error='stop')
732 for event in self.vm.get_qmp_events(wait=True):
738 if self.vm.qmp('query-block-jobs')['return'][0]['status'] != 'paused':
739 self.vm.events_wait([(
744 result = self.vm.qmp('query-block-jobs')
747 self.assert_qmp(result, 'return[0]/io-status', 'failed')
749 self.vm.cmd('block-job-resume', device='drive0')
751 result = self.vm.qmp('query-block-jobs')
757 self.assert_qmp(result, 'return[0]/io-status', 'ok')
770 self.vm.shutdown()
775 self.vm.cmd('block-stream', device='drive0', on_error='enospc')
780 for event in self.vm.get_qmp_events(wait=True):
797 self.vm.shutdown()
804 qemu_img('create', '-f', iotests.imgfmt,
805 '-o', 'backing_file=blkdebug:%s:%s,backing_fmt=raw'
808 self.vm = iotests.VM().add_drive(test_img)
809 self.vm.launch()
812 self.vm.shutdown()
820 self.vm.cmd('block-stream', device='drive0', on_error='enospc')
825 for event in self.vm.get_qmp_events(wait=True):
831 if self.vm.qmp('query-block-jobs')['return'][0]['status'] != 'paused':
832 self.vm.events_wait([(
837 result = self.vm.qmp('query-block-jobs')
840 self.assert_qmp(result, 'return[0]/io-status', 'nospace')
842 self.vm.cmd('block-job-resume', device='drive0')
844 result = self.vm.qmp('query-block-jobs')
850 self.assert_qmp(result, 'return[0]/io-status', 'ok')
863 self.vm.shutdown()
870 qemu_io('-f', 'raw', '-c', 'write -P 0x1 0 32M', backing_img)
871 qemu_img('create', '-f', iotests.imgfmt,
872 '-o', 'backing_file=%s' % backing_img,
873 '-F', 'raw', test_img)
874 qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0x1 32M 32M', test_img)
875 self.vm = iotests.VM().add_drive("blkdebug::" + test_img)
876 self.vm.launch()
879 self.vm.shutdown()
886 self.vm.pause_drive('drive0')
887 self.vm.cmd('block-stream', device='drive0')
890 events = self.vm.get_qmp_events(wait=False)
902 qemu_io('-f', 'raw', '-c', 'write -P 0x1 0 32M', backing_img)
903 qemu_img('create', '-f', iotests.imgfmt,
904 '-o', 'backing_file=%s' % backing_img,
905 '-F', 'raw', test_img)
906 qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0x1 32M 32M', test_img)
907 self.vm = iotests.VM().add_drive('blkdebug::' + test_img)
908 self.vm.launch()
911 self.vm.shutdown()
920 self.vm.cmd('block-stream', device='drive0')
922 self.vm.cmd('block-job-set-speed', device='drive0', speed=8 * 1024 * 1024)
931 self.vm.pause_drive('drive0')
932 self.vm.cmd('block-stream', device='drive0')
935 result = self.vm.qmp('query-block-jobs')
939 self.vm.cmd('block-job-set-speed', device='drive0', speed=8 * 1024 * 1024)
942 result = self.vm.qmp('query-block-jobs')
947 self.vm.pause_drive('drive0')
949 # Check setting speed in block-stream works
950 self.vm.cmd('block-stream', device='drive0', speed=4 * 1024 * 1024)
952 result = self.vm.qmp('query-block-jobs')
961 result = self.vm.qmp('block-stream', device='drive0', speed=-1)
962 self.assert_qmp(result, 'error/desc', "Parameter 'speed' expects a non-negative value")
966 self.vm.pause_drive('drive0')
967 self.vm.cmd('block-stream', device='drive0')
969 result = self.vm.qmp('block-job-set-speed', device='drive0', speed=-1)
970 self.assert_qmp(result, 'error/desc', "Parameter 'speed' expects a non-negative value")