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

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Thu Dec 26 10:21:34 UTC 2013


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

for json schema,  verify the 'networks' option when create template or update template.
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.",
+                    "type": "array",
+                    "minItems": 1,
+                    "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,
+                    "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', [])}
 
 
-- 
1.8.4.2




More information about the Kimchi-devel mailing list