[WIP 1/2] UI: add list Host Devices API

From: ShaoHe Feng <shaohef@linux.vnet.ibm.com> This API is used to get the Devices of Host. Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- ui/js/src/kimchi.api.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js index 4310435..d6d7c4b 100644 --- a/ui/js/src/kimchi.api.js +++ b/ui/js/src/kimchi.api.js @@ -706,6 +706,18 @@ var kimchi = { }); }, + listHostDevices: function(cap, suc, err) { + parameters = cap && "?_cap=" + cap + kimchi.requestJSON({ + url : kimchi.url + 'host/devices' + parameters, + type : 'GET', + contentType : 'application/json', + dataType : 'json', + success : suc, + error : err + }); + }, + getStorageServers: function(type, suc, err) { var url = kimchi.url + 'storageservers?_target_type=' + type; kimchi.requestJSON({ -- 1.8.5.3

From: ShaoHe Feng <shaohef@linux.vnet.ibm.com> This patch is used to create a scsi pool. Signed-off-by: ShaoHe Feng <shaohef@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> -- 1.8.5.3

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@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
This patch is used to create a scsi pool.
Signed-off-by: ShaoHe Feng <shaohef@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@linux.vnet.ibm.com> IBM Linux Technology Center

Sheldon, as we talked ealier Yu Xing has already sent the patches for it: [Kimchi-devel] [V2 0/2] Fibre Channel SCSI Storage Pool UI We need to update the "Edit" template to display the scsi/iscsi storage pool as pool/volume On 03/23/2014 08:31 PM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
This API is used to get the Devices of Host.
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- ui/js/src/kimchi.api.js | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js index 4310435..d6d7c4b 100644 --- a/ui/js/src/kimchi.api.js +++ b/ui/js/src/kimchi.api.js @@ -706,6 +706,18 @@ var kimchi = { }); },
+ listHostDevices: function(cap, suc, err) { + parameters = cap && "?_cap=" + cap + kimchi.requestJSON({ + url : kimchi.url + 'host/devices' + parameters, + type : 'GET', + contentType : 'application/json', + dataType : 'json', + success : suc, + error : err + }); + }, + getStorageServers: function(type, suc, err) { var url = kimchi.url + 'storageservers?_target_type=' + type; kimchi.requestJSON({

On 03/25/2014 10:03 AM, Aline Manera wrote:
Sheldon, as we talked ealier Yu Xing has already sent the patches for it: [Kimchi-devel] [V2 0/2] Fibre Channel SCSI Storage Pool UI
We need to update the "Edit" template to display the scsi/iscsi storage pool as pool/volume
will update it. Thanks.
On 03/23/2014 08:31 PM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
This API is used to get the Devices of Host.
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- ui/js/src/kimchi.api.js | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js index 4310435..d6d7c4b 100644 --- a/ui/js/src/kimchi.api.js +++ b/ui/js/src/kimchi.api.js @@ -706,6 +706,18 @@ var kimchi = { }); },
+ listHostDevices: function(cap, suc, err) { + parameters = cap && "?_cap=" + cap + kimchi.requestJSON({ + url : kimchi.url + 'host/devices' + parameters, + type : 'GET', + contentType : 'application/json', + dataType : 'json', + success : suc, + error : err + }); + }, + getStorageServers: function(type, suc, err) { var url = kimchi.url + 'storageservers?_target_type=' + type; kimchi.requestJSON({
-- Thanks and best regards! Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com> IBM Linux Technology Center
participants (3)
-
Aline Manera
-
shaohef@linux.vnet.ibm.com
-
Sheldon