[Kimchi-devel] [PATCH V5 1/3] VM Edit CPU/Memory: (Backend) Changes API.md, API.json and i18n.py

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Tue Apr 22 14:50:40 UTC 2014


This patch apply necessary changes in:
  - documentation (API.md): adds cpu and memory in update parameter
  - data validation (API.json: validate given cpu and memory numbers
  - error message (i18n.py): this new feature uses the same messages
    from Templates update, but a minor change was necessary in cpu text.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
 docs/API.md         |  4 ++++
 src/kimchi/API.json | 12 ++++++++++++
 src/kimchi/i18n.py  |  2 +-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/docs/API.md b/docs/API.md
index 716c983..2961119 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -103,6 +103,10 @@ the following general conventions:
     * name: New name for this VM (only applied for shutoff VM)
     * users: New list of system users.
     * groups: New list of system groups.
+    * cpus: New number of virtual cpus for this VM (if VM is running, new value
+            will take effect in next reboot)
+    * memory: New amount of memory (MB) for this VM (if VM is running, new
+              value will take effect in next reboot)
 * **POST**: *See Virtual Machine Actions*
 
 **Actions (POST):**
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 3360a9c..38e9607 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -223,6 +223,18 @@
                         "type": "string",
                         "error": "KCHVM0026E"
                     }
+                },
+                "cpus": {
+                    "description": "The new number of virtual CPUs for the VM",
+                    "type": "integer",
+                    "minimum": 1,
+                    "error": "KCHTMPL0012E"
+                },
+                "memory": {
+                    "description": "The new amount (MB) of memory for the VM",
+                    "type": "integer",
+                    "minimum": 512,
+                    "error": "KCHTMPL0013E"
                 }
             }
         },
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 3fc3013..5207183 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -106,7 +106,7 @@ messages = {
     "KCHTMPL0009E": _("Template icon must be a path to the image"),
     "KCHTMPL0010E": _("Template distribution must be a string"),
     "KCHTMPL0011E": _("Template distribution version must be a string"),
-    "KCHTMPL0012E": _("The number of CPUs must be a integer"),
+    "KCHTMPL0012E": _("The number of CPUs must be an integer greater than 0"),
     "KCHTMPL0013E": _("Amount of memory (MB) must be an integer greater than 512"),
     "KCHTMPL0014E": _("Template CDROM must be a local or remote ISO file"),
     "KCHTMPL0015E": _("Invalid storage pool URI %(value)s specified for template"),
-- 
1.9.0




More information about the Kimchi-devel mailing list