* [PATCH] Add maxvcpus support
@ 2009-11-25 11:14 Michal Novotny
0 siblings, 0 replies; 2+ messages in thread
From: Michal Novotny @ 2009-11-25 11:14 UTC (permalink / raw)
To: 'xen-devel@lists.xensource.com'
Hi,
this is patch to add maxvcpus support to xen xm command. It's using
vcpu_avail bitmask and sets the number of vcpus to maxvcpus if present.
If it's not present, old behavior is preserved.
In domain config file you can define it as follows:
maxvcpus = 4
vcpus = 2
this automatically sets vcpus to 4 and corresponding bitmask to present
2 vcpus in the guest with option to increase it up to 4 vcpus. If
maxvcpus is not present, the old behavior for vcpus is preserved, ie.
you can set vcpus to some number of vcpus to be used and the vcpu_avail
is set appropriately to use all of them. Only when you use maxvcpus and
vcpus new vcpu_avail value is calculated to show PV guest the desired
number of vcpus only.
It's been tested using RHEL-5 32-bit PV guest with maxvcpus = 4 and
vcpus = 2 and also the previous setup of vcpus = 2 only... In both cases
I was able to use 'xm vcpu-set {domainId} {numberOfVCPUs}' to increase
move vcpu count from 0 to maxvcpus/vcpus so it was working as designed.
Michal
Signed-off-By: Michal Novotny<minovotn@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] Add maxvcpus support
@ 2009-11-25 12:43 Michal Novotny
0 siblings, 0 replies; 2+ messages in thread
From: Michal Novotny @ 2009-11-25 12:43 UTC (permalink / raw)
To: 'xen-devel@lists.xensource.com'
[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]
Hi,
this is patch to add maxvcpus support to xen xm command. It's using
vcpu_avail bitmask and sets the number of vcpus to maxvcpus if present.
If it's not present, old behavior is preserved.
In domain config file you can define it as follows:
maxvcpus = 4
vcpus = 2
this automatically sets vcpus to 4 and corresponding bitmask to present
2 vcpus in the guest with option to increase it up to 4 vcpus. If
maxvcpus is not present, the old behavior for vcpus is preserved, ie.
you can set vcpus to some number of vcpus to be used and the vcpu_avail
is set appropriately to use all of them. Only when you use maxvcpus and
vcpus new vcpu_avail value is calculated to show PV guest the desired
number of vcpus only.
It's been tested using RHEL-5 32-bit PV guest with maxvcpus = 4 and
vcpus = 2 and also the previous setup of vcpus = 2 only... In both cases
I was able to use 'xm vcpu-set {domainId} {numberOfVCPUs}' to increase
move vcpu count from 0 to maxvcpus/vcpus so it was working as designed.
Michal
Signed-off-By: Michal Novotny<minovotn@redhat.com>
[-- Attachment #2: xen-xm-maxvcpu-support.patch --]
[-- Type: text/x-patch, Size: 1732 bytes --]
diff -r d44371e6e5d6 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py Tue Nov 24 14:43:07 2009 +0000
+++ b/tools/python/xen/xm/create.py Wed Nov 25 11:06:19 2009 +0100
@@ -1029,6 +1029,24 @@ def make_config(vals):
config = ['vm']
+ def vcpu_conf():
+ maxvcpus = False
+ vcpus = False
+ if hasattr(vals, 'maxvcpus'):
+ maxvcpus = getattr(vals, 'maxvcpus')
+ if hasattr(vals, 'vcpus'):
+ vcpus = getattr(vals, 'vcpus')
+
+ if maxvcpus and not vcpus:
+ config.append(['vcpus', maxvcpus])
+ if maxvcpus and vcpus:
+ config.append(['vcpu_avail', (1 << vcpus) - 1])
+
+ # For case we don't have maxvcpus set but we have vcpus we preserve
+ # old behaviour
+ if not maxvcpus and vcpus:
+ config.append(['vcpus', vcpus])
+
def add_conf(n):
if hasattr(vals, n):
v = getattr(vals, n)
@@ -1037,10 +1055,11 @@ def make_config(vals):
map(add_conf, ['name', 'memory', 'maxmem', 'shadow_memory',
'restart', 'on_poweroff', 'tsc_native', 'nomigrate',
- 'on_reboot', 'on_crash', 'vcpus', 'vcpu_avail', 'features',
- 'on_xend_start', 'on_xend_stop', 'target', 'cpuid',
- 'cpuid_check', 'machine_address_size', 'suppress_spurious_page_faults'])
-
+ 'on_reboot', 'on_crash', 'features', 'on_xend_start',
+ 'on_xend_stop', 'target', 'cpuid', 'cpuid_check',
+ 'machine_address_size', 'suppress_spurious_page_faults'])
+
+ vcpu_conf()
if vals.uuid is not None:
config.append(['uuid', vals.uuid])
if vals.cpu is not None:
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-25 12:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-25 12:43 [PATCH] Add maxvcpus support Michal Novotny
-- strict thread matches above, loose matches on Subject: below --
2009-11-25 11:14 Michal Novotny
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.