mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Prevent using different hypervisors that leverage hardware virtualization.
- Implemented for Qemu when a VMware or VirtualBox VM with hardware virtualization is already running. - Implemented for VirtualBox only when a Qemu VM with KVM is already running.
This commit is contained in:
1 parent
accaa2159b
commit
8e236a7045
8 files changed
+81
-6
No files matched your search
@@ -169,6 +169,19 @@ class VirtualBoxVM(BaseVM):
|
||||
if "memory" in vm_info:
|
||||
self._ram = int(vm_info["memory"])
|
||||
|
||||
@asyncio.coroutine
|
||||
def check_hw_virtualization(self):
|
||||
"""
|
||||
Returns either hardware virtualization is activated or not.
|
||||
|
||||
:returns: boolean
|
||||
"""
|
||||
|
||||
vm_info = yield from self._get_vm_info()
|
||||
if "hwvirtex" in vm_info and vm_info["hwvirtex"] == "on":
|
||||
return True
|
||||
return False
|
||||
|
||||
@asyncio.coroutine
|
||||
def start(self):
|
||||
"""
|
||||
@@ -203,12 +216,16 @@ class VirtualBoxVM(BaseVM):
|
||||
if self._enable_remote_console and self._console is not None:
|
||||
self._start_remote_console()
|
||||
|
||||
if (yield from self.check_hw_virtualization()):
|
||||
self._hw_virtualization = True
|
||||
|
||||
@asyncio.coroutine
|
||||
def stop(self):
|
||||
"""
|
||||
Stops this VirtualBox VM.
|
||||
"""
|
||||
|
||||
self._hw_virtualization = False
|
||||
self._stop_remote_console()
|
||||
vm_state = yield from self._get_vm_state()
|
||||
if vm_state == "running" or vm_state == "paused" or vm_state == "stuck":
|
||||
|
||||
Reference in new issue
Block a user