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

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Wed Apr 16 18:30:54 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         |  3 +++
 src/kimchi/API.json | 12 ++++++++++++
 src/kimchi/i18n.py  |  3 ++-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/docs/API.md b/docs/API.md
index 716c983..845867c 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -103,6 +103,9 @@ 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 (only applied for shutoff VM)
+    * memory: New amount of memory (MB) for this VM (only applied for shutoff
+      VM)
 * **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..15cfd16 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -86,6 +86,7 @@ messages = {
     "KCHVM0026E": _("Group name must be a string"),
     "KCHVM0027E": _("User %(user)s does not exist"),
     "KCHVM0028E": _("Group %(group)s does not exist"),
+    "KCHVM0029E": _("Unable to update virtual machine in running state. You must power it off before."),
 
     "KCHVMIF0001E": _("Interface %(iface)s does not exist in virtual machine %(name)s"),
     "KCHVMIF0002E": _("Network %(network)s specified for virtual machine %(name)s does not exist"),
@@ -106,7 +107,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