[V1 0/2] Fibre Channel SCSI Storage Pool UI

From: Yu Xin Huo <huoyuxin@linux.vnet.ibm.com> Yu Xin Huo (2): Fibre Channel SCSI Storage Pool UI Add translation for FC SCSI Storage Pool po/en_US.po | 6 +++++ po/kimchi.pot | 6 +++++ po/pt_BR.po | 6 +++++ po/zh_CN.po | 6 +++++ 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 +++++++++++ 8 files changed, 80 insertions(+), 2 deletions(-)

From: Yu Xin Huo <huoyuxin@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@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")", '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> -- 1.7.1

On 02/14/2014 10:00 AM, huoyuxin@linux.vnet.ibm.com wrote:
From: Yu Xin Huo <huoyuxin@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@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>

Am 14-02-2014 10:00, schrieb huoyuxin@linux.vnet.ibm.com:
+ 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); + }); Please add an error handler to the function "getHostPCIDevices".

On 2/14/2014 10:04 PM, Crístian Viana wrote:
Am 14-02-2014 10:00, schrieb huoyuxin@linux.vnet.ibm.com:
+ 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); + }); Please add an error handler to the function "getHostPCIDevices". Check kimchi.getHostPCIDevices in kimchi.api.js, there is a default error handler defined to get rid of code duplication. Only when new special error handler is needed, then pass in a error handler to overwrite the default.

From: Yu Xin Huo <huoyuxin@linux.vnet.ibm.com> Signed-off-by: Yu Xin Huo <huoyuxin@linux.vnet.ibm.com> --- po/en_US.po | 6 ++++++ po/kimchi.pot | 6 ++++++ po/pt_BR.po | 6 ++++++ po/zh_CN.po | 6 ++++++ 4 files changed, 24 insertions(+), 0 deletions(-) diff --git a/po/en_US.po b/po/en_US.po index 5a5327a..0fda00f 100644 --- a/po/en_US.po +++ b/po/en_US.po @@ -375,6 +375,12 @@ msgstr "" msgid "iSCSI Server" msgstr "iSCSI Server" +msgid "SCSI Fibre Channel" +msgstr "SCSI Fibre Channel" + +msgid "SCSI Adapter" +msgstr "SCSI Adapter" + msgid "iSCSI server IP or hostname. It should not be empty." msgstr "iSCSI server IP or hostname. It should not be empty." diff --git a/po/kimchi.pot b/po/kimchi.pot index a4b3935..a8571cf 100755 --- a/po/kimchi.pot +++ b/po/kimchi.pot @@ -360,6 +360,12 @@ msgstr "" msgid "iSCSI Server" msgstr "" +msgid "SCSI Fibre Channel" +msgstr "" + +msgid "SCSI Adapter" +msgstr "" + msgid "iSCSI server IP or hostname. It should not be empty." msgstr "" diff --git a/po/pt_BR.po b/po/pt_BR.po index adf291a..878fc13 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -390,6 +390,12 @@ msgstr "" msgid "iSCSI Server" msgstr "" +msgid "SCSI Fibre Channel" +msgstr "" + +msgid "SCSI Adapter" +msgstr "" + msgid "iSCSI server IP or hostname. It should not be empty." msgstr "" diff --git a/po/zh_CN.po b/po/zh_CN.po index 88ef9ed..552434f 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -378,6 +378,12 @@ msgstr "" msgid "iSCSI Server" msgstr "iSCSI服务器" +msgid "SCSI Fibre Channel" +msgstr "SCSI 光纤通道" + +msgid "SCSI Adapter" +msgstr "SCSI 适配器" + msgid "iSCSI server IP or hostname. It should not be empty." msgstr "iSCSI服务器IP或者主机名, 不能为空。" -- 1.7.1

You need to increase the combo box width to have all text in one line I forgot to mention yesterday, we also need a UI when creating a VM using the FC pool. My idea is while creating a VM: 1) User select the template 2) Check if the template has a FC pool 2.1) FC pool: list the storage volumes in the storage pool 2.2) User must select just one to create the VM POST /vms {"template": "my-fc-tmpl", "volumes": [storage-vol-select]} On 02/14/2014 10:00 AM, huoyuxin@linux.vnet.ibm.com wrote:
From: Yu Xin Huo <huoyuxin@linux.vnet.ibm.com>
Yu Xin Huo (2): Fibre Channel SCSI Storage Pool UI Add translation for FC SCSI Storage Pool
po/en_US.po | 6 +++++ po/kimchi.pot | 6 +++++ po/pt_BR.po | 6 +++++ po/zh_CN.po | 6 +++++ 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 +++++++++++ 8 files changed, 80 insertions(+), 2 deletions(-)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
ÿØÿà

