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

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Tue Dec 31 13:44:59 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/control/templates.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/control/templates.py b/src/kimchi/control/templates.py
index 30875cd..bf40e2c 100644
--- a/src/kimchi/control/templates.py
+++ b/src/kimchi/control/templates.py
@@ -35,7 +35,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
@@ -49,4 +49,5 @@ 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