From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
we set ticket as sub-resource of vm resource.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
src/kimchi/API.json | 14 ++++++++++++++
src/kimchi/control/vms.py | 13 +++++++++++++
2 files changed, 27 insertions(+)
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 3616509..f5087e7 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -328,6 +328,20 @@
}
}
},
+ "vmticket_update": {
+ "type": "object",
+ "properties": {
+ "passwd": {
+ "description": "the password of ticket.",
+ "minLength": 1,
+ "type": "string"
+ },
+ "expire": {
+ "description": "lifetime of a ticket.",
+ "type": "number"
+ }
+ }
+ },
"templates_create": {
"type": "object",
"error": "KCHTMPL0016E",
diff --git a/src/kimchi/control/vms.py b/src/kimchi/control/vms.py
index 508f478..acc4a1f 100644
--- a/src/kimchi/control/vms.py
+++ b/src/kimchi/control/vms.py
@@ -34,6 +34,7 @@ def __init__(self, model, ident):
super(VM, self).__init__(model, ident)
self.update_params = ["name", "users", "groups",
"cpus", "memory"]
self.screenshot = VMScreenShot(model, ident)
+ self.ticket = VMTicket(model, ident)
self.uri_fmt = '/vms/%s'
for ident, node in sub_nodes.items():
setattr(self, ident, node(model, self.ident))
@@ -55,3 +56,15 @@ def __init__(self, model, ident):
def get(self):
self.lookup()
raise internal_redirect(self.info)
+
+
+class VMTicket(Resource):
+ def __init__(self, model, ident):
+ super(VMTicket, self).__init__(model, ident)
+ self.update_params = ["passwd", "expire"]
+ self.uri_fmt = '/vms/%s/ticket'
+ self.reset = self.generate_action_handler('reset')
+
+ @property
+ def data(self):
+ return self.info
--
1.9.3