[Kimchi-devel] [PATCH V2 2/5] vm ticket in backend: update controller and API.json
Aline Manera
alinefm at linux.vnet.ibm.com
Thu Jul 17 00:44:45 UTC 2014
On 07/15/2014 12:45 PM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> we set ticket as sub-resource of vm resource.
>
> Signed-off-by: ShaoHe Feng <shaohef at 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"
You need to set the "error" string for invalid inputs
> + },
> + "expire": {
> + "description": "lifetime of a ticket.",
> + "type": "number"
Same for expire
> + }
> + }
> + },
> "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
More information about the Kimchi-devel
mailing list