mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-23 23:38:21 +00:00
Enable nested hardware virtualization by default for GNS3 VM running in VirtualBox. Fixes #1377
No error is sent by VBoxManage is this feature is not available, for instance with Intel processors.
This commit is contained in:
parent
2d777cac13
commit
6d1adea907
@ -226,8 +226,7 @@ class HyperVGNS3VM(BaseGNS3VM):
|
||||
raise GNS3VMError("Could not find Hyper-V VM {}".format(self.vmname))
|
||||
|
||||
if not self._is_running():
|
||||
|
||||
log.info("Update GNS3 VM settings")
|
||||
log.info("Update GNS3 VM settings (CPU and RAM)")
|
||||
# set the number of vCPUs and amount of RAM
|
||||
self._set_vcpus_ram(self.vcpus, self.ram)
|
||||
|
||||
|
@ -214,8 +214,10 @@ class VirtualBoxGNS3VM(BaseGNS3VM):
|
||||
log.info('"{}" state is {}'.format(self._vmname, vm_state))
|
||||
|
||||
if vm_state == "poweroff":
|
||||
log.info("Update GNS3 VM settings (CPU, RAM and Hardware Virtualization)")
|
||||
await self.set_vcpus(self.vcpus)
|
||||
await self.set_ram(self.ram)
|
||||
await self.enable_nested_hw_virt()
|
||||
|
||||
if vm_state in ("poweroff", "saved"):
|
||||
# start the VM if it is not running
|
||||
@ -339,6 +341,14 @@ class VirtualBoxGNS3VM(BaseGNS3VM):
|
||||
await self._execute("modifyvm", [self._vmname, "--memory", str(ram)], timeout=3)
|
||||
log.info("GNS3 VM RAM amount set to {}".format(ram))
|
||||
|
||||
async def enable_nested_hw_virt(self):
|
||||
"""
|
||||
Enable nested hardware virtualization for the GNS3 VM.
|
||||
"""
|
||||
|
||||
await self._execute("modifyvm", [self._vmname, "--nested-hw-virt", "on"], timeout=3)
|
||||
log.info("Nested hardware virtualization enabled")
|
||||
|
||||
async def set_hostonly_network(self, adapter_number, hostonly_network_name):
|
||||
"""
|
||||
Set a VirtualBox host-only network on a network adapter for the GNS3 VM.
|
||||
|
@ -147,7 +147,7 @@ class VMwareGNS3VM(BaseGNS3VM):
|
||||
except VMwareError as e:
|
||||
raise GNS3VMError("Could not list VMware VMs: {}".format(str(e)))
|
||||
if not running:
|
||||
log.info("Update GNS3 VM settings")
|
||||
log.info("Update GNS3 VM settings (CPU, RAM and Hardware Virtualization)")
|
||||
# set the number of vCPUs and amount of RAM
|
||||
await self._set_vcpus_ram(self.vcpus, self.ram)
|
||||
await self._set_extra_options()
|
||||
|
Loading…
Reference in New Issue
Block a user