mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Merge branch 'master' into 2.0
This commit is contained in:
commit
4bd9556767
@ -1489,6 +1489,11 @@ class QemuVM(BaseNode):
|
||||
command.extend(["-smp", "cpus={}".format(self._cpus)])
|
||||
if self._run_with_kvm(self.qemu_path, self._options):
|
||||
command.extend(["-enable-kvm"])
|
||||
version = yield from self.manager.get_qemu_version(self.qemu_path)
|
||||
# Issue on some combo Intel CPU + KVM + Qemu 2.4.0
|
||||
# https://github.com/GNS3/gns3-server/issues/685
|
||||
if version and parse_version(version) >= parse_version("2.4.0"):
|
||||
command.extend(["-machine smm=off"])
|
||||
command.extend(["-boot", "order={}".format(self._boot_priority)])
|
||||
cdrom_option = self._cdrom_option()
|
||||
command.extend(cdrom_option)
|
||||
|
@ -265,7 +265,7 @@ class VirtualBoxVM(BaseNode):
|
||||
log.debug("Stop result: {}".format(result))
|
||||
|
||||
log.info("VirtualBox VM '{name}' [{id}] stopped".format(name=self.name, id=self.id))
|
||||
# yield from asyncio.sleep(0.5) # give some time for VirtualBox to unlock the VM
|
||||
yield from asyncio.sleep(0.5) # give some time for VirtualBox to unlock the VM
|
||||
try:
|
||||
# deactivate the first serial port
|
||||
yield from self._modify_vm("--uart1 off")
|
||||
|
@ -22,7 +22,7 @@ import os
|
||||
import sys
|
||||
import stat
|
||||
import re
|
||||
from tests.utils import asyncio_patch
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
|
||||
|
||||
from unittest import mock
|
||||
@ -436,6 +436,65 @@ def test_build_command(vm, loop, fake_qemu_binary, port_manager):
|
||||
]
|
||||
|
||||
|
||||
def test_build_command_kvm(linux_platform, vm, loop, fake_qemu_binary, port_manager):
|
||||
"""
|
||||
Qemu 2.4 introduce an issue with KVM
|
||||
"""
|
||||
vm._run_with_kvm = MagicMock(return_value=True)
|
||||
vm.manager.get_qemu_version = AsyncioMagicMock(return_value="2.3.2")
|
||||
os.environ["DISPLAY"] = "0:0"
|
||||
with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()) as process:
|
||||
cmd = loop.run_until_complete(asyncio.async(vm._build_command()))
|
||||
assert cmd == [
|
||||
fake_qemu_binary,
|
||||
"-name",
|
||||
"test",
|
||||
"-m",
|
||||
"256M",
|
||||
"-smp",
|
||||
"cpus=1",
|
||||
"-enable-kvm",
|
||||
"-boot",
|
||||
"order=c",
|
||||
"-serial",
|
||||
"telnet:127.0.0.1:{},server,nowait".format(vm.console),
|
||||
"-net",
|
||||
"none",
|
||||
"-device",
|
||||
"e1000,mac={}".format(vm._mac_address)
|
||||
]
|
||||
|
||||
|
||||
def test_build_command_kvm_2_4(linux_platform, vm, loop, fake_qemu_binary, port_manager):
|
||||
"""
|
||||
Qemu 2.4 introduce an issue with KVM
|
||||
"""
|
||||
vm._run_with_kvm = MagicMock(return_value=True)
|
||||
vm.manager.get_qemu_version = AsyncioMagicMock(return_value="2.4.2")
|
||||
os.environ["DISPLAY"] = "0:0"
|
||||
with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()) as process:
|
||||
cmd = loop.run_until_complete(asyncio.async(vm._build_command()))
|
||||
assert cmd == [
|
||||
fake_qemu_binary,
|
||||
"-name",
|
||||
"test",
|
||||
"-m",
|
||||
"256M",
|
||||
"-smp",
|
||||
"cpus=1",
|
||||
"-enable-kvm",
|
||||
"-machine smm=off",
|
||||
"-boot",
|
||||
"order=c",
|
||||
"-serial",
|
||||
"telnet:127.0.0.1:{},server,nowait".format(vm.console),
|
||||
"-net",
|
||||
"none",
|
||||
"-device",
|
||||
"e1000,mac={}".format(vm._mac_address)
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
||||
def test_build_command_without_display(vm, loop, fake_qemu_binary):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user