mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
parent
6e88ba4c25
commit
04aac2f3dc
@ -43,9 +43,6 @@ import logging
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QemuVM(BaseVM):
|
class QemuVM(BaseVM):
|
||||||
module_name = 'qemu'
|
module_name = 'qemu'
|
||||||
|
|
||||||
@ -346,7 +343,6 @@ class QemuVM(BaseVM):
|
|||||||
id=self._id,
|
id=self._id,
|
||||||
mac_addr=mac_address))
|
mac_addr=mac_address))
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def legacy_networking(self):
|
def legacy_networking(self):
|
||||||
"""
|
"""
|
||||||
@ -510,7 +506,11 @@ class QemuVM(BaseVM):
|
|||||||
log.info('QEMU VM "{name}" [{id}] has set the QEMU options to {options}'.format(name=self._name,
|
log.info('QEMU VM "{name}" [{id}] has set the QEMU options to {options}'.format(name=self._name,
|
||||||
id=self._id,
|
id=self._id,
|
||||||
options=options))
|
options=options))
|
||||||
self._options = options
|
if "-enable-kvm" in options:
|
||||||
|
self.kvm = True
|
||||||
|
options = options.replace("-enable-kvm", "")
|
||||||
|
|
||||||
|
self._options = options.strip()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def initrd(self):
|
def initrd(self):
|
||||||
|
@ -173,7 +173,7 @@ def test_set_qemu_path(vm, tmpdir, fake_qemu_binary):
|
|||||||
# Should not crash with unicode characters
|
# Should not crash with unicode characters
|
||||||
path = str(tmpdir / "\u62FF" / "qemu-system-mips")
|
path = str(tmpdir / "\u62FF" / "qemu-system-mips")
|
||||||
|
|
||||||
os.makedirs( str(tmpdir / "\u62FF") )
|
os.makedirs(str(tmpdir / "\u62FF"))
|
||||||
|
|
||||||
# Raise because file doesn't exists
|
# Raise because file doesn't exists
|
||||||
with pytest.raises(QemuError):
|
with pytest.raises(QemuError):
|
||||||
@ -375,3 +375,17 @@ def test_hdd_disk_image(vm, tmpdir):
|
|||||||
assert vm.hdd_disk_image == "/tmp/test"
|
assert vm.hdd_disk_image == "/tmp/test"
|
||||||
vm.hdd_disk_image = "test"
|
vm.hdd_disk_image = "test"
|
||||||
assert vm.hdd_disk_image == str(tmpdir / "QEMU" / "test")
|
assert vm.hdd_disk_image == str(tmpdir / "QEMU" / "test")
|
||||||
|
|
||||||
|
|
||||||
|
def test_options(vm):
|
||||||
|
vm.kvm = False
|
||||||
|
vm.options = "-usb"
|
||||||
|
assert vm.options == "-usb"
|
||||||
|
assert vm.kvm is False
|
||||||
|
|
||||||
|
|
||||||
|
def test_options_kvm(vm):
|
||||||
|
vm.kvm = False
|
||||||
|
vm.options = "-usb -enable-kvm"
|
||||||
|
assert vm.options == "-usb"
|
||||||
|
assert vm.kvm is True
|
||||||
|
Loading…
Reference in New Issue
Block a user