Add a get_type methon to domain object to facilitate getting a correct max_vcpus value.

This commit is contained in:
Cole Robinson
2008-03-17 13:10:15 -04:00
parent 843e80e942
commit 39915a3eb3
3 changed files with 6 additions and 3 deletions

View File

@@ -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)

View File

@@ -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:

View File

@@ -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():