示例#1
0
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)
示例#2
0
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)
示例#3
0
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)
示例#4
0
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)
示例#5
0
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'])
示例#6
0
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'])
示例#7
0
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'])
示例#8
0
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)
示例#9
0
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)
示例#10
0
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)
示例#11
0
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'])
示例#12
0
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)
示例#13
0
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'])
示例#14
0
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'])
示例#15
0
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)
示例#16
0
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'])
示例#17
0
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'])
示例#18
0
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)
示例#19
0
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'])
示例#20
0
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'])