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', 60)) self.check_filter_nodes_name() self.wait_stream_job_completed() self.check_filter_nodes_name(during_stream=False)
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("quit") self.start_vm_with_snapshot() self.stream_with_clone_vm() 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', 60) ) self.test_invalid_speeds() self.test_valid_speeds() self.wait_stream_job_completed() self.check_backing_file() self.clone_vm.create() self.mount_data_disks() self.verify_data_file()
def commit_snapshot_and_destory_vm(self): device = self.params.get("device_tag") device_params = self.params.object_params(device) snapshot_tags = device_params["snapshot_tags"].split() self.device_node = self.get_node_name(device) options = ["base-node", "top-node", "speed"] arguments = self.params.copy_from_keys(options) arguments["speed"] = self.params["commit_speed"] device = self.get_node_name(snapshot_tags[-1]) commit_cmd = backup_utils.block_commit_qmp_cmd cmd, args = commit_cmd(device, **arguments) self.main_vm.monitor.cmd(cmd, args) job_id = args.get("job-id", device) job_utils.check_block_jobs_started(self.main_vm, [job_id]) self.main_vm.destroy(gracefully=False)
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', 60)) self.hotunplug_frontend_device() self.wait_till_frontend_device_deleted() self.hotunplug_format_node() job_utils.check_block_jobs_running( self.main_vm, [self._job], self.params.get_numeric('job_running_timeout', 300)) self.main_vm.monitor.cmd("block-job-set-speed", { 'device': self._job, 'speed': 0 }) self.wait_stream_job_completed() self.check_backing_file() self.clone_vm.create() self.mount_data_disks() self.verify_data_file()
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 commit_snapshots(self): device = self.params.get("device_tag") device_params = self.params.object_params(device) snapshot_tags = device_params["snapshot_tags"].split() self.device_node = self.get_node_name(device) options = ["speed"] arguments = self.params.copy_from_keys(options) arguments["speed"] = self.params["speed"] device = self.get_node_name(snapshot_tags[-1]) commit_cmd = backup_utils.block_commit_qmp_cmd cmd, args = commit_cmd(device, **arguments) self.main_vm.monitor.cmd(cmd, args) job_id = args.get("job-id", device) job_utils.check_block_jobs_started(self.main_vm, [job_id]) small_speed = self.params.get_numeric("small_speed") large_speed = self.params.get_numeric("large_speed") commit_speed = self.params.get( "commit_speed", random.randint(small_speed, large_speed)) if self.params.get_boolean("speed_is_int", True): commit_speed = int(commit_speed) try: self.main_vm.monitor.cmd("block-job-set-speed", { 'device': job_id, 'speed': commit_speed }) except QMPCmdError as e: logging.info("Error message is %s", e.data) if self.params.get("error_msg") not in str(e.data): self.test.fail("Error message not as expected") else: output = job_utils.query_block_jobs(self.main_vm) if output[0]["speed"] != commit_speed: self.test.fail("Commit speed set failed") self.main_vm.monitor.cmd("block-job-set-speed", { 'device': job_id, 'speed': 0 }) job_utils.wait_until_block_job_completed(self.main_vm, job_id)
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_started(self, jobid_list, tmo=10): """ Test failed if any block job failed to start """ job_utils.check_block_jobs_started(self.main_vm, jobid_list, tmo)