Пример #1
0
def vm(project, manager, fake_qemu_binary, fake_qemu_img_binary):
    manager.port_manager.console_host = "127.0.0.1"
    vm = QemuVM("test",
                "00010203-0405-0607-0809-0a0b0c0d0e0f",
                project,
                manager,
                qemu_path=fake_qemu_binary)
    vm._process_priority = "normal"  # Avoid complexity for Windows tests
    return vm
Пример #2
0
def vm(project, manager, fake_qemu_binary, fake_qemu_img_binary):
    manager.port_manager.console_host = "127.0.0.1"
    return QemuVM("test",
                  "00010203-0405-0607-0809-0a0b0c0d0e0f",
                  project,
                  manager,
                  qemu_path=fake_qemu_binary)
Пример #3
0
def test_vm(project, manager, fake_qemu_binary):
    vm = QemuVM("test",
                "00010203-0405-0607-0809-0a0b0c0d0e0f",
                project,
                manager,
                qemu_path=fake_qemu_binary)
    assert vm.name == "test"
    assert vm.id == "00010203-0405-0607-0809-0a0b0c0d0e0f"
Пример #4
0
def test_vm_invalid_qemu_without_platform(project, manager, fake_qemu_binary):

    vm = QemuVM("test",
                "00010203-0405-0607-0809-0a0b0c0d0e0f",
                project,
                manager,
                qemu_path="/usr/fake/bin/qemu-system-x86_64")

    assert vm.qemu_path == fake_qemu_binary
    assert vm.platform == "x86_64"
Пример #5
0
def test_set_platform(project, manager):

    with patch("shutil.which", return_value="/bin/qemu-system-x86_64") as which_mock:
        with patch("gns3server.modules.qemu.QemuVM._check_qemu_path"):
            vm = QemuVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager, platform="x86_64")
            if sys.platform.startswith("win"):
                which_mock.assert_called_with("qemu-system-x86_64w.exe")
            else:
                which_mock.assert_called_with("qemu-system-x86_64")
    assert vm.platform == "x86_64"
    assert vm.qemu_path == "/bin/qemu-system-x86_64"
Пример #6
0
def vm(project, manager, fake_qemu_binary, fake_qemu_img_binary):
    manager.port_manager.console_host = "127.0.0.1"
    vm = QemuVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager, qemu_path=fake_qemu_binary)
    vm._process_priority = "normal"  # Avoid complexity for Windows tests
    return vm