Skip to content

Commit

Permalink
Round CPUs value in Docker templates and VMs. Ref #3572
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Apr 3, 2024
1 parent a1b577d commit 4ef0d16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gns3/modules/docker/pages/docker_vm_configuration_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 4 additions & 2 deletions gns3/modules/docker/pages/docker_vm_preferences_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])])

Expand Down

0 comments on commit 4ef0d16

Please sign in to comment.