mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Fix vcpus configuration for GNS3 VM on VMware. Ref #2738.
This commit is contained in:
parent
4eca82174d
commit
8e8985c69f
@ -72,15 +72,16 @@ class VMwareGNS3VM(BaseGNS3VM):
|
|||||||
if ram % 4 != 0:
|
if ram % 4 != 0:
|
||||||
raise GNS3VMError("Allocated memory {} for the GNS3 VM must be a multiple of 4".format(ram))
|
raise GNS3VMError("Allocated memory {} for the GNS3 VM must be a multiple of 4".format(ram))
|
||||||
|
|
||||||
available_vcpus = psutil.cpu_count()
|
available_vcpus = psutil.cpu_count(logical=True)
|
||||||
if vcpus > available_vcpus:
|
if vcpus > available_vcpus:
|
||||||
raise GNS3VMError("You have allocated too many vCPUs for the GNS3 VM! (max available is {} vCPUs)".format(available_vcpus))
|
raise GNS3VMError("You have allocated too many vCPUs for the GNS3 VM! (max available is {} vCPUs)".format(available_vcpus))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pairs = VMware.parse_vmware_file(self._vmx_path)
|
pairs = VMware.parse_vmware_file(self._vmx_path)
|
||||||
|
if vcpus > 1:
|
||||||
pairs["numvcpus"] = str(vcpus)
|
pairs["numvcpus"] = str(vcpus)
|
||||||
cores_per_sockets = int(available_vcpus / psutil.cpu_count(logical=False))
|
cores_per_sockets = int(vcpus / psutil.cpu_count(logical=False))
|
||||||
if cores_per_sockets >= 1:
|
if cores_per_sockets > 1:
|
||||||
pairs["cpuid.corespersocket"] = str(cores_per_sockets)
|
pairs["cpuid.corespersocket"] = str(cores_per_sockets)
|
||||||
pairs["memsize"] = str(ram)
|
pairs["memsize"] = str(ram)
|
||||||
VMware.write_vmx_file(self._vmx_path, pairs)
|
VMware.write_vmx_file(self._vmx_path, pairs)
|
||||||
|
Loading…
Reference in New Issue
Block a user