Exemplo n.º 1
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.º 2
0
Arquivo: bcli.py Projeto: elstevi/bcli
def stop(vm_name):
    """ Stop a VM """
    myvm = VM(vm_name)
    myvm.stop()