Exemplo n.º 1
0
def test_freebsd_vm():
    fp = abspath('tests/freebsd.conf')
    vm = VM(fp)
    vm.save()
    yield vm
    if vm.status() == "Stopped":
        vm.start()
    vm.delete()
Exemplo n.º 2
0
def test_vm_stop_non_graceful_fail(monkeypatch):
    # We want to catch the VM
    fp = abspath('tests/freebsd.conf')
    test_freebsd_vm = VM(fp)
    if test_freebsd_vm.status() == "Stopped":
        test_freebsd_vm.start()

    def mockfalse():
        return 111

    monkeypatch.setattr(test_freebsd_vm, 'get_pid', mockfalse)
    with pytest.raises(OSError,
                       match="VM did not die when it was supposed to"):
        test_freebsd_vm.stop()
    monkeypatch.undo()
Exemplo n.º 3
0
Arquivo: bcli.py Projeto: elstevi/bcli
def start(vm_name):
    """ Start a VM """
    myvm = VM(vm_name)
    myvm.start()