[Kimchi-devel] [kimchi-devel][PATCHv3 1/6] Update docs and json schema of storage volume upload

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Wed Jan 28 13:20:26 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 5c4ccd3..d61e9b1 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -474,13 +474,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 bytes
     * 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
@@ -508,6 +507,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 0cfa20c..52ce4c3 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 4eccc3e..0a31cd5 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -210,6 +210,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"),
 
-- 
2.1.0




More information about the Kimchi-devel mailing list