On 2/14/2014 8:19 PM, Aline Manera wrote:
You need to increase the combo box width to have all text in one line
Addressed in V2.
I forgot to mention yesterday, we also need a UI when creating a VM using the FC pool. My idea is while creating a VM:
1) User select the template 2) Check if the template has a FC pool 2.1) FC pool: list the storage volumes in the storage pool 2.2) User must select just one to create the VM
POST /vms {"template": "my-fc-tmpl", "volumes": [storage-vol-select]}
A new lineitem which should be design from VM creation perspective, if you would like to get it included in release 1.2, add it to wiki todo list.
On 02/14/2014 10:00 AM, huoyuxin@linux.vnet.ibm.com wrote:
From: Yu Xin Huo<huoyuxin@linux.vnet.ibm.com>
Yu Xin Huo (2): Fibre Channel SCSI Storage Pool UI Add translation for FC SCSI Storage Pool
po/en_US.po | 6 +++++ po/kimchi.pot | 6 +++++ po/pt_BR.po | 6 +++++ po/zh_CN.po | 6 +++++ 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 +++++++++++ 8 files changed, 80 insertions(+), 2 deletions(-)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

On 02/17/2014 05:27 AM, Yu Xin Huo wrote:
On 2/14/2014 8:19 PM, Aline Manera wrote:
You need to increase the combo box width to have all text in one line
Addressed in V2.
I forgot to mention yesterday, we also need a UI when creating a VM using the FC pool. My idea is while creating a VM:
1) User select the template 2) Check if the template has a FC pool 2.1) FC pool: list the storage volumes in the storage pool 2.2) User must select just one to create the VM
POST /vms {"template": "my-fc-tmpl", "volumes": [storage-vol-select]}
A new lineitem which should be design from VM creation perspective, if you would like to get it included in release 1.2, add it to wiki todo list.
It is part of "FC storage pool UI" line item. There is no any to allow user create a FC pool if the VM creating will fail if the UI does not support it correctly. But if you really want a new line item I can include it but it must be done for 1.2
On 02/14/2014 10:00 AM, huoyuxin@linux.vnet.ibm.com wrote:
From: Yu Xin Huo<huoyuxin@linux.vnet.ibm.com>
Yu Xin Huo (2): Fibre Channel SCSI Storage Pool UI Add translation for FC SCSI Storage Pool
po/en_US.po | 6 +++++ po/kimchi.pot | 6 +++++ po/pt_BR.po | 6 +++++ po/zh_CN.po | 6 +++++ 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 +++++++++++ 8 files changed, 80 insertions(+), 2 deletions(-)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

Hi Yu Xin Huo, according to the errors found I can conclude you used part of the code I had submitted some days ago. Thanks for take this and fix the problems. See more comments below. On 02/14/2014 10:19 AM, Aline Manera wrote:
You need to increase the combo box width to have all text in one line
I forgot to mention yesterday, we also need a UI when creating a VM using the FC pool. My idea is while creating a VM:
1) User select the template 2) Check if the template has a FC pool 2.1) FC pool: list the storage volumes in the storage pool 2.2) User must select just one to create the VM
POST /vms {"template": "my-fc-tmpl", "volumes": [storage-vol-select]}
Aline forgot to mention that there is already another patch that implements this UI. Yu Xin Huo, I am attaching it, so feel free to use it and improve it too, ok ? Oh, and, you don't need to add my sign-off, you can remove it. Thanks Rodrigo Trujillo
On 02/14/2014 10:00 AM, huoyuxin@linux.vnet.ibm.com wrote:
From: Yu Xin Huo<huoyuxin@linux.vnet.ibm.com>
Yu Xin Huo (2): Fibre Channel SCSI Storage Pool UI Add translation for FC SCSI Storage Pool
po/en_US.po | 6 +++++ po/kimchi.pot | 6 +++++ po/pt_BR.po | 6 +++++ po/zh_CN.po | 6 +++++ 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 +++++++++++ 8 files changed, 80 insertions(+), 2 deletions(-)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
participants (5)
-
Aline Manera
-
Crístian Viana
-
huoyuxin@linux.vnet.ibm.com
-
Rodrigo Trujillo
-
Yu Xin Huo