def do_test(self): self.snapshot_test() self.blockdev_stream() check_block_jobs_started( self.main_vm, [self._job], self.params.get_numeric('job_started_timeout', 60)) self.nbd_export.suspend_export() try: check_block_jobs_paused( self.main_vm, [self._job], self.params.get_numeric('job_paused_interval', 50)) finally: self.nbd_export.resume_export() self.main_vm.monitor.cmd("block-job-set-speed", { 'device': self._job, 'speed': 0 }) self.wait_stream_job_completed() self.main_vm.destroy() self.clone_vm.create() self.mount_data_disks() self.verify_data_file()
def do_test(self): self.snapshot_test() self.blockdev_stream() job_utils.check_block_jobs_started( self.main_vm, [self._job], self.params.get_numeric('job_started_timeout', 30)) self.main_vm.monitor.cmd("job-pause", {'id': self._job}) job_utils.check_block_jobs_paused( self.main_vm, [self._job], self.params.get_numeric('job_paused_interval', 30)) self.main_vm.monitor.cmd( "block-job-set-speed", { 'device': self._job, 'speed': self.params.get_numeric('resume_speed') }) self.main_vm.monitor.cmd("job-resume", {'id': self._job}) job_utils.check_block_jobs_running( self.main_vm, [self._job], self.params.get_numeric('job_running_timeout', 300)) self.main_vm.monitor.cmd("job-cancel", {'id': self._job}) event = job_utils.get_event_by_condition(self.main_vm, 'BLOCK_JOB_CANCELLED', self.params.get_numeric( 'job_cancelled_timeout', 30), device=self._job) if not event: self.test.fail('Failed to get BLOCK_JOB_CANCELLED event for %s' % self._job) job_utils.block_job_dismiss(self.main_vm, self._job) self._stream_options['speed'] = 0 self.blockdev_stream() self.wait_stream_job_completed() self.check_backing_file() self.clone_vm.create() self.mount_data_disks() self.verify_data_file()
def check_block_jobs_paused(self, jobid_list, tmo=50): """ Test failed if any block job's offset changed """ job_utils.check_block_jobs_paused(self.main_vm, jobid_list, tmo)