
From: Daniel Henrique Barboza <dhbarboza82@gmail.com> Pinpoint UI changes to add a new network type named 'vepa' with the same capabilites as the bridge network. At this moment, the UI does not support multiple physical devices to be declared in the VEPA network. This will require additional UI changes in the future (no backend changes needed). Signed-off-by: Daniel Henrique Barboza <dhbarboza82@gmail.com> --- ui/js/src/kimchi.network.js | 9 +++++++-- ui/js/src/kimchi.network_add_main.js | 19 +++++++++++++------ ui/pages/network-add.html.tmpl | 5 +++-- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js index 923aeb9..a3aea52 100644 --- a/ui/js/src/kimchi.network.js +++ b/ui/js/src/kimchi.network.js @@ -1,7 +1,7 @@ /* * Project Kimchi * - * Copyright IBM, Corp. 2013-2015 + * Copyright IBM, Corp. 2013-2016 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ */ kimchi.NETWORK_TYPE_MACVTAP = "macvtap"; +kimchi.NETWORK_TYPE_VEPA = "vepa"; kimchi.initNetwork = function() { if(wok.tabMode['network'] === 'admin') { @@ -41,7 +42,11 @@ kimchi.initNetworkListView = function() { } else { network.type = data[i].connection; } - network.interface = data[i].interface ? data[i].interface : null; + if (network.type === kimchi.NETWORK_TYPE_VEPA) { + network.interface = data[i].vepa_devs[0] ? data[i].vepa_devs[0] : null; + } else { + network.interface = data[i].interface ? data[i].interface : null; + } network.addrSpace = data[i].subnet ? data[i].subnet : null; network.persistent = data[i].persistent; kimchi.addNetworkItem(network); diff --git a/ui/js/src/kimchi.network_add_main.js b/ui/js/src/kimchi.network_add_main.js index 0087407..f297e90 100644 --- a/ui/js/src/kimchi.network_add_main.js +++ b/ui/js/src/kimchi.network_add_main.js @@ -1,7 +1,7 @@ /* * Project Kimchi * - * Copyright IBM, Corp. 2013-2015 + * Copyright IBM, Corp. 2013-2016 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,9 +33,15 @@ kimchi.startNetworkCreation = function() { name : network.name, connection: network.type }; - if (network.type === kimchi.NETWORK_TYPE_MACVTAP) { - data.connection = "macvtap"; - data.interface = network.interface; + if (network.type === kimchi.NETWORK_TYPE_MACVTAP || + network.type === kimchi.NETWORK_TYPE_VEPA) { + if (network.type === kimchi.NETWORK_TYPE_MACVTAP) { + data.connection = "macvtap"; + data.interface = network.interface; + } else { + data.connection = "vepa"; + data.vepa_devs = [network.interface]; + } if ($("#enableVlan").prop("checked")) { data.vlan_id = network.vlan_id; if (!(data.vlan_id >=1 && data.vlan_id <= 4094)) { @@ -134,7 +140,8 @@ kimchi.getNetworkDialogValues = function() { name : $("#networkName").val(), type : $("#networkType").val() }; - if (network.type === kimchi.NETWORK_TYPE_MACVTAP) { + if (network.type === kimchi.NETWORK_TYPE_MACVTAP || + network.type === 'vepa') { network.interface = $("#networkDestinationID").val(); network.vlan_id = parseInt($("#networkVlanID").val()); } @@ -151,7 +158,7 @@ kimchi.setupNetworkFormEvent = function() { var selectedType = $(this).val(); if(selectedType == 'isolated' || selectedType == 'nat') { kimchi.enableBridgeOptions(false); - } else if (selectedType == 'macvtap') { + } else if (selectedType == 'macvtap' || selectedType == 'vepa') { kimchi.enableBridgeOptions(true); } }); diff --git a/ui/pages/network-add.html.tmpl b/ui/pages/network-add.html.tmpl index 7158b75..68fe4bd 100644 --- a/ui/pages/network-add.html.tmpl +++ b/ui/pages/network-add.html.tmpl @@ -1,7 +1,7 @@ #* * Project Kimchi * - * Copyright IBM, Corp. 2014-2015 + * Copyright IBM, Corp. 2014-2016 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,7 @@ <option value="isolated">$_("Isolated: no external network connection")</option> <option value="nat">$_("NAT: outbound physical network connection only")</option> <option value="macvtap">$_("Bridged: Virtual machines are connected to physical network directly")</option> + <option value="vepa">$_("VEPA: special mode where virtual machines are connected to a VEPA-enabled switch")</option> </select> </div> <div id="networkBriDisabledLabel" class="form-group hidden"> @@ -71,4 +72,4 @@ kimchi.network_add_main(); </script> </body> -</html> \ No newline at end of file +</html> -- 2.5.0