mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Add a get_type methon to domain object to facilitate getting a correct max_vcpus value.
This commit is contained in:
@@ -501,8 +501,8 @@ class vmmConnection(gobject.GObject):
|
||||
def get_host_info(self):
|
||||
return self.hostinfo
|
||||
|
||||
def get_max_vcpus(self):
|
||||
return virtinst.util.get_max_vcpus(self.vmm)
|
||||
def get_max_vcpus(self, type=None):
|
||||
return virtinst.util.get_max_vcpus(self.vmm, type)
|
||||
|
||||
def connect(self, name, callback):
|
||||
handle_id = gobject.GObject.connect(self, name, callback)
|
||||
|
||||
@@ -374,7 +374,7 @@ class vmmDetails(gobject.GObject):
|
||||
self.window.get_widget("state-host-cpus").set_text("%d" % self.vm.get_connection().host_active_processor_count())
|
||||
status = self.vm.status()
|
||||
if status in [ libvirt.VIR_DOMAIN_SHUTOFF, libvirt.VIR_DOMAIN_CRASHED ]:
|
||||
cpu_max = self.vm.get_connection().get_max_vcpus()
|
||||
cpu_max = self.vm.get_connection().get_max_vcpus(self.vm.get_type())
|
||||
self.window.get_widget("config-vcpus").get_adjustment().upper = cpu_max
|
||||
self.window.get_widget("state-vm-maxvcpus").set_text(str(cpu_max))
|
||||
else:
|
||||
|
||||
@@ -115,6 +115,9 @@ class vmmDomain(gobject.GObject):
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_type(self):
|
||||
return self.get_xml_string("/domain/@type")
|
||||
|
||||
def is_vcpu_hotplug_capable(self):
|
||||
# Read only connections aren't allowed to change it
|
||||
if self.connection.is_read_only():
|
||||
|
||||
Reference in New Issue
Block a user