Set vhv.enable before run for VMWare 14. Fixes #1184

This commit is contained in:
ziajka committed 2017-10-18 10:32:56 +02:00
1 parent 4cae6b678a
commit 44efab109e
2 files changed
+82

No files matched your search

@@ -85,6 +85,30 @@ class VMwareGNS3VM(BaseGNS3VM):
except OSError as e:
raise GNS3VMError('Could not read/write VMware VMX file "{}": {}'.format(self._vmx_path, e))
@asyncio.coroutine
def _set_extra_options(self):
try:
"""
Due to bug/chang in VMWare 14 we're not able to pass Hardware Virtualization in GNS3VM.
We only enable this when it's not present in current configuration and user hasn't deactivated that.
"""
extra_config = (
("vhv.enable", "TRUE"),
)
pairs = VMware.parse_vmware_file(self._vmx_path)
updated = False
for key, value in extra_config:
if key not in pairs.keys():
pairs[key] = value
updated = True
log.info("GNS3 VM VMX `{}` set to `{}`".format(key, value))
if updated:
VMware.write_vmx_file(self._vmx_path, pairs)
log.info("GNS3 VM VMX has been updated.")
except OSError as e:
raise GNS3VMError('Could not read/write VMware VMX file "{}": {}'.format(self._vmx_path, e))
@asyncio.coroutine
def list(self):
"""
@@ -126,6 +150,7 @@ class VMwareGNS3VM(BaseGNS3VM):
log.info("Update GNS3 VM settings")
# set the number of vCPUs and amount of RAM
yield from self._set_vcpus_ram(self.vcpus, self.ram)
yield from self._set_extra_options()
# start the VM
args = [self._vmx_path]