Please ignore this patch, as it will be documented on what is not
officially supported on s390x machine and will keep all option in kimchi
as it is.
Thanks,
Archana Singh
On 09/30/2016 11:56 AM, archus(a)linux.vnet.ibm.com wrote:
From: Archana Singh <archus(a)linux.vnet.ibm.com>
1) On s390x, libvirt network of type bridge, nat, isolated and macvtap are supported as
of now.
So created API call method kimchi.listNetworks390x to only get these types of libvirt
network from API.
2) On s390x, in guest edit only libvirt network of type bridge, nat, isolated and
macvtap has to be listed.
So refactor guest edit JS for the list network such that for s390x it calls
kimchi.listNetworks390x instead of kimchi.listNetworks.
And for non-s390x, kimchi.listNetworks gets called.
Refactor of code help in clear seperation of s390x and nons390x JS for getting network
list.
3) For s390x in kimchi.network.js refactor code to call API method
kimchi.listNetworks390x instead of kimchi.listNetworks
4) For s390x , in template edit network listing only libvirt network of type bridge,
nat, isolated and macvtap has to be listed..
For s390x called API method kimchi.listNetworks390x instead of kimchi.listNetworks.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.api.js | 15 ++++++++
ui/js/src/kimchi.guest_edit_main.js | 69 ++++++++++++++++++----------------
ui/js/src/kimchi.network.js | 9 ++++-
ui/js/src/kimchi.template_edit_main.js | 2 +-
4 files changed, 60 insertions(+), 35 deletions(-)
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 950ca00..ac19e7e 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -596,6 +596,20 @@ var kimchi = {
});
},
+ listNetworks390x : function(suc, err) {
+ wok.requestJSON({
+ url :
'plugins/kimchi/networks?connection=bridge|nat|isolated|macvtap',
+ type : 'GET',
+ contentType : 'application/json',
+ dataType : 'json',
+ resend : true,
+ success : suc,
+ error : err ? err : function(data) {
+ wok.message.error(data.responseJSON.reason);
+ }
+ });
+ },
+
listmacvtapNetworks: function(suc, err) {
wok.requestJSON({
url: 'plugins/kimchi/interfaces?type=^nic|bonding|vlan$',
@@ -1311,6 +1325,7 @@ var kimchi = {
resend: true,
contentType: 'application/json',
dataType: 'json',
+ async : false,
success: suc,
error: err
});
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 9669d08..5bceeb0 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -421,49 +421,54 @@ kimchi.guest_edit_main = function() {
};
-
- kimchi.listNetworks(function(data) {
+ var listNetworks = function(data) {
for (var i = 0; i < data.length; i++) {
var isSlected = i === 0 ? " selected" : "";
networkOptions += "<option" + isSlected + ">"
+ data[i].name + "</option>";
}
+ kimchi.getGuestInterfaces(kimchi.selectedGuest, function(data) {
+ for (var i = 0; i < data.length; i++) {
+ data[i].viewMode = "";
+ data[i].editMode = "hide";
+ data[i].id = i;
+ if (data[i].type == 'network')
+ addItem(data[i]);
+ }
+ });
+ }
- if (kimchi.hostarch === s390xArch) {
-
- kimchi.listmacvtapNetworks(function(data) {
+ var listNetworks390x = function(data) {
+ for (var i = 0; i < data.length; i++) {
+ var isSlected = i === 0 ? " selected" : "";
+ networkOptions += "<option" + isSlected + ">"
+ data[i].name + "</option>";
+ }
+ kimchi.listmacvtapNetworks(function(data) {
+ for (var i = 0; i < data.length; i++) {
+ var isSlected = i === 0 ? ' selected="selected"' :
"";
+ macvtapNetworks += "<option" + isSlected +
">" + data[i].name + "</option>";
+ }
+ kimchi.listovsNetworks(function(data) {
for (var i = 0; i < data.length; i++) {
- var isSlected = i === 0 ? '
selected="selected"' : "";
- macvtapNetworks += "<option" + isSlected +
">" + data[i].name + "</option>";
+ var isSlected = i === 0 ? " selected" : "";
+ ovsNetworks += "<option" + isSlected +
">" + data[i] + "</option>";
}
-
- kimchi.listovsNetworks(function(data) {
+ kimchi.getGuestInterfaces(kimchi.selectedGuest, function(data) {
for (var i = 0; i < data.length; i++) {
- var isSlected = i === 0 ? " selected" :
"";
- ovsNetworks += "<option" + isSlected +
">" + data[i] + "</option>";
+ data[i].viewMode = "";
+ data[i].editMode = "hide";
+ data[i].id = i;
+ addItem(data[i]);
}
-
- kimchi.getGuestInterfaces(kimchi.selectedGuest, function(data)
{
- for (var i = 0; i < data.length; i++) {
- data[i].viewMode = "";
- data[i].editMode = "hide";
- data[i].id = i;
- addItem(data[i]);
- }
- });
});
});
- } else {
- kimchi.getGuestInterfaces(kimchi.selectedGuest, function(data) {
- for (var i = 0; i < data.length; i++) {
- data[i].viewMode = "";
- data[i].editMode = "hide";
- data[i].id = i;
- if (data[i].type == 'network')
- addItem(data[i]);
- }
- });
- }
- });
+ });
+ }
+
+ if(kimchi.hostarch == kimchi.s390xArch){
+ kimchi.listNetworks390x(listNetworks390x)
+ } else {
+ kimchi.listNetworks(listNetworks)
+ }
if (kimchi.hostarch === s390xArch) {
$('#form-guest-edit-interface > div.header').hide();
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index 7ce5b28..d7d4424 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -34,7 +34,7 @@ kimchi.initNetwork = function() {
kimchi.initNetworkListView = function() {
$('.wok-mask').removeClass('hidden');
- kimchi.listNetworks(function(data) {
+ var listNetworks = function(data) {
$('[data-toggle="tooltip"]').tooltip();
for (var i = 0; i < data.length; i++) {
var network = {
@@ -59,7 +59,12 @@ kimchi.initNetworkListView = function() {
$('input', $('.grid-control',
'#network-content-container')).on('keyup', function(){
$('#networkGrid').dataGrid('filter', $(this).val());
});
- });
+ };
+ if(kimchi.hostarch == kimchi.s390xArch){
+ kimchi.listNetworks390x(listNetworks)
+ } else {
+ kimchi.listNetworks(listNetworks)
+ }
};
kimchi.addNetworkItem = function(network) {
diff --git a/ui/js/src/kimchi.template_edit_main.js
b/ui/js/src/kimchi.template_edit_main.js
index b1f5123..42d1408 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -693,7 +693,7 @@ kimchi.template_edit_main = function() {
origmacvtapNetworks = macvtapnet;
kimchi.listovsNetworks(function(ovsnet) {
origovsNetworks = ovsnet;
- kimchi.listNetworks(initInterface_s390x);
+ kimchi.listNetworks390x(initInterface_s390x);
});
});
kimchi.listStoragePools(initStorage_s390);