[Kimchi-devel] [kimchi-devel][PATCH 2/5] Update docs and json schema of storage volume upload

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Wed Jan 7 09:01:06 UTC 2015


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

File upload will use the same REST api as 'capacity' type when creating
storage volume. Uploading will be implemented by following storage volume
update.

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

diff --git a/docs/API.md b/docs/API.md
index 210a036..b160405 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -471,13 +471,12 @@ A interface represents available network interface on VM.
            in the defined Storage Pool
 * **POST**: Create a new Storage Volume in the Storage Pool
             The return resource is a task resource * See Resource: Task *
-            Only one of 'file', 'capacity', 'url' can be specified.
+            Only one of 'capacity', 'url' can be specified.
     * name: The name of the Storage Volume
     * type: The type of the defined Storage Volume
     * capacity: The total space which can be used to store volumes
                 The unit is MBytes
     * format: The format of the defined Storage Volume
-    * file: File to be uploaded, passed through form data
     * url: URL to be downloaded
 
 ### Resource: Storage Volume
@@ -505,6 +504,10 @@ A interface represents available network interface on VM.
 
 * **DELETE**: Remove the Storage Volume
 * **POST**: *See Storage Volume Actions*
+* **PUT**: Upload storage volume chunk
+    * index: Chunk index of the slice in file.
+    * chunk_size: Chunk size of the slice in Bytes.
+    * chunk: Actual data of uploaded file
 
 **Actions (POST):**
 
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index fd4c901..a64ec38 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -221,6 +221,25 @@
                 }
             }
         },
+        "storagevolume_update": {
+            "type": "object",
+            "properties": {
+                "chunk": {
+                    "description": "Upload storage volume chunk"
+                },
+                "index": {
+                    "description": "Chunk index of uploaded storage volume",
+                    "type": "string",
+                    "error": "KCHVOL0024E"
+                },
+                "chunk_size": {
+                    "description": "Chunk size of uploaded storage volume",
+                    "type": "string",
+                    "error": "KCHVOL0024E"
+                }
+            },
+            "additionalProperties": false
+        },
         "vms_create": {
             "type": "object",
             "error": "KCHVM0016E",
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index e3a051c..b1eaee9 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -211,6 +211,7 @@ messages = {
     "KCHVOL0021E": _("Storage volume URL must be http://, https://, ftp:// or ftps://."),
     "KCHVOL0022E": _("Unable to access file %(url)s. Please, check it."),
     "KCHVOL0023E": _("Unable to clone storage volume '%(name)s' in pool '%(pool)s'. Details: %(err)s"),
+    "KCHVOL0024E": _("Upload volume chunk index, size and total size must be integer"),
 
     "KCHIFACE0001E": _("Interface %(name)s does not exist"),
 
-- 
1.9.3




More information about the Kimchi-devel mailing list