[Kimchi-devel] [PATCH 9/9 - v6] Change UI to support remotion of 'storagepool' from template backend

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Wed Dec 2 15:59:26 UTC 2015


Template edit window still waits for 'storagepool' tag, which does not
exist in backgroun anymore. So, UI was not working.
This patch fixes this issue.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
 .../plugins/kimchi/ui/js/src/kimchi.template_edit_main.js   | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/wok/plugins/kimchi/ui/js/src/kimchi.template_edit_main.js b/src/wok/plugins/kimchi/ui/js/src/kimchi.template_edit_main.js
index 10f11ed..5791ea0 100644
--- a/src/wok/plugins/kimchi/ui/js/src/kimchi.template_edit_main.js
+++ b/src/wok/plugins/kimchi/ui/js/src/kimchi.template_edit_main.js
@@ -18,7 +18,6 @@
 kimchi.template_edit_main = function() {
     var templateEditMain = $('#edit-template-tabs');
     var origDisks;
-    var origPool;
     var origNetworks;
     var templateDiskSize;
     $('#template-name', templateEditMain).val(kimchi.selectedTemplate);
@@ -32,7 +31,6 @@ kimchi.template_edit_main = function() {
 
     var initTemplate = function(template) {
         origDisks = template.disks;
-        origPool = template.storagepool;
         origNetworks = template.networks;
         for(var i=0;i<template.disks.length;i++){
             if(template.disks[i].base){
@@ -162,10 +160,10 @@ kimchi.template_edit_main = function() {
                 });
             };  // End of addStorageItem funtion
 
-            if ((origDisks && origDisks.length) && (origPool && origPool.length)) {
+            if (origDisks && origDisks.length) {
                 origDisks.sort(function(a, b){return a.index-b.index});
                 $.each(origDisks, function(index, diskEntities) {
-                    var defaultPool = diskEntities.pool.name ? diskEntities.pool.name.split('/').pop() : origPool.split('/').pop()
+                    var defaultPool = diskEntities.pool.name.split('/').pop()
                     var storageNodeData = {
                         storageIndex : diskEntities.index,
                         storageName : diskEntities.volume ? defaultPool + '/' + diskEntities.volume : defaultPool,
@@ -284,15 +282,16 @@ kimchi.template_edit_main = function() {
         $.each(disks, function(index, diskEntity) {
             var newDisk = {
                 'index' : index,
-                'pool' : '/plugins/kimchi/storagepools/' + $(diskEntity).find('.template-storage-name').val(),
+                'pool' : {'name': '/plugins/kimchi/storagepools/' + $(diskEntity).find('.template-storage-name').val()},
                 'size' : Number($(diskEntity).find('.template-storage-disk').val()),
                 'format' : $(diskEntity).find('.template-storage-disk-format').val()
             };
 
             var storageType = $(diskEntity).find('.template-storage-type').val();
             if(storageType === 'iscsi' || storageType === 'scsi') {
-                newDisk['volume'] = newDisk['pool'].split('/').pop();
-                newDisk['pool'] =  newDisk['pool'].slice(0,  newDisk['pool'].lastIndexOf('/'));
+                newDisk['volume'] = newDisk['pool']['name'].split('/').pop();
+                newDisk['pool']['name'] =  newDisk['pool']['name'].slice(0,  newDisk['pool']['name'].lastIndexOf('/'));
+                delete newDisk.size;
             }
             disksForUpdate.push(newDisk);
         });
-- 
2.1.0




More information about the Kimchi-devel mailing list