[Kimchi-devel] [PATCH 3/3] UI: set the correct disks field and storage pool filed when initialize the template edit page.

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Wed Apr 2 14:19:45 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

The storage pool filed should be the combination of pool name and volume
name, when the pool is iscsi/scsi.

Also the disks field should be the size of the iscsi/scsi lun.

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.template_edit_main.js | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index 0aaf6e5..7cf2611 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -29,8 +29,21 @@ kimchi.template_edit_main = function() {
             $('input[name="' + prop + '"]', templateEditForm).val(value);
         }
         var disks = template.disks;
-        $('input[name="disks"]').val(disks[0].size);
-
+        if ('size' in disks[0]) {
+            $('input[name="disks"]').val(disks[0].size);
+            $('input[name="disks"]').prop( "disabled",false);
+        } else if ('volume' in disks[0]){
+            $('input[name="disks"]').prop( "disabled",true);
+            $('input[name="storagepool"]', templateEditForm).val(template['storagepool'] + "/" + disks[0].volume);
+            storageArray = template['storagepool'].split("/");
+            poolName = storageArray[2];
+            kimchi.listStorageVolume(poolName, disks[0].volume, function(result) {
+                if (result) {
+                    size = result.allocation/(1024*1024*1024);
+                    $('input[name="disks"]').val(size.toFixed(1));
+                }
+            });
+        }
         var options = [{label: 'VNC', value: 'vnc'}];
         kimchi.getCapabilities(function(result) {
             if (result.qemu_spice == true) {
-- 
1.8.5.3




More information about the Kimchi-devel mailing list