def __init__(self, test, params): self.cpu_num = int(params.get("cpu_num", "1")) self.cgroup_name = params.get("cgroup_name") self.cgroup_dir = params.get("cgroup_dir") self.time_out = int(params.get("time_out", "600")) self.vm_name = params.get("main_vm") self.time_out = int(params.get("time_out", "600")) self.twice_execute = "yes" == params.get("twice_execute", "no") self.kill_first = "yes" == params.get("kill_first", "no") self.cpu_status = cpu._get_cpu_status(self.cpu_num) self.dump_file = os.path.join(test.virtdir, params.get("dump_file", "dump.info")) self.dump_file1 = self.dump_file + "1" self.test = test env = params.get("env") vm = env.get_vm(self.vm_name) vm.wait_for_login()
def __init__(self, test, params): self.td = None self.cpu_num = int(params.get("cpu_num", "1")) self.vm_name = params.get("main_vm") self.vm_new_name = params.get("vm_new_name") self.cgroup_name = params.get("cgroup_name") self.cgroup_dir = params.get("cgroup_dir") self.new_image_file = params.get("new_image_file") if self.new_image_file: self.new_image_file = os.path.join(test.virtdir, self.new_image_file) self.time_out = int(params.get("time_out", "600")) self.cpu_status = cpu._get_cpu_status(self.cpu_num) self.twice_execute = "yes" == params.get("twice_execute", "no") self.kill_first = "yes" == params.get("kill_first", "no") if params.get("abnormal_type") in ["disk_lack", ""]: self.selinux_enforcing = utils_selinux.is_enforcing() if self.selinux_enforcing: utils_selinux.set_status("permissive") self.fs_type = params.get("fs_type", "ext4") xml_file = vm_xml.VMXML.new_from_inactive_dumpxml(self.vm_name) disk_node = xml_file.get_disk_all()['vda'] source_file = disk_node.find('source').get('file') self.image_size = utils_misc.get_image_info(source_file)['dsize'] # Set the size to be image_size iscsi_size = "%sM" % (self.image_size / 1024 / 1024) params['image_size'] = iscsi_size self.iscsi_dev = qemu_storage.Iscsidev(params, test.virtdir, "iscsi") try: device_source = self.iscsi_dev.setup() except (exceptions.TestError, ValueError) as detail: self.iscsi_dev.cleanup() self.test.cancel("Cannot get iscsi device on this" " host:%s\n" % detail) libvirt.mk_label(device_source) libvirt.mk_part(device_source, iscsi_size) self.mount_dir = os.path.join(test.virtdir, params.get('mount_dir')) if not os.path.exists(self.mount_dir): os.mkdir(self.mount_dir) params['mount_dir'] = self.mount_dir self.partition = device_source + "1" libvirt.mkfs(self.partition, self.fs_type) utils_misc.mount(self.partition, self.mount_dir, self.fs_type) self.new_image_file = os.path.join(self.mount_dir, "new_file")
def __init__(self, test, params): self.cpu_num = int(params.get("cpu_num", "1")) self.cgroup_name = params.get("cgroup_name") self.cgroup_dir = params.get("cgroup_dir") self.time_out = int(params.get("time_out", "600")) self.vm_name = params.get("main_vm") self.time_out = int(params.get("time_out", "600")) self.twice_execute = "yes" == params.get("twice_execute", "no") self.kill_first = "yes" == params.get("kill_first", "no") self.test = test xml_file = vm_xml.VMXML.new_from_inactive_dumpxml(self.vm_name) disk_node = xml_file.get_disk_all()['vda'] source_file = disk_node.find('source').get('file') image_type = utils_misc.get_image_info(source_file)['format'] if image_type != "qcow2": self.test.cancel("Disk image format is not qcow2, " "ignore snapshot test!") self.cpu_status = cpu._get_cpu_status(self.cpu_num) self.current_snp_list = [] self.snp_list = virsh.snapshot_list(self.vm_name) env = params.get("env") vm = env.get_vm(self.vm_name) # This can add snapshot create time vm.wait_for_login()