[Kimchi-devel] [PATCH 3/3] UI: set the correct disks field and storage pool filed when initialize the template edit page.

Aline Manera alinefm at linux.vnet.ibm.com
Fri Apr 11 01:16:10 UTC 2014


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 04/02/2014 11:19 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> The storage pool filed should be the combination of pool name and volume
> name, when the pool is iscsi/scsi.
>
> Also the disks field should be the size of the iscsi/scsi lun.
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
>   ui/js/src/kimchi.template_edit_main.js | 17 +++++++++++++++--
>   1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
> index 0aaf6e5..7cf2611 100644
> --- a/ui/js/src/kimchi.template_edit_main.js
> +++ b/ui/js/src/kimchi.template_edit_main.js
> @@ -29,8 +29,21 @@ kimchi.template_edit_main = function() {
>               $('input[name="' + prop + '"]', templateEditForm).val(value);
>           }
>           var disks = template.disks;
> -        $('input[name="disks"]').val(disks[0].size);
> -
> +        if ('size' in disks[0]) {
> +            $('input[name="disks"]').val(disks[0].size);
> +            $('input[name="disks"]').prop( "disabled",false);
> +        } else if ('volume' in disks[0]){
> +            $('input[name="disks"]').prop( "disabled",true);
> +            $('input[name="storagepool"]', templateEditForm).val(template['storagepool'] + "/" + disks[0].volume);
> +            storageArray = template['storagepool'].split("/");
> +            poolName = storageArray[2];
> +            kimchi.listStorageVolume(poolName, disks[0].volume, function(result) {
> +                if (result) {
> +                    size = result.allocation/(1024*1024*1024);
> +                    $('input[name="disks"]').val(size.toFixed(1));
> +                }
> +            });
> +        }
>           var options = [{label: 'VNC', value: 'vnc'}];
>           kimchi.getCapabilities(function(result) {
>               if (result.qemu_spice == true) {




More information about the Kimchi-devel mailing list