From 4ef0d1606ad2655007563c85d3e891417b611024 Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 3 Apr 2024 17:11:45 +0700 Subject: [PATCH] Round CPUs value in Docker templates and VMs. Ref https://github.com/GNS3/gns3-gui/issues/3572 --- gns3/modules/docker/pages/docker_vm_configuration_page.py | 2 +- gns3/modules/docker/pages/docker_vm_preferences_page.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gns3/modules/docker/pages/docker_vm_configuration_page.py b/gns3/modules/docker/pages/docker_vm_configuration_page.py index beb3e0c0a..775c383d5 100644 --- a/gns3/modules/docker/pages/docker_vm_configuration_page.py +++ b/gns3/modules/docker/pages/docker_vm_configuration_page.py @@ -183,7 +183,7 @@ def saveSettings(self, settings, node=None, group=False): # only tidy input here, validation is performed server side settings["extra_volumes"] = [ y for x in self.uiExtraVolumeTextEdit.toPlainText().split("\n") for y in [ x.strip() ] if y ] settings["memory"] = self.uiMaxMemorySpinBox.value() - settings["cpus"] = self.uiMaxCPUsDoubleSpinBox.value() + settings["cpus"] = round(self.uiMaxCPUsDoubleSpinBox.value(), self.uiMaxCPUsDoubleSpinBox.decimals()) if not group: adapters = self.uiAdapterSpinBox.value() diff --git a/gns3/modules/docker/pages/docker_vm_preferences_page.py b/gns3/modules/docker/pages/docker_vm_preferences_page.py index 0939ad053..e96eeadaa 100644 --- a/gns3/modules/docker/pages/docker_vm_preferences_page.py +++ b/gns3/modules/docker/pages/docker_vm_preferences_page.py @@ -97,14 +97,16 @@ def _refreshInfo(self, docker_container): QtWidgets.QTreeWidgetItem(section_item, ["Auxiliary console type:", str(docker_container["aux_type"])]) QtWidgets.QTreeWidgetItem(section_item, ["Default name format:", docker_container["default_name_format"]]) QtWidgets.QTreeWidgetItem(section_item, ["Adapters:", str(docker_container["adapters"])]) + if docker_container["cpus"]: + QtWidgets.QTreeWidgetItem(section_item, ["CPUs:", str(docker_container["cpus"])]) + if docker_container["memory"]: + QtWidgets.QTreeWidgetItem(section_item, ["Memory:", str(docker_container["memory"]) + " MB"]) if docker_container["start_command"]: QtWidgets.QTreeWidgetItem(section_item, ["Start command:", str(docker_container["start_command"])]) if docker_container["environment"]: QtWidgets.QTreeWidgetItem(section_item, ["Environment:", str(docker_container["environment"])]) - if docker_container["extra_hosts"]: QtWidgets.QTreeWidgetItem(section_item, ["Extra hosts:", str(docker_container["extra_hosts"])]) - if docker_container["extra_volumes"]: QtWidgets.QTreeWidgetItem(section_item, ["Extra volumes:", "\n".join(docker_container["extra_volumes"])])