All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Novotny <minovotn@redhat.com>
To: "'xen-devel@lists.xensource.com'" <xen-devel@lists.xensource.com>
Subject: [PATCH] Add maxvcpu support
Date: Wed, 25 Nov 2009 11:17:35 +0100	[thread overview]
Message-ID: <4B0D043F.1030509@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 498 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.

Thanks,
Michal

[-- Attachment #2: xen-xm-maxvcpu-support.patch --]
[-- Type: text/x-patch, Size: 1731 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

                 reply	other threads:[~2009-11-25 10:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B0D043F.1030509@redhat.com \
    --to=minovotn@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.