[Kimchi-devel] [PATCH V2 3/6] template supports networks: update controller and json schema

Aline Manera alinefm at linux.vnet.ibm.com
Mon Dec 30 11:18:10 UTC 2013


On 12/27/2013 07:21 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> for json schema,  verify the 'networks' option when create template or update template.

when creating or updating

> for controller, add 'networks' attribute when GET template.
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
>   src/kimchi/API.json      | 14 ++++++++++++++
>   src/kimchi/controller.py |  3 ++-
>   2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/src/kimchi/API.json b/src/kimchi/API.json
> index 7b90826..6f72d13 100644
> --- a/src/kimchi/API.json
> +++ b/src/kimchi/API.json
> @@ -125,6 +125,13 @@
>                       "type": "string",
>                       "pattern": "^/storagepools/[^/]+/?$"
>                   },
> +                "networks": {
> +                    "description": "name list of which networks will be assigned to the a new VM.",

s/name list/list

> +                    "type": "array",
> +                    "minItems": 1,

Can't I create a VM without network?

> +                    "items": { "type": "string" },
> +                    "uniqueItems": true
> +                },
>                   "folder": {
>                       "description": "Folder",
>                       "type": "array",
> @@ -198,6 +205,13 @@
>                       "type": "string",
>                       "pattern": "^/storagepools/[^/]+/?$"
>                   },
> +                "networks": {

> +                    "description": "name list of which networks will be assigned to the a new VM.",
> +                    "type": "array",
> +                    "minItems": 1,

Same as I commented above

> +                    "items": { "type": "string" },
> +                    "uniqueItems": true
> +                },
>                   "folder": {
>                       "description": "Folder",
>                       "type": "array",
> diff --git a/src/kimchi/controller.py b/src/kimchi/controller.py
> index 2940278..4a88a2d 100644
> --- a/src/kimchi/controller.py
> +++ b/src/kimchi/controller.py
> @@ -406,7 +406,7 @@ class Template(Resource):
>           super(Template, self).__init__(model, ident)
>           self.update_params = ["name", "folder", "icon", "os_distro",
>                                 "storagepool", "os_version", "cpus",
> -                              "memory", "cdrom", "disks"]
> +                              "memory", "cdrom", "disks", "networks"]
>           self.uri_fmt = "/templates/%s"
>
>       @property
> @@ -420,6 +420,7 @@ class Template(Resource):
>                   'cdrom': self.info['cdrom'],
>                   'disks': self.info['disks'],
>                   'storagepool': self.info['storagepool'],
> +                'networks': self.info['networks'],
>                   'folder': self.info.get('folder', [])}
>
>




More information about the Kimchi-devel mailing list