[Kimchi-devel] [PATCH V4 2/5] vm ticket in backend: update controller and API.json

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Wed Jul 23 10:49:06 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

verify parameters when update the ticket of a VM.

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
---
 src/kimchi/API.json       | 16 ++++++++++++++++
 src/kimchi/control/vms.py |  3 ++-
 src/kimchi/i18n.py        |  2 ++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 3616509..4b432a2 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -235,6 +235,22 @@
                         "error": "KCHVM0026E"
                     }
                 },
+                "ticket": {
+                    "description": "A ticket represents credentials to access VM",
+                    "type": "object",
+                    "properties": {
+                        "password": {
+                            "description": "the password of a ticket.",
+                            "type": "string",
+                            "error": "KCHVM0031E"
+                        },
+                        "size": {
+                            "description": "lifetime of a ticket.",
+                            "type": "number",
+                            "error": "KCHVM0032E"
+                        }
+                    }
+                },
                 "cpus": {
                     "description": "The new number of virtual CPUs for the VM",
                     "type": "integer",
diff --git a/src/kimchi/control/vms.py b/src/kimchi/control/vms.py
index cf427fa..8e86cdc 100644
--- a/src/kimchi/control/vms.py
+++ b/src/kimchi/control/vms.py
@@ -32,7 +32,8 @@ def __init__(self, model):
 class VM(Resource):
     def __init__(self, model, ident):
         super(VM, self).__init__(model, ident)
-        self.update_params = ["name", "users", "groups", "cpus", "memory"]
+        self.update_params = ["name", "users", "groups", "cpus", "memory",
+                              "ticket"]
         self.screenshot = VMScreenShot(model, ident)
         self.uri_fmt = '/vms/%s'
         for ident, node in sub_nodes.items():
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index 0c76145..39dd623 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -89,6 +89,8 @@
     "KCHVM0028E": _("Group(s) '%(groups)s' do not exist"),
     "KCHVM0029E": _("Unable to shutdown virtual machine %(name)s. Details: %(err)s"),
     "KCHVM0030E": _("Unable to get access metadata of virtual machine %(name)s. Details: %(err)s"),
+    "KCHVM0031E": _("password of a vm ticket must be a string."),
+    "KCHVM0032E": _("expire of a vm ticket must be a number."),
 
     "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"),
-- 
1.9.3




More information about the Kimchi-devel mailing list