diff --git a/src/virt-manager.glade b/src/virt-manager.glade index bf247c055..3ea77fde8 100644 --- a/src/virt-manager.glade +++ b/src/virt-manager.glade @@ -1526,9 +1526,6 @@ Jeremy Katz <katzj@redhat.com> 0 0.5 GTK_SHADOW_NONE - - CPUs - @@ -1537,107 +1534,25 @@ Jeremy Katz <katzj@redhat.com> 0.5 1 1 - 0 - 0 + 5 + 3 12 0 - + True - 2 - 2 False - 5 - 2 + 0 - + True - How many <b>virtual</b> CPUs should this sytem have? - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 1 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - False - False - 1 1 32 1 10 10 - - - - 1 - 2 - 0 - 1 - fill - - - - - - - True - <b>Physical</b> host CPU count: - False - True - GTK_JUSTIFY_RIGHT - False - False - 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - 256 + How many virtual CPUs should this machine be allocated? False False GTK_JUSTIFY_LEFT - False + True False 0 0.5 @@ -1647,17 +1562,247 @@ Jeremy Katz <katzj@redhat.com> -1 False 0 - - state-host-cpus - - 1 - 2 - 1 - 2 - fill - + 0 + False + False + + + + + + 3 + True + 4 + 2 + False + 3 + 3 + + + + True + Change allocation: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + Total CPUs on host machine: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + Maximum allocation: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + Current allocation: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + 8 + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 3 + 4 + fill + + + + + + + True + 2 + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 2 + 3 + fill + + + + + + + True + 2 + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 1 + 2 + fill + + + + + + + True + True + 1 + 0 + True + GTK_UPDATE_IF_VALID + False + False + 2 1 32 1 2 2 + + + + 1 + 2 + 0 + 1 + fill + + + + + + 0 + False + False @@ -1883,7 +2028,7 @@ Jeremy Katz <katzj@redhat.com> True - How much memory should this machine be allowed to use? + How much memory should this machine be allocated? False False GTK_JUSTIFY_LEFT @@ -1918,7 +2063,7 @@ Jeremy Katz <katzj@redhat.com> True - Update usage: + Change allocation: False False GTK_JUSTIFY_LEFT @@ -1974,7 +2119,7 @@ Jeremy Katz <katzj@redhat.com> True - Maximum usage: + Maximum allocation: False False GTK_JUSTIFY_LEFT @@ -2002,7 +2147,7 @@ Jeremy Katz <katzj@redhat.com> True - Current usage: + Current allocation: False False GTK_JUSTIFY_LEFT @@ -2124,7 +2269,7 @@ Jeremy Katz <katzj@redhat.com> 1 0 True - GTK_UPDATE_ALWAYS + GTK_UPDATE_IF_VALID False False 50 50 32000 5 10 10 diff --git a/src/virtManager/details.py b/src/virtManager/details.py index ed1880922..0b5adce33 100644 --- a/src/virtManager/details.py +++ b/src/virtManager/details.py @@ -102,7 +102,7 @@ class vmmDetails(gobject.GObject): "on_details_menu_view_toolbar_activate": self.toggle_toolbar, "on_config_cpus_apply_clicked": self.config_cpus_apply, - "on_config_vm_cpus_changed": self.config_vm_cpus, + "on_config_vcpus_changed": self.config_vm_cpus, "on_config_memory_changed": self.config_memory_value, "on_config_memory_apply_clicked": self.config_memory_apply }) @@ -225,20 +225,20 @@ class vmmDetails(gobject.GObject): self.window.get_widget("control-shutdown").set_sensitive(False) self.window.get_widget("details-menu-pause").set_sensitive(False) self.window.get_widget("details-menu-shutdown").set_sensitive(False) - self.window.get_widget("details-menu-save").set_sensitive(False) + self.window.get_widget("details-menu-save").set_sensitive(False) else: self.window.get_widget("control-pause").set_sensitive(True) self.window.get_widget("control-shutdown").set_sensitive(True) self.window.get_widget("details-menu-pause").set_sensitive(True) self.window.get_widget("details-menu-shutdown").set_sensitive(True) - self.window.get_widget("details-menu-save").set_sensitive(True) + self.window.get_widget("details-menu-save").set_sensitive(True) if status == libvirt.VIR_DOMAIN_PAUSED: self.window.get_widget("control-pause").set_active(True) self.window.get_widget("details-menu-pause").set_active(True) else: self.window.get_widget("control-pause").set_active(False) - self.window.get_widget("details-menu-pause").set_active(False) + self.window.get_widget("details-menu-pause").set_active(False) except: self.ignorePause = False self.ignorePause = False @@ -250,7 +250,6 @@ class vmmDetails(gobject.GObject): self.window.get_widget("details-menu-serial").set_sensitive(True) else: self.window.get_widget("details-menu-serial").set_sensitive(False) - def refresh_resources(self, vm): self.window.get_widget("overview-cpu-usage-text").set_text("%d %%" % self.vm.cpu_time_percentage()) @@ -278,18 +277,23 @@ class vmmDetails(gobject.GObject): self.window.get_widget("state-vm-maxmem").set_text("%d MB" % (vm_maxmem/1024)) self.window.get_widget("state-vm-memory").set_text("%d MB" % (vm_memory/1024)) + self.window.get_widget("state-host-cpus").set_text("%d" % self.vm.get_connection().host_active_processor_count()) + self.window.get_widget("config-vcpus").get_adjustment().upper = vm.vcpu_max_count() + self.window.get_widget("state-vm-vcpus").set_text("%d" % (vm.vcpu_count())) + self.window.get_widget("state-vm-max-vcpus").set_text("%d" % (vm.vcpu_max_count())) + def update_config_memory(self): self.window.get_widget("config-memory").get_adjustment().value = self.vm.current_memory()/1024 def update_config_cpus(self): - self.window.get_widget("config-vm-cpus").get_adjustment().value = self.vm.vcpu_count() + self.window.get_widget("config-vcpus").get_adjustment().value = self.vm.vcpu_count() def update_state_cpus(self): self.window.get_widget("state-host-cpus").set_text(`(self.vm.get_connection().host_maximum_processor_count())`) def config_cpus_apply(self, src): # Apply the change to the number of CPUs - vcpus = self.window.get_widget("config-vm-cpus").get_adjustment().value + vcpus = self.window.get_widget("config-vcpus").get_adjustment().value # if requested # of CPUS > host CPUS, pop up warning dialog (not implemented yet) diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py index 4506d8726..2fb72eee3 100644 --- a/src/virtManager/domain.py +++ b/src/virtManager/domain.py @@ -186,6 +186,10 @@ class vmmDomain(gobject.GObject): return 0 return self.record[0]["vcpuCount"] + def vcpu_max_count(self): + cpus = self.get_xml_string("/domain/vcpu") + return int(cpus) + def cpu_time_vector(self): vector = [] stats = self.record