mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-10-27 10:25:25 +03:00
Re: [et-mgmt-tools] [PATCH] Fix the maximum number of VCPUin virt-manager
Hi Hugh Thank you for reviewing. I remake this patch. > Hmm, this is good, but I'm inclined to think it would be better to put a > getMaxVcpus() call in connection.py and isolate the "check the > connection type and either call getMaxVcpus or arbitrarily return '32'" > there (so we don't repeat the code in two places). Also, it looks to me > like "Xen" is the default in xen_unified.c, at least in current libvirt > code, so you shouldn't need to supply "Xen" to the getMaxVcpus call. Can > you redo the patch along these lines? > This patch changes as follows. 1. getMaxVcpus() is executed from connection.py. 2. getMaxVcpus() is called with the result of get_type() not "Xen" Thanks, Masayuki Sunou. ===============================================================================
This commit is contained in:
parent
bb7fffa441
commit
efa4e15f2f
@ -225,6 +225,13 @@ class vmmConnection(gobject.GObject):
|
||||
def get_host_info(self):
|
||||
return self.hostinfo
|
||||
|
||||
def get_max_vcpus(self):
|
||||
try:
|
||||
return self.vmm.getMaxVcpus(self.get_type())
|
||||
except Exception, e:
|
||||
logging.debug('Unable to get max vcpu')
|
||||
return 32;
|
||||
|
||||
def connect(self, name, callback):
|
||||
handle_id = gobject.GObject.connect(self, name, callback)
|
||||
|
||||
|
@ -253,6 +253,7 @@ class vmmCreate(gobject.GObject):
|
||||
self.window.get_widget("create-memory-max").set_value(500)
|
||||
self.window.get_widget("create-memory-startup").set_value(500)
|
||||
self.window.get_widget("create-vcpus").set_value(1)
|
||||
self.window.get_widget("create-vcpus").get_adjustment().upper = self.connection.get_max_vcpus()
|
||||
self.window.get_widget("non-sparse").set_active(True)
|
||||
model = self.window.get_widget("pv-media-url").get_model()
|
||||
self.populate_url_model(model, self.config.get_media_urls())
|
||||
|
@ -364,8 +364,9 @@ 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 ]:
|
||||
self.window.get_widget("config-vcpus").get_adjustment().upper = 32
|
||||
self.window.get_widget("state-vm-maxvcpus").set_text("32")
|
||||
cpu_max = self.vm.get_connection().get_max_vcpus()
|
||||
self.window.get_widget("config-vcpus").get_adjustment().upper = cpu_max
|
||||
self.window.get_widget("state-vm-maxvcpus").set_text(str(cpu_max))
|
||||
else:
|
||||
self.window.get_widget("config-vcpus").get_adjustment().upper = self.vm.vcpu_max_count()
|
||||
self.window.get_widget("state-vm-maxvcpus").set_text("%d" % (self.vm.vcpu_max_count()))
|
||||
|
Loading…
Reference in New Issue
Block a user