def wait_for_vms(machine, who='all', timeout=120): """wait for vm/vms to come up after a power operation""" domlist = find_guest_vms(machine) for domain in domlist: if who == 'all' or domain['name'] == who: vmip = domains.domain_address(machine, domain['name']) wait_for_windows_to_come_up(vmip, timeout=timeout)
def vm_reinstate_hibernate(dut,who='all'): """used to reinstate hibernate after vm_sleep_self call""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: vmip = domains.domain_address(dut,domain['name']) call_exec_daemon('run', [r'powercfg -h on'], vmip)
def wait_for_vms(machine, who='all', timeout=120): """wait for vm/vms to come up after a power operation""" domlist = find_guest_vms(machine) for domain in domlist: if who == 'all' or domain['name'] == who: vmip = domains.domain_address(machine, domain['name']) wait_for_windows_to_come_up(vmip, timeout=timeout)
def vm_reinstate_hibernate(dut, who='all'): """used to reinstate hibernate after vm_sleep_self call""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: vmip = domains.domain_address(dut, domain['name']) call_exec_daemon('run', [r'powercfg -h on'], vmip)
def vm_hibernate_dom0(dut, who='all'): """hibernate vm/vms from dom0""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: run(['xec-vm', '-n', domain['name'], 'hibernate'], host=dut) for domain in domlist: if who == 'all' or domain['name'] == who: wait_for_guest_to_go_down(dut, domain['name'])
def vm_poweroff(dut, who='all'): """force poweroff a VM from domo""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: run(['xec-vm', '-n', domain['name'], 'destroy'], host=dut, timeout=20) for domain in domlist: if who == 'all' or domain['name'] == who: wait_for_guest_to_go_down(dut, domain['name'])
def vm_shutdown_dom0(dut, who='all'): """shutdown vm/vms from dom0""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: run(['xec-vm', '-n', domain['name'], 'shutdown'], host=dut) for domain in domlist: if who == 'all' or domain['name'] == who: wait_for_guest_to_go_down(dut, domain['name'])
def vm_reboot_dom0(dut, who='all'): """reboot vm/vms from dom0""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: run(['xec-vm', '-n', domain['name'], 'reboot'], host=dut) vmip = domains.domain_address(dut, domain['name']) wait_for_windows_to_go_down(vmip) wait_for_windows_to_come_up(vmip)
def vm_sleep_self(dut, who='all'): """sleep vm/vms from within the VM""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: vmip = domains.domain_address(dut, domain['name']) print "turning off hibernate :" + str(call_exec_daemon(command='run', args=[r'powercfg -h off'], host=vmip, timeout=60)) sleep(4) call_exec_daemon('run', [r'C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState sleep'], vmip)
def vm_reboot_dom0(dut, who='all'): """reboot vm/vms from dom0""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: run(['xec-vm', '-n', domain['name'], 'reboot'], host=dut) vmip = domains.domain_address(dut, domain['name']) wait_for_windows_to_go_down(vmip) wait_for_windows_to_come_up(vmip)
def vm_shutdown_self(dut, who='all'): """shutdown vm/vms from within the VM""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: vmip = domains.domain_address(dut, domain['name']) call_exec_daemon('run', ['shutdown -s'], host=vmip, timeout=60) for domain in domlist: if who == 'all' or domain['name'] == who: wait_for_guest_to_go_down(dut, domain['name'])
def vm_sleep_dom0(dut, who='all'): """sleep vm/vms from dom0""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: run(['xec-vm', '-n', domain['name'], 'sleep'], host=dut) for domain in domlist: if who == 'all' or domain['name'] == who: vmip = domains.domain_address(dut, domain['name']) wait_for_windows_to_go_down(vmip)
def vm_hibernate_self(dut, who='all'): """hibernate vm/vms from within the VM""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: vmip = domains.domain_address(dut, domain['name']) call_exec_daemon('run', [r'C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState hibernate'], host=vmip, timeout=60) for domain in domlist: if who == 'all' or domain['name'] == who: wait_for_guest_to_go_down(dut, domain['name'])
def vm_shutdown_self(dut, who='all'): """shutdown vm/vms from within the VM""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: vmip = domains.domain_address(dut, domain['name']) call_exec_daemon('run', ['shutdown -s'], host=vmip, timeout=60) for domain in domlist: if who == 'all' or domain['name'] == who: wait_for_guest_to_go_down(dut, domain['name'])
def vm_sleep_dom0(dut, who='all'): """sleep vm/vms from dom0""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: run(['xec-vm', '-n', domain['name'], 'sleep'], host=dut) for domain in domlist: if who == 'all' or domain['name'] == who: vmip = domains.domain_address(dut, domain['name']) wait_for_windows_to_go_down(vmip)
def vm_poweroff(dut, who='all'): """force poweroff a VM from domo""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: run(['xec-vm', '-n', domain['name'], 'destroy'], host=dut, timeout=20) for domain in domlist: if who == 'all' or domain['name'] == who: wait_for_guest_to_go_down(dut, domain['name'])
def vm_hibernate_self(dut, who='all'): """hibernate vm/vms from within the VM""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: vmip = domains.domain_address(dut, domain['name']) call_exec_daemon('run', [ r'C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState hibernate' ], host=vmip, timeout=60) for domain in domlist: if who == 'all' or domain['name'] == who: wait_for_guest_to_go_down(dut, domain['name'])
def vm_sleep_self(dut, who='all'): """sleep vm/vms from within the VM""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: vmip = domains.domain_address(dut, domain['name']) print "turning off hibernate :" + str( call_exec_daemon(command='run', args=[r'powercfg -h off'], host=vmip, timeout=60)) sleep(4) call_exec_daemon('run', [ r'C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState sleep' ], vmip)
def vm_poweron(dut, who='all'): """power on vm/vms""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: start_vm(dut, domain['name'])
def vm_poweron(dut, who='all'): """power on vm/vms""" domlist = find_guest_vms(dut) for domain in domlist: if who == 'all' or domain['name'] == who: start_vm(dut, domain['name'])