[Kimchi-devel] [V1 1/2] Fibre Channel SCSI Storage Pool UI

Aline Manera alinefm at linux.vnet.ibm.com
Fri Feb 14 12:12:23 UTC 2014


On 02/14/2014 10:00 AM, huoyuxin at linux.vnet.ibm.com wrote:
> From: Yu Xin Huo <huoyuxin at linux.vnet.ibm.com>
>
> add a new type of storage pool fibre channel scsi.
> if this type of storage pool is selected,
> send a request to get all host PCI devices,
> then list them for user selection.
>
> Signed-off-by: Yu Xin Huo <huoyuxin at linux.vnet.ibm.com>
> ---
>   ui/js/src/kimchi.api.js                  |   14 +++++++++++++
>   ui/js/src/kimchi.storagepool_add_main.js |   31 ++++++++++++++++++++++++++++-
>   ui/pages/i18n.html.tmpl                  |    1 +
>   ui/pages/storagepool-add.html.tmpl       |   12 +++++++++++
>   4 files changed, 56 insertions(+), 2 deletions(-)
>
> diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
> index 6433fe0..686141b 100644
> --- a/ui/js/src/kimchi.api.js
> +++ b/ui/js/src/kimchi.api.js
> @@ -731,5 +731,19 @@ var kimchi = {
>               success : suc,
>               error : err
>           });
> +    },
> +
> +    getHostPCIDevices: function(suc, err) {
> +        var url = kimchi.url+'host/devices?_cap=fc_host';
> +        kimchi.requestJSON({
> +            url : url,
> +            type : 'GET',
> +            contentType : 'application/json',
> +            dataType : 'json',
> +            success : suc,
> +            error : err ? err : function(data) {
> +                kimchi.message.error(data.responseJSON.reason);
> +            }
> +        });
>       }
>   };
> diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
> index ac97e1a..c65443e 100644
> --- a/ui/js/src/kimchi.storagepool_add_main.js
> +++ b/ui/js/src/kimchi.storagepool_add_main.js
> @@ -55,7 +55,6 @@ kimchi.initStorageAddPage = function() {
>               });
>               $('.host-partition').html(listHtml);
>           }
> -        $('#poolTypeId').selectMenu("setData", options);
>           kimchi.getStorageServers('netfs', function(data) {
>               var serverContent = [];
>               if (data.length > 0) {
> @@ -101,27 +100,53 @@ kimchi.initStorageAddPage = function() {
>                   });
>               });
>           });
> +        kimchi.getHostPCIDevices(function(data){
> +            if(data.length>0){
> +                options.push({
> +                    label : i18n.KCHSP6001M,
> +                    value : "scsi"
> +                });
> +                for(var i=0;i<data.length;i++){
> +                    data[i].label = data[i].name;
> +                    data[i].value = data[i].name;
> +                }
> +                $('#scsiAdapter').selectMenu();
> +                $("input", "#scsiAdapter").val(data[0].name);
> +                $('#scsiAdapter').selectMenu("setData", data);
> +            }
> +            $('#poolTypeId').selectMenu("setData", options);
> +        });
>           $('#poolTypeInputId').change(function() {
>               if ($(this).val() === 'dir') {
>                   $('.path-section').removeClass('tmpl-html');
>                   $('.logical-section').addClass('tmpl-html');
>                   $('.nfs-section').addClass('tmpl-html');
>                   $('.iscsi-section').addClass('tmpl-html');
> +                $('.scsi-section').addClass('tmpl-html');
>               } else if ($(this).val() === 'netfs') {
>                   $('.path-section').addClass('tmpl-html');
>                   $('.logical-section').addClass('tmpl-html');
>                   $('.nfs-section').removeClass('tmpl-html');
>                   $('.iscsi-section').addClass('tmpl-html');
> +                $('.scsi-section').addClass('tmpl-html');
>               } else if ($(this).val() === 'iscsi') {
>                   $('.path-section').addClass('tmpl-html');
>                   $('.logical-section').addClass('tmpl-html');
>                   $('.nfs-section').addClass('tmpl-html');
>                   $('.iscsi-section').removeClass('tmpl-html');
> +                $('.scsi-section').addClass('tmpl-html');
>               } else if ($(this).val() === 'logical') {
>                   $('.path-section').addClass('tmpl-html');
>                   $('.logical-section').removeClass('tmpl-html');
>                   $('.nfs-section').addClass('tmpl-html');
>                   $('.iscsi-section').addClass('tmpl-html');
> +                $('.scsi-section').addClass('tmpl-html');
> +            } else if ($(this).val() === 'scsi') {
> +                $('.scsi-section').removeClass('tmpl-html');
> +                $('.path-section').addClass('tmpl-html');
> +                $('.logical-section').addClass('tmpl-html');
> +                $('.nfs-section').addClass('tmpl-html');
> +                $('.iscsi-section').addClass('tmpl-html');
>               }
>           });
>           $('#authId').click(function() {
> @@ -157,7 +182,7 @@ kimchi.validateForm = function() {
>       } else if (poolType === "logical") {
>           return kimchi.validateLogicalForm();
>       } else {
> -        return false;
> +        return true;
>       }
>   };
>
> @@ -260,6 +285,8 @@ kimchi.addPool = function(event) {
>                   };
>               }
>               formData.source = source;
> +        } else if (poolType === 'scsi'){
> +            formData.source = { adapter_name: $('#scsiAdapter').selectMenu('value') };
>           }
>           if (poolType === 'logical') {
>               var settings = {
> diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl
> index 098a0a9..983fba0 100644
> --- a/ui/pages/i18n.html.tmpl
> +++ b/ui/pages/i18n.html.tmpl
> @@ -93,6 +93,7 @@ var i18n = {
>       'KCHDR6009M': "$_("Remove")",
>       'KCHDR6010M': "$_("Download")",

> +    'KCHSP6001M': "$_("SCSI Fibre Channel")",

For storage pool use KCHPOOL<num>M
There are already some message using this

>
>       'KCHVM6001M': "$_("This will delete the virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")",
>
> diff --git a/ui/pages/storagepool-add.html.tmpl b/ui/pages/storagepool-add.html.tmpl
> index 9e93298..f35013b 100644
> --- a/ui/pages/storagepool-add.html.tmpl
> +++ b/ui/pages/storagepool-add.html.tmpl
> @@ -135,6 +135,18 @@
>                           </div>
>                       </section>
>                   </div>
> +                <div class="scsi-section tmpl-html">
> +                    <section class="form-section">
> +                        <h2>3. $_("SCSI Adapter")</h2>
> +                        <div class="storage-type-wrapper-controls">
> +                        <div id="scsiAdapter">
> +                            <input type="hidden"/>
> +                            <span></span><span class="arrow"></span>
> +                            <div><ul></ul></div>
> +                        </div>
> +                        </div>
> +                    </section>
> +                </div>
>               </form>
>           </div>
>           <footer>




More information about the Kimchi-devel mailing list