[Kimchi-devel] [WIP 2/2] UI: support to create a scsi pool

Sheldon shaohef at linux.vnet.ibm.com
Mon Mar 24 14:03:56 UTC 2014


test this patch, please run
create a  simulated scsi  HBA First
# echo em1 > /sys/module/libfcoe/parameters/create

Then in the storage page, create a scsi pool.

On 03/24/2014 07:31 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> This patch is used to create a scsi pool.
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
>   ui/js/src/kimchi.storagepool_add_main.js | 33 ++++++++++++++++++++++++++++++++
>   ui/pages/storagepool-add.html.tmpl       | 15 +++++++++++++++
>   2 files changed, 48 insertions(+)
>
> diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
> index 10833be..77318ef 100644
> --- a/ui/js/src/kimchi.storagepool_add_main.js
> +++ b/ui/js/src/kimchi.storagepool_add_main.js
> @@ -41,6 +41,7 @@ kimchi.initStorageAddPage = function() {
>       $('#poolTypeId').selectMenu();
>       $('#serverComboboxId').combobox();
>       $('#targetFilterSelectId').filterselect();
> +    $('#scsiHostFilterSelectId').filterselect();
>       var options = [ {
>           label : "DIR",
>           value : "dir"
> @@ -51,6 +52,9 @@ kimchi.initStorageAddPage = function() {
>           label : "iSCSI",
>           value : "iscsi"
>       }, {
> +        label : "SCSI",
> +        value : "scsi"
> +    }, {
>           label : "LOGICAL",
>           value : "logical"
>       } ];
> @@ -102,27 +106,52 @@ kimchi.initStorageAddPage = function() {
>           });
>       });
>
> +    kimchi.listHostDevices('fc_host', function(data) {
> +        var hostsContent = [];
> +        if (data.length > 0) {
> +            $.each(data, function(index, value) {
> +                hostsContent.push({
> +                    label : value.name,
> +                    value : value.name
> +                });
> +            });
> +        };
> +        $('#scsihostId').focus(function() {
> +            $('#scsiHostFilterSelectId').filterselect("setData", hostsContent);
> +        });
> +    });
> +
>       $('#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() === 'scsi') {
> +            $('.path-section').addClass('tmpl-html');
> +            $('.logical-section').addClass('tmpl-html');
> +            $('.nfs-section').addClass('tmpl-html');
> +            $('.iscsi-section').addClass('tmpl-html');
> +            $('.scsi-section').removeClass('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');
>           }
>       });
>       $('#authId').click(function() {
> @@ -260,6 +289,10 @@ kimchi.addPool = function(event) {
>                   };
>               }
>               formData.source = source;
> +        } else if (poolType === 'scsi') {
> +            var source = {};
> +            source.adapter_name = $('#scsihostId').val();
> +            formData.source = source;
>           }
>           if (poolType === 'logical') {
>               var settings = {
> diff --git a/ui/pages/storagepool-add.html.tmpl b/ui/pages/storagepool-add.html.tmpl
> index 222788f..1b8a1ff 100644
> --- a/ui/pages/storagepool-add.html.tmpl
> +++ b/ui/pages/storagepool-add.html.tmpl
> @@ -136,6 +136,21 @@
>                           </div>
>                       </section>
>                   </div>
> +                <div class="scsi-section tmpl-html">
> +                    <section class="form-section">
> +                        <h2>3. $_("Scsi Host")</h2>
> +                        <div class="field storage-field">
> +                            <p class="text-help">$_("The name of the scsi host.")</p>
> +                            <div id="scsiHostFilterSelectId" class="storage-add-input-width">
> +                                <input id="scsihostId" class="input"/>
> +                                <div>
> +                                    <ul id="scsi-host-name">
> +                                    </ul>
> +                                </div>
> +                            </div>
> +                        </div>
> +                    </section>
> +                </div>
>               </form>
>           </div>
>           <footer>


-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list