[Kimchi-devel] [PATCH V2] Bugfix:#424 Edit Template, "Disk (GB)" is changing with storage pool

Wen Wang wenwang at linux.vnet.ibm.com
Tue Sep 23 09:35:08 UTC 2014


On 09/19/2014 09:20 PM, Aline Manera wrote:
>
> On 09/19/2014 06:53 AM, Wen Wang wrote:
>> From: Wen Wang <wenwang at linux.vnet.ibm.com>
>>
>> V1 -> V2:
>> Considering iSCSI and SCSI situation that we need to have the input box
>> disabled when choosing iSCSI and SCSI for storage pool and enable when
>> choosing others.
>>
>> This patch fix the bug that value of "Disk(GB)" input box is changing
>> with the item of "Storage Pool" in "Templates" --> "Actions" --> "Edit"
>> -->"Edit Templates" dialogue. This might be comfusing to user when
>> changing the "Storage Pool", "Disk(GB)" is changed with it without even
>> notice. This might confuse the users and is not necessary. Solved by
>> removing the change.
>>
>> Signed-off-by: Wen Wang <wenwang at linux.vnet.ibm.com>
>> ---
>>   ui/js/src/kimchi.template_edit_main.js |    7 -------
>>   1 files changed, 0 insertions(+), 7 deletions(-)
>>
>> diff --git a/ui/js/src/kimchi.template_edit_main.js 
>> b/ui/js/src/kimchi.template_edit_main.js
>> index cb43091..8133878 100644
>> --- a/ui/js/src/kimchi.template_edit_main.js
>> +++ b/ui/js/src/kimchi.template_edit_main.js
>> @@ -131,13 +131,6 @@ kimchi.template_edit_main = function() {
>>                   kimchi.message.error(err.responseJSON.reason);
>>               });
>>           } else {
>
>> -            if (origPool == storagepool) {
>> -                // Previous disk size value
>> -                $('input[name="disks"]', 
>> templateEditForm).val(origDisks[0].size);
>> -            } else {
>> -                // Default disk size value
>> -                $('input[name="disks"]', templateEditForm).val(10);
>> -            }
>
> The same I commented on previous patch:
>
> If we don't update the disk size value when a no iSCSI nor SCSI device 
> is selected, the input box will contain the previous value which can 
> be not valid.
> Example.
>
> 1. Select a dir pool
> 2. Disk size is set to 10Gb
> 3. Select a iSCSI volume
> 4. Disk size is set to 4GB
> 5. Select back the dir pool
>
> 6.a Disk size is still set to 4GB (*without* those 2 lines)
> 6.b Disk size turns back to 4GB (*with* the 2 lines)
>
> From my view, the correct behavior is 6.b
I have tried your proposal, And there occurs one more problem just 
according to this change. Think about the scenario below:
Current template is

"Storage Pool: default
   Disk(GB): 15"

And user change the "Disk(GB)" value to 30( without saving)
then user choose the "Storage Pool" and decided to use "ISO", by 
choosing that, the value of "Disk(GB)" changed to 15 which is the value 
set for "default" and that value makes no sense to "ISO" so as the 
change of this value.

=======================================================================================
After discussing with YuXin, there exists issue with the "default", 
"user-input" and the "system" values for this part. "default" value is 
kimchi's default 10G. "user-input" value go with the user's input. 
"system" value is the one that used for iSCSI and SCSI storage pool that 
is automatically set by system.

The "system" value is the one that is not editable and will change if 
user choose iSCSI or SCSI. The question turns out to be what are we 
going to display to users (1) storage pool changes and (2) storage pool 
changes from iSCSI or SCSI back to others

Here is my opinion, for (1), we keep the user input no matter which 
storage pool that is editable for "Disk(GB)", we set a var that listen 
to this part, change when there is any input. If changing to iSCSI or 
SCSI, disable "Disk(GB)" and refresh it with the system value.

(2) When Changing back from iSCSI or SCSI, enable the "Disk(GB)" and set 
its value to the previous input. Patch has been sent:

[PATCH V3] Bugfix:#424 Edit Template, "Disk (GB)" is changing with 
storage pool
>
>>               $('input[name="disks"]', 
>> templateEditForm).removeAttr('disabled');
>>           }
>>       });
>

-- 

=======================================================
Best Regards
Wang Wen




More information about the Kimchi-devel mailing list