• Home
  • Raw
  • Download

Lines Matching full:vm

33     Get a VM object from the environment and make sure it's alive.
36 @param vm_name: Name of the desired VM object.
37 @return: A VM object.
39 vm = env.get_vm(vm_name)
40 if not vm:
41 raise error.TestError("VM '%s' not found in environment" % vm_name)
42 if not vm.is_alive():
43 raise error.TestError("VM '%s' seems to be dead; test requires a "
44 "living VM" % vm_name)
45 return vm
48 def wait_for_login(vm, nic_index=0, timeout=240, start=0, step=2, serial=None): argument
50 Try logging into a VM repeatedly. Stop on success or when timeout expires.
52 @param vm: VM object.
53 @param nic_index: Index of NIC to access in the VM.
64 " timeout %ds", vm.name, timeout)
68 session = vm.serial_login()
76 " timeout %ds", vm.name, timeout)
80 session = vm.login(nic_index=nic_index)
87 (vm.name, type))
88 logging.info("Logged into guest %s using %s connection", vm.name, type)
92 def reboot(vm, session, method="shell", sleep_before_reset=10, nic_index=0, argument
95 Reboot the VM and wait for it to come back up by trying to log in until
98 @param vm: VM object.
102 @param nic_index: Index of NIC to access in the VM, when logging in after
109 session.sendline(vm.get_params().get("reboot_command"))
115 monitors = [m for m in vm.monitors if m.protocol == "qmp"]
119 vm.monitor.cmd("system_reset")
142 session = vm.wait_for_login(nic_index, timeout=timeout)
147 def migrate(vm, env=None, mig_timeout=3600, mig_protocol="tcp", argument
151 Migrate a VM locally and re-register it in the environment.
153 @param vm: The VM to migrate.
154 @param env: The environment dictionary. If omitted, the migrated VM will
161 @return: The post-migration VM, in case of same host migration, True in
165 o = vm.monitor.info("migrate")
172 o = vm.monitor.info("migrate")
179 o = vm.monitor.info("migrate")
186 o = vm.monitor.info("migrate")
201 dest_vm = vm.clone()
204 # Pause the dest vm after creation
209 dest_vm.create(migration_mode=mig_protocol, mac_source=vm)
224 vm.monitor.cmd("stop")
225 vm.monitor.migrate(uri)
229 vm.monitor.cmd("migrate_cancel")
235 vm.monitor.cmd("cont")
238 return vm
246 vm.save_to_file(save1)
253 raise error.TestFail("Mismatch of VM state before "
281 logging.debug("Destination VM is paused, resuming it")
284 # Kill the source VM
285 vm.destroy(gracefully=False)
287 # Replace the source VM with the new cloned VM
289 env.register_vm(vm.name, dest_vm)
291 # Return the new cloned VM
295 return vm
405 @params lvms: List of VM objects
422 for vm in lvms:
423 shm = vm.get_shared_meminfo()
426 "VM %s" % vm)
433 def run_autotest(vm, session, control_path, timeout, outputdir, params): argument
437 @param vm: VM object.
438 @param session: A shell session on the VM provided.
447 def copy_if_hash_differs(vm, local_path, remote_path): argument
451 @param vm: VM object.
476 vm.copy_files_to(local_path, remote_path)
480 def extract(vm, remote_path, dest_dir): argument
485 @param vm: VM object
490 logging.debug("Extracting %s on VM %s", basename, vm.name)
515 vm.copy_files_from("%s/results/default/*" % guest_autotest_path,
571 update = copy_if_hash_differs(vm, compressed_autotest_path,
576 extract(vm, compressed_autotest_path, destination_autotest_path)
578 vm.copy_files_to(control_path,
608 vm.migrate(timeout=mig_timeout, protocol=mig_protocol)
617 if vm.is_alive():
624 "(VM terminated during job)")