[Kimchi-devel] [PATCHv6 2/7] Change doc and api specification

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Wed Aug 6 09:03:43 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

Add 'base' to 'disks' param to create template,
so that we can support create template from image.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 docs/API.md         | 3 ++-
 src/kimchi/API.json | 8 +++++++-
 src/kimchi/i18n.py  | 1 +
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/docs/API.md b/docs/API.md
index aebf563..d75c55f 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -181,7 +181,7 @@ Represents a snapshot of the Virtual Machine's primary monitor.
     * cpus *(optional)*: The number of CPUs assigned to the VM. Default is 1.
     * memory *(optional)*: The amount of memory assigned to the VM.
       Default is 1024M.
-    * cdrom *(required)*: A volume name or URI to an ISO image.
+    * cdrom *(optional)*: A volume name or URI to an ISO image.
     * storagepool *(optional)*: URI of the storagepool.
       Default is '/storagepools/default'
     * networks *(optional)*: list of networks will be assigned to the new VM.
@@ -190,6 +190,7 @@ Represents a snapshot of the Virtual Machine's primary monitor.
       (either *size* or *volume* must be specified):
         * index: The device index
         * size: The device size in GB
+        * base: Base image of this disk
 
     * graphics *(optional)*: The graphics paramenters of this template
         * type: The type of graphics. It can be VNC or spice or None.
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index 4b432a2..a8bc61f 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -389,7 +389,6 @@
                     "description": "Path for cdrom",
                     "type": "string",
                     "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$",
-                    "required": true,
                     "error": "KCHTMPL0014E"
                 },
                 "disks": {
@@ -408,7 +407,14 @@
                                 "type": "number",
                                 "minimum": 1,
                                 "error": "KCHTMPL0022E"
+                            },
+                            "base": {
+                                "description": "Base image of the disk",
+                                "type": "string",
+                                "pattern": "^/.+$",
+                                "error": "KCHTMPL0023E"
                             }
+
                         }
                     },
                     "minItems": 1,
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index acac67b..dc19bde 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -128,6 +128,7 @@ messages = {
     "KCHTMPL0020E": _("Unable to create template due error: %(err)s"),
     "KCHTMPL0021E": _("Unable to delete template due error: %(err)s"),
     "KCHTMPL0022E": _("Disk size must be greater than 1GB."),
+    "KCHTMPL0023E": _("Template base image must be a valid local image file"),
 
     "KCHPOOL0001E": _("Storage pool %(name)s already exists"),
     "KCHPOOL0002E": _("Storage pool %(name)s does not exist"),
-- 
1.8.3.2




More information about the Kimchi-devel mailing list