[et-mgmt-tools] [PATCH] Fix the maximum number of VCPUin virt-manager

Masayuki Sunou fj1826dm at aa.jp.fujitsu.com
Mon Jun 18 07:07:53 UTC 2007


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.

===============================================================================
diff -r 24729fe72d52 src/virtManager/connection.py
--- a/src/virtManager/connection.py	Wed Jun 13 17:15:51 2007 -0400
+++ b/src/virtManager/connection.py	Tue Jun 19 09:17:17 2007 +0900
@@ -223,6 +223,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)
 
diff -r 24729fe72d52 src/virtManager/create.py
--- a/src/virtManager/create.py	Wed Jun 13 17:15:51 2007 -0400
+++ b/src/virtManager/create.py	Tue Jun 19 09:19:26 2007 +0900
@@ -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())
diff -r 24729fe72d52 src/virtManager/details.py
--- a/src/virtManager/details.py	Wed Jun 13 17:15:51 2007 -0400
+++ b/src/virtManager/details.py	Tue Jun 19 09:07:49 2007 +0900
@@ -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()))

===============================================================================

In message <4672D472.8010900 at redhat.com>
   "Re: [et-mgmt-tools] [PATCH] Fix the maximum number of VCPUin virt-manager"
   "Hugh Brock <hbrock at redhat.com>" wrote:

> Masayuki Sunou wrote:
> > Hi
> > 
> > Although the maximum number of VCPU is different in each architecture, the
> > maximum number of VCPU is 32 in virt-manager.
> > 
> > ex:
> >   x86  - the maximum number of VCPU is 32
> >   IA64 - the maximum number of VCPU is 64
> > 
> > This patch fixes it.
> > 
> > 
> > Signed-off-by: Masayuki Sunou <fj1826dm at aa.jp.fujitsu.com>
> > 
> > Thanks,
> > Masayuki Sunou.
> > 
> 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?
> 
> Thanks so much,
> --Hugh
> 
> -- 
> Red Hat Virtualization Group http://redhat.com/virtualization
> Hugh Brock           | virt-manager http://virt-manager.org
> hbrock at redhat.com    | virtualization library http://libvirt.org
> 
> _______________________________________________
> et-mgmt-tools mailing list
> et-mgmt-tools at redhat.com
> https://www.redhat.com/mailman/listinfo/et-mgmt-tools




More information about the et-mgmt-tools mailing list