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

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Mon Dec 30 16:04:57 UTC 2013


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

for json schema,  verify the 'networks' option when creating or
updating template.
for controller, add 'networks' attribute when GET template.

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

diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 7b90826..527bb60 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -125,6 +125,12 @@
                     "type": "string",
                     "pattern": "^/storagepools/[^/]+/?$"
                 },
+                "networks": {
+                    "description": "list of which networks will be assigned to the new VM.",
+                    "type": "array",
+                    "items": { "type": "string" },
+                    "uniqueItems": true
+                },
                 "folder": {
                     "description": "Folder",
                     "type": "array",
@@ -198,6 +204,12 @@
                     "type": "string",
                     "pattern": "^/storagepools/[^/]+/?$"
                 },
+                "networks": {
+                    "description": "list of which networks will be assigned to the new VM.",
+                    "type": "array",
+                    "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