[Kimchi-devel] [PATCH 1/5] Storage Pool Add Volume UI: Add APIs to kimchi.api.js

Aline Manera alinefm at linux.vnet.ibm.com
Mon Sep 15 21:28:49 UTC 2014


From: Hongliang Wang <hlwang at linux.vnet.ibm.com>

Add API to handle downloand and upload features.

Signed-off-by: Hongliang Wang <hlwang at linux.vnet.ibm.com>
Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.api.js | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 681f573..3398bd4 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -1142,5 +1142,40 @@ var kimchi = {
                 kimchi.message.error(data.responseJSON.reason);
             }
         });
+    },
+
+    /**
+     * Add a volume to a given storage pool.
+     */
+    uploadVolumeToSP: function(settings, suc, err) {
+        var fd = settings['formData'];
+        var sp = encodeURIComponent(settings['sp']);
+        kimchi.requestJSON({
+            url : kimchi.url + 'storagepools/' + sp + '/storagevolumes',
+            type : 'POST',
+            data : fd,
+            processData : false,
+            contentType : false,
+            dataType: 'json',
+            success : suc,
+            error : err
+        });
+    },
+
+    /**
+     * Add a volume to a given storage pool by URL.
+     */
+    downloadVolumeToSP: function(settings, suc, err) {
+        var sp = encodeURIComponent(settings['sp']);
+        delete settings['sp'];
+        kimchi.requestJSON({
+            url : kimchi.url + 'storagepools/' + sp + '/storagevolumes',
+            type : 'POST',
+            data : JSON.stringify(settings),
+            contentType : 'application/json',
+            dataType : 'json',
+            success : suc,
+            error : err
+        });
     }
 };
-- 
1.9.3




More information about the Kimchi-devel mailing list