Subject: virt-manager: split EDIT_VCPUS and EDIT_MAXVCPUS From: Giuseppe Scrivano gscrivan@redhat.com Tue Jun 17 14:13:30 2014 +0200 Date: Tue Jun 17 17:27:47 2014 +0200: Git: 4ac49a1d66b12ae6f7d50ec4f368ff3d770e6b42 Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1098040 Signed-off-by: Giuseppe Scrivano Index: virt-manager-1.0.1/virtManager/details.py =================================================================== --- virt-manager-1.0.1.orig/virtManager/details.py +++ virt-manager-1.0.1/virtManager/details.py @@ -54,6 +54,7 @@ EDIT_DESC, EDIT_IDMAP, EDIT_VCPUS, +EDIT_MAXVCPUS, EDIT_CPUSET, EDIT_CPU, EDIT_TOPOLOGY, @@ -104,7 +105,7 @@ EDIT_FS, EDIT_HOSTDEV_ROMBAR, -) = range(1, 43) +) = range(1, 44) # Columns in hw list model @@ -1712,7 +1713,11 @@ class vmmDetails(vmmGObjectUI): def config_maxvcpus_changed(self, ignore): if self.widget("config-maxvcpus").get_sensitive(): self.config_cpu_topology_changed() - self.enable_apply(EDIT_VCPUS) + + # As this callback can be triggered by other events, set EDIT_MAXVCPUS + # only when the value is changed. + if self.config_get_maxvcpus() != self.vm.vcpu_max_count(): + self.enable_apply(EDIT_MAXVCPUS) def on_cpu_copy_host_clicked(self, src): uiutil.set_grid_row_visible( @@ -2004,9 +2009,11 @@ class vmmDetails(vmmGObjectUI): if self.edited(EDIT_VCPUS): kwargs["vcpus"] = self.config_get_vcpus() - kwargs["maxvcpus"] = self.config_get_maxvcpus() hotplug_args["vcpus"] = kwargs["vcpus"] + if self.edited(EDIT_MAXVCPUS): + kwargs["maxvcpus"] = self.config_get_maxvcpus() + if self.edited(EDIT_CPUSET): kwargs["cpuset"] = self.get_text("config-vcpupin")