diff --git a/tests/uitests/details.py b/tests/uitests/details.py index 97655460c..7ec4f6f3c 100644 --- a/tests/uitests/details.py +++ b/tests/uitests/details.py @@ -103,19 +103,16 @@ class Details(uiutils.UITestCase): appl.click() uiutils.check_in_loop(lambda: not appl.sensitive) - - # Memory balloon - tab = self._select_hw(win, "Memory", "memory-tab") - tab.find("Current allocation:", "spin button").text = "300" - # Newer libvirt rejects this hotplug operation for test driver - # tab.find("Maximum allocation:", "spin button").text = "800" - appl.click() - uiutils.check_in_loop(lambda: not appl.sensitive) - # There's no hotplug operations after this point self._stop_vm(win) - # CPU hotplug + # Memory + tab = self._select_hw(win, "Memory", "memory-tab") + tab.find("Memory allocation:", "spin button").text = "300" + appl.click() + uiutils.check_in_loop(lambda: not appl.sensitive) + + # VCPUs tab = self._select_hw(win, "CPUs", "cpu-tab") tab.find("VCPU allocation:", "spin button").text = "4" appl.click() diff --git a/ui/details.ui b/ui/details.ui index c58d09f16..83bcf6b53 100644 --- a/ui/details.ui +++ b/ui/details.ui @@ -2,13 +2,6 @@ - - 1 - 10240000 - 50 - 1 - 25 - 10000000 1000 @@ -1937,7 +1930,7 @@ False end center - Current a_llocation: + Memory a_llocation: True mem-memory @@ -1946,21 +1939,6 @@ 1 - - - True - False - end - center - Ma_ximum allocation: - True - mem-maxmem - - - 0 - 2 - - True @@ -2038,55 +2016,6 @@ 1 - - - True - False - center - 3 - - - True - True - - 50 - adjustment1 - 2 - True - if-valid - 50 - - - - Max Memory Select - - - - - False - True - 0 - - - - - True - False - start - MiB - - - True - True - 1 - - - - - 1 - 2 - - diff --git a/virtManager/details/details.py b/virtManager/details/details.py index bcb8d4bd7..c67e26bca 100644 --- a/virtManager/details/details.py +++ b/virtManager/details/details.py @@ -462,7 +462,6 @@ class vmmDetails(vmmGObjectUI): "on_cpu_topology_enable_toggled": self.config_cpu_topology_enable, "on_mem_memory_changed": self.config_memory_changed, - "on_mem_maxmem_changed": self.config_maxmem_changed, "on_boot_list_changed": self.config_bootdev_selected, @@ -1201,26 +1200,9 @@ class vmmDetails(vmmGObjectUI): # Memory - def config_get_maxmem(self): - return uiutil.spin_get_helper(self.widget("mem-maxmem")) - def config_get_memory(self): - return uiutil.spin_get_helper(self.widget("mem-memory")) - - def config_maxmem_changed(self, src_ignore): - self.enable_apply(EDIT_MEM) - def config_memory_changed(self, src_ignore): self.enable_apply(EDIT_MEM) - maxadj = self.widget("mem-maxmem") - - mem = self.config_get_memory() - if maxadj.get_value() < mem: - maxadj.set_value(mem) - - ignore, upper = maxadj.get_range() - maxadj.set_range(mem, upper) - # VCPUS def config_get_vcpus(self): @@ -1568,27 +1550,13 @@ class vmmDetails(vmmGObjectUI): def config_memory_apply(self): kwargs = {} - hotplug_args = {} if self.edited(EDIT_MEM): - curmem = None - maxmem = self.config_get_maxmem() - if self.widget("mem-memory").get_sensitive(): - curmem = self.config_get_memory() - - if curmem: - curmem = int(curmem) * 1024 - if maxmem: - maxmem = int(maxmem) * 1024 - - kwargs["memory"] = curmem - kwargs["maxmem"] = maxmem - hotplug_args["memory"] = kwargs["memory"] - hotplug_args["maxmem"] = kwargs["maxmem"] + memory = uiutil.spin_get_helper(self.widget("mem-memory")) + kwargs["memory"] = int(memory) * 1024 return vmmAddHardware.change_config_helper(self.vm.define_memory, - kwargs, self.vm, self.err, - hotplug_args=hotplug_args) + kwargs, self.vm, self.err) def config_boot_options_apply(self): kwargs = {} @@ -2054,7 +2022,7 @@ class vmmDetails(vmmGObjectUI): if self.config.get_stats_enable_memory_poll(): cur_vm_memory = self.vm.stats_memory() - vm_memory = self.vm.maximum_memory() + vm_memory = self.vm.xmlobj.memory mem_txt = _("%(current-memory)s of %(total-memory)s") % { "current-memory": uiutil.pretty_mem(cur_vm_memory), "total-memory": uiutil.pretty_mem(vm_memory) @@ -2152,19 +2120,12 @@ class vmmDetails(vmmGObjectUI): def refresh_config_memory(self): host_mem_widget = self.widget("state-host-memory") host_mem = self.vm.conn.host_memory_size() // 1024 - vm_cur_mem = self.vm.get_memory() / 1024.0 - vm_max_mem = self.vm.maximum_memory() / 1024.0 + vm_cur_mem = self.vm.xmlobj.memory / 1024.0 host_mem_widget.set_text("%d MiB" % (int(round(host_mem)))) curmem = self.widget("mem-memory") - maxmem = self.widget("mem-maxmem") curmem.set_value(int(round(vm_cur_mem))) - maxmem.set_value(int(round(vm_max_mem))) - - if not self.widget("mem-memory").get_sensitive(): - ignore, upper = maxmem.get_range() - maxmem.set_range(curmem.get_value(), upper) def refresh_disk_page(self, disk): path = disk.path diff --git a/virtManager/object/domain.py b/virtManager/object/domain.py index 7145f9462..99c4a1612 100644 --- a/virtManager/object/domain.py +++ b/virtManager/object/domain.py @@ -562,13 +562,12 @@ class vmmDomain(vmmLibvirtObject): guest.cpu.set_model(guest, model) self._redefine_xmlobj(guest) - def define_memory(self, memory=_SENTINEL, maxmem=_SENTINEL): + def define_memory(self, memory=_SENTINEL): guest = self._make_xmlobj_to_define() if memory != _SENTINEL: guest.currentMemory = int(memory) - if maxmem != _SENTINEL: - guest.memory = int(maxmem) + guest.memory = int(memory) self._redefine_xmlobj(guest) def define_overview(self, machine=_SENTINEL, description=_SENTINEL, @@ -1001,39 +1000,15 @@ class vmmDomain(vmmLibvirtObject): log.debug("update_device with xml=\n%s", xml) self._backend.updateDeviceFlags(xml, flags) - def hotplug(self, memory=_SENTINEL, maxmem=_SENTINEL, - description=_SENTINEL, title=_SENTINEL, device=_SENTINEL): + def hotplug(self, description=_SENTINEL, title=_SENTINEL, device=_SENTINEL): if not self.is_active(): return - def _hotplug_memory(val): - if val != self.get_memory(): - self._backend.setMemory(val) - def _hotplug_maxmem(val): - if val != self.maximum_memory(): - self._backend.setMaxMemory(val) - def _hotplug_metadata(val, mtype): flags = (libvirt.VIR_DOMAIN_AFFECT_LIVE | libvirt.VIR_DOMAIN_AFFECT_CONFIG) self._backend.setMetadata(mtype, val, None, None, flags) - if memory != _SENTINEL: - log.debug("Hotplugging curmem=%s maxmem=%s for VM '%s'", - memory, maxmem, self.get_name()) - - actual_cur = self.get_memory() - if memory: - if maxmem < actual_cur: - # Set current first to avoid error - _hotplug_memory(memory) - _hotplug_maxmem(maxmem) - else: - _hotplug_maxmem(maxmem) - _hotplug_memory(memory) - else: - _hotplug_maxmem(maxmem) - if description != _SENTINEL: _hotplug_metadata(description, libvirt.VIR_DOMAIN_METADATA_DESCRIPTION) @@ -1305,11 +1280,6 @@ class vmmDomain(vmmLibvirtObject): def get_description(self): return self.get_xmlobj().description - def get_memory(self): - return int(self.get_xmlobj().currentMemory) - def maximum_memory(self): - return int(self.get_xmlobj().memory) - def get_cpu_config(self): return self.get_xmlobj().cpu