[Kimchi-devel] [PATCH] [Kimchi] Fix add storage device to VM using existing disk

Socorro Stoppler socorro at linux.vnet.ibm.com
Wed Jan 27 22:21:37 UTC 2016


This patch fixes the error of not being able to attach a
storage device to a VM using an existing disk.  The problem
was due to a change in the html file, the name attribute
of the select component no longer exists which was still
being referenced in the code.

Signed-off-by: Socorro Stoppler <socorro at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.guest_storage_add.main.js | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/ui/js/src/kimchi.guest_storage_add.main.js b/ui/js/src/kimchi.guest_storage_add.main.js
index 0afb008..ad929a7 100644
--- a/ui/js/src/kimchi.guest_storage_add.main.js
+++ b/ui/js/src/kimchi.guest_storage_add.main.js
@@ -144,7 +144,10 @@ kimchi.guest_storage_add_main = function() {
 
     var validateCDROM = function(settings) {
         if (/^((https|http|ftp|ftps|tftp|\/).*)+$/.test(settings['path'])){
-                    return true;
+            // Delete pool and vol properties since they are not needed for cdrom
+            delete settings['pool'];
+            delete settings['vol'];
+            return true;
         }
         else {
             wok.message.error(i18n['KCHVMSTOR0001E'],'#alert-modal-container2');
@@ -154,7 +157,9 @@ kimchi.guest_storage_add_main = function() {
 
     var validateDisk = function(settings) {
         if (settings['pool'] && settings['vol']){
-                    return true;
+           // Delete path property since it's not needed for disk
+           delete settings['path'];
+           return true;
         }
         else {
             wok.message.error(i18n['KCHVMSTOR0002E'],'#alert-modal-container2');
@@ -172,16 +177,15 @@ kimchi.guest_storage_add_main = function() {
         var settings = {
             vm: kimchi.selectedGuest,
             type: typeTextbox.val(),
+            path: pathTextbox.val(),
+            pool: poolTextbox.val(),
+            vol: volTextbox.val()
         };
 
         $(submitButton).prop('disabled', true);
         $.each([pathTextbox, poolTextbox, volTextbox], function(i, c) {
             $(c).prop('disabled', true);
-            val = $(c).val();
-            if (val && val !== '') {
-                settings[$(c).attr('name')] = $(c).val();
-            }
-        });
+        }); 
         // Validate form for cdrom and disk
         validateSpecifiedForm = validator[settings['type']];
         if (!validateSpecifiedForm(settings)) {
-- 
1.9.1




More information about the Kimchi-devel mailing list