
On 04/02/2014 11:19 AM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
when pool is scsi/iscsi, we should not let user input the size of disk.
We should get the disk size from the volume information.
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- ui/js/src/kimchi.template_edit_main.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js index 386095b..0aaf6e5 100644 --- a/ui/js/src/kimchi.template_edit_main.js +++ b/ui/js/src/kimchi.template_edit_main.js @@ -101,6 +101,25 @@ kimchi.template_edit_main = function() { kimchi.window.close(); });
+ $('#template-edit-storagePool').change(function() { + storagepool = $(this).val(); + storageArray = storagepool.split("/"); + if (storageArray.length > 3){ + $('input[name="disks"]').prop( "disabled",true); + volumeName = storageArray.pop(); + poolName = storageArray[2] + kimchi.listStorageVolume(poolName, volumeName, function(result) { + if (result) { + size = result.allocation/(1024*1024*1024); + $('input[name="disks"]').val(size.toFixed(1)); + } + }); + } else {
+ $('input[name="disks"]').prop( "disabled",false); + $('input[name="disks"]').val(''); + }
That way we will empty the "Disk size" field when changing the storage pool I'd expect to keep the same volume size there too (10G by default)
+ }); + $('#tmpl-edit-button-save').on('click', function() { var editableFields = [ 'name', 'cpus', 'memory', 'storagepool', 'disks', 'graphics']; var data = {};