Skip to contentSkip to conversation

separates config's 'vcpus' into 'max_vcpus' and 'vcpus'

PATCH In review Ryan Grimm 2 participants 3 messages Mar 13, 2006

lore
Share & tools
lore

Ryan Grimm

author
#0 lore raw

PATCH 1/1 separates config's 'vcpus' into 'max_vcpus' and 'vcpus'

Hi,

This breaks 'vcpus' in xm config file into -max_vcpus - the max # of vcpus a domain can have in its life -vcpus - the initial # of vcpus a domain brings up

it won't break any config file that's missing 'max_vcpus'

Thanks,
Ryan

tools/examples/xmexample1 +3 -0
diff -r d8451bb6278c -r 4407086dc27e tools/examples/xmexample1
@@ -26,6 +26,9 @@
 #cpus = ""         # leave to Xen to pick
 #cpus = "0"        # all vcpus run on CPU0
 #cpus = "0-3,5,^1" # run on cpus 0,2,3,5
+
+# Max number of Virtual CPUS a domain can have in its life
+#max_vcpus = 8
 
 # Number of Virtual CPUS to use, default is 1
 #vcpus = 1
tools/examples/xmexample2 +3 -0
diff -r d8451bb6278c -r 4407086dc27e tools/examples/xmexample2
@@ -56,6 +56,9 @@
 #cpus = "0"        # all vcpus run on CPU0
 #cpus = "0-3,5,^1" # run on cpus 0,2,3,5
 #cpus = "%s" % vmid # set based on vmid (mod number of CPUs)
+
+# Max number of Virtual CPUS a domain can have in its life
+max_vcpus = 8
 
 # Number of Virtual CPUS to use, default is 1
 #vcpus = 1
tools/python/xen/xend/XendDomainInfo.py +4 -2
diff -r d8451bb6278c -r 4407086dc27e tools/python/xen/xend/XendDomainInfo.py
@@ -121,6 +121,7 @@
     ('uuid',       str),
     ('ssidref',    int),
     ('vcpus',      int),
+    ('max_vcpus',  int), 
     ('vcpu_avail', int),
     ('cpu_weight', float),
     ('memory',     int),
@@ -551,6 +552,7 @@
                 avail = int(1)
 
             defaultInfo('vcpus',        lambda: avail)
+            defaultInfo('max_vcpus',    lambda: 8)
             defaultInfo('online_vcpus', lambda: self.info['vcpus'])
             defaultInfo('max_vcpu_id',  lambda: self.info['vcpus']-1)
             defaultInfo('vcpu_avail',   lambda: (1 << self.info['vcpus']) - 1)
@@ -704,7 +706,7 @@
                 return 'offline'
 
         result = {}
-        for v in range(0, self.info['vcpus']):
+        for v in range(0, self.info['max_vcpus']):
             result["cpu/%d/availability" % v] = availability(v)
         return result
 
@@ -1154,7 +1156,7 @@
         self.recreateDom()
 
         # Set maximum number of vcpus in domain
-        xc.domain_max_vcpus(self.domid, int(self.info['vcpus']))
+        xc.domain_max_vcpus(self.domid, int(self.info['max_vcpus']))
 
 
     def introduceDomain(self):
tools/python/xen/xm/create.py +6 -1
diff -r d8451bb6278c -r 4407086dc27e tools/python/xen/xm/create.py
@@ -176,6 +176,10 @@
 gopts.var('apic', val='APIC',
           fn=set_int, default=0,
           use="Disable or enable APIC of HVM domain.")
+
+gopts.var('max_vcpus', val='VCPUS',
+          fn=set_int, default=8,
+          use="max # of Virtual CPUS a domain will have in its life.")
 
 gopts.var('vcpus', val='VCPUS',
           fn=set_int, default=1,
@@ -587,7 +591,8 @@
                 config.append([n, v])
 
     map(add_conf, ['name', 'memory', 'ssidref', 'maxmem', 'restart',
-                   'on_poweroff', 'on_reboot', 'on_crash', 'vcpus'])
+                   'on_poweroff', 'on_reboot', 'on_crash', 'vcpus',
+                   'max_vcpus'])
     
     if vals.uuid is not None:
         config.append(['uuid', vals.uuid])
#1 lore raw
Quoted 7 lines · Ryan Grimm

Hi,

This breaks 'vcpus' in xm config file into

(quoted diff) +0 -2
-max_vcpus - the max # of vcpus a domain can have in its life
-vcpus - the initial # of vcpus a domain brings up

