[one-users] SMP for KVM?

Soren Hansen soren at ubuntu.com
Wed Jan 28 09:53:12 PST 2009


On Wed, Jan 28, 2009 at 05:48:19PM +0100, Soren Hansen wrote:
>> There are two options:
>> * Derive the vcpu value from CPU, something like for example round the CPU 
>> value up.
>> * Include a new parameter in the template to specify the number of virtual 
>> CPUs. Having two values for CPU can be misleading, though
> We could add a VCPU option to specify the number of virtual CPU's, and
> use the CPU setting (rounded up) as the default value for the VCPU
> setting? That way, we maintain the current semantics for the CPU
> setting, and add a way to customise the number of virtual cpu's assigned
> to a virtual machine.

Like this:

Index: opennebula-1.1.85+svn329/src/vmm/LibVirtDriver.cc
===================================================================
--- opennebula-1.1.85+svn329.orig/src/vmm/LibVirtDriver.cc	2009-01-28 18:31:47.332999499 +0100
+++ opennebula-1.1.85+svn329/src/vmm/LibVirtDriver.cc	2009-01-28 18:42:07.209030171 +0100
@@ -20,6 +20,8 @@
 #include "Nebula.h"
 #include <sstream>
 #include <fstream>
+#include <cstdlib>
+#include <cmath>
 
 
 int LibVirtDriver::deployment_description(
@@ -100,17 +102,26 @@
      // ------------------------------------------------------------------------       
 
 
-     vm->get_template_attribute("CPU", cpu);
+     vm->get_template_attribute("VCPU", cpu);
 
      if(cpu.empty())
      {
-         get_default("CPU",cpu);
+         get_default("VCPU",cpu);
      }
      
+     if(cpu.empty())
+     {
+          vm->get_template_attribute("CPU", cpu);
+     }
+
+     if(cpu.empty())
+     {
+         get_default("CPU",cpu);
+     }
+
      if (!cpu.empty())
      {
-     	//file << "\t<vcpu>" << cpu << "</vcpu>" << endl;
-     	// TODO decide about the vpcu value 
+     	file << "\t<vcpu>" << (int) ceil(atof(cpu.c_str())) << "</vcpu>" << endl;
      }
      else
      {



Feel free to prettify it. In fact, please do. :) C++ is not my language of
choice :)



-- 
Soren Hansen        | 
Virtualisation Lead | Ubuntu Server Team
Canonical Ltd.      | http://www.ubuntu.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: Digital signature
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20090128/55de9dd8/attachment-0003.pgp>


More information about the Users mailing list