예제 #1
0
파일: test_vm.py 프로젝트: elstevi/libbhyve
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()
예제 #2
0
파일: bcli.py 프로젝트: elstevi/bcli
def stop(vm_name):
    """ Stop a VM """
    myvm = VM(vm_name)
    myvm.stop()