it won't break any config file that's missing 'max_vcpus'

Hi Ryan,

Could you update the xmdomain.cfg man page too?

Thanks,

Dan

author
#2 lore raw

Hi,

here is the patch w/ the man page updated

thanks,
ryan

docs/man/xmdomain.cfg.pod.5 +7 -0
diff -r 36cf47cfea4e -r 42f7d3354bf6 docs/man/xmdomain.cfg.pod.5
@@ -176,6 +176,13 @@
 
 Will cause the domain to boot to runlevel 4.
 
+=item B<max_vcpus>
+
+The number of virtual cpus a domain can bring up in its life.  In order 
+to use this the xen kernel must be compiled with SMP support.
+
+This defaults to 8, meaning the domain can bring up at most 8 vcpus.
+
 =item B<nfs_server>
 
 The IP address of the NFS server to use as the root device for the
tools/examples/xmexample1 +3 -0
diff -r 36cf47cfea4e -r 42f7d3354bf6 tools/examples/xmexample1
@@ -26,6 +26,9 @@
 #cpus = ""         # leave to Xen to pick
 #cpus = "0"        # all vcpus run on CPU0
 #cpus = "0-3,5,^1" # run on cpus 0,2,3,5
+
+# Max number of Virtual CPUS a domain can have in its life
+#max_vcpus = 8
 
 # Number of Virtual CPUS to use, default is 1
 #vcpus = 1
tools/examples/xmexample2 +3 -0
diff -r 36cf47cfea4e -r 42f7d3354bf6 tools/examples/xmexample2
@@ -56,6 +56,9 @@
 #cpus = "0"        # all vcpus run on CPU0
 #cpus = "0-3,5,^1" # run on cpus 0,2,3,5
 #cpus = "%s" % vmid # set based on vmid (mod number of CPUs)
+
+# Max number of Virtual CPUS a domain can have in its life
+max_vcpus = 8
 
 # Number of Virtual CPUS to use, default is 1
 #vcpus = 1
tools/python/xen/xend/XendDomainInfo.py +4 -2
diff -r 36cf47cfea4e -r 42f7d3354bf6 tools/python/xen/xend/XendDomainInfo.py
@@ -121,6 +121,7 @@
     ('uuid',       str),
     ('ssidref',    int),
     ('vcpus',      int),
+    ('max_vcpus',  int), 
     ('vcpu_avail', int),
     ('cpu_weight', float),
     ('memory',     int),
@@ -554,6 +555,7 @@
                 avail = int(1)
 
             defaultInfo('vcpus',        lambda: avail)
+            defaultInfo('max_vcpus',    lambda: 8)
             defaultInfo('online_vcpus', lambda: self.info['vcpus'])
             defaultInfo('max_vcpu_id',  lambda: self.info['vcpus']-1)
             defaultInfo('vcpu_avail',   lambda: (1 << self.info['vcpus']) - 1)
@@ -707,7 +709,7 @@
                 return 'offline'
 
         result = {}
-        for v in range(0, self.info['vcpus']):
+        for v in range(0, self.info['max_vcpus']):
             result["cpu/%d/availability" % v] = availability(v)
         return result
 
@@ -1175,7 +1177,7 @@
         self.recreateDom()
 
         # Set maximum number of vcpus in domain
-        xc.domain_max_vcpus(self.domid, int(self.info['vcpus']))
+        xc.domain_max_vcpus(self.domid, int(self.info['max_vcpus']))
 
 
     def introduceDomain(self):
tools/python/xen/xm/create.py +6 -1
diff -r 36cf47cfea4e -r 42f7d3354bf6 tools/python/xen/xm/create.py
@@ -176,6 +176,10 @@
 gopts.var('apic', val='APIC',
           fn=set_int, default=0,
           use="Disable or enable APIC of HVM domain.")
+
+gopts.var('max_vcpus', val='VCPUS',
+          fn=set_int, default=8,
+          use="max # of Virtual CPUS a domain will have in its life.")
 
 gopts.var('vcpus', val='VCPUS',
           fn=set_int, default=1,
@@ -600,7 +604,8 @@
                 config.append([n, v])
 
     map(add_conf, ['name', 'memory', 'ssidref', 'maxmem', 'restart',
-                   'on_poweroff', 'on_reboot', 'on_crash', 'vcpus'])
+                   'on_poweroff', 'on_reboot', 'on_crash', 'vcpus',
+                   'max_vcpus'])
     
     if vals.uuid is not None:
         config.append(['uuid', vals.uuid])