[Kimchi-devel] [PATCH][Kimchi] Pass disk path when template is image based

Ramon Medeiros ramonn at linux.vnet.ibm.com
Wed Apr 20 18:29:12 UTC 2016


UI wasn't passing path to image disk when updating it, so the backend
was losing the disk.

Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.template_edit_main.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index de72452..8b5abfb 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -20,6 +20,7 @@ kimchi.template_edit_main = function() {
     var origDisks;
     var origNetworks;
     var templateDiskSize;
+    var baseImageTemplate;
     $('#template-name', templateEditMain).val(kimchi.selectedTemplate);
     $('#edit-template-tabs a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
         $('.tab-content').css('overflow','hidden');
@@ -89,6 +90,7 @@ kimchi.template_edit_main = function() {
             }
             return false;
         }
+        baseImageTemplate = isImageBasedTemplate;
         enableSpice();
         $('#template-edit-graphics').selectpicker();
 
@@ -334,7 +336,9 @@ kimchi.template_edit_main = function() {
         var data = {};
         var disks = $('.template-tab-body .item', '#form-template-storage');
         var disksForUpdate = new Array();
+
         $.each(disks, function(index, diskEntity) {
+
             var newDisk = {
                 'index' : index,
                 'pool' : {'name': '/plugins/kimchi/storagepools/' + $(diskEntity).find('.template-storage-name').val()},
@@ -342,6 +346,11 @@ kimchi.template_edit_main = function() {
                 'format' : $(diskEntity).find('.template-storage-disk-format').val()
             };
 
+            // image based template: add base to dictionary
+            if ((baseImageTemplate()) && (index == 0))  {
+                newDisk["base"] = $('#template-edit-vmimage-textbox').val();
+            }
+
             var storageType = $(diskEntity).find('.template-storage-type').val();
             if(storageType === 'iscsi' || storageType === 'scsi') {
                 newDisk['volume'] = newDisk['pool']['name'].split('/').pop();
-- 
2.5.5




More information about the Kimchi-devel mailing list