[Kimchi-devel] [PATCH v3] [Kimchi 3/3] Passthrough macvtap network support: UI changes

dhbarboza82 at gmail.com dhbarboza82 at gmail.com
Thu May 19 15:31:08 UTC 2016


From: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>

UI changes to support the new network type 'passthrough'.

Signed-off-by: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.network.js          |  1 +
 ui/js/src/kimchi.network_add_main.js | 23 +++++++++++++++--------
 ui/pages/network-add.html.tmpl       |  1 +
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index d362010..c0100cf 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -17,6 +17,7 @@
  */
 
 kimchi.NETWORK_TYPE_MACVTAP = "macvtap";
+kimchi.NETWORK_TYPE_PASSTHROUGH = "passthrough";
 kimchi.NETWORK_TYPE_BRIDGED = "bridge";
 kimchi.NETWORK_TYPE_VEPA = "vepa";
 
diff --git a/ui/js/src/kimchi.network_add_main.js b/ui/js/src/kimchi.network_add_main.js
index e12f1df..3090aeb 100644
--- a/ui/js/src/kimchi.network_add_main.js
+++ b/ui/js/src/kimchi.network_add_main.js
@@ -35,8 +35,10 @@ kimchi.startNetworkCreation = function() {
         interfaces: [ network.interface ],
         vlan_id: network.vlan_id
     };
-    // in VEPA connection case, network.interface is already an array
-    if (data.connection === kimchi.NETWORK_TYPE_VEPA) {
+    // in PASSTHROUGH and VEPA connection case,
+    // network.interface is already an array
+    if (data.connection === kimchi.NETWORK_TYPE_PASSTHROUGH ||
+        data.connection === kimchi.NETWORK_TYPE_VEPA ) {
         data.interfaces = network.interface;
     }
 
@@ -86,7 +88,9 @@ kimchi.getNetworkDialogValues = function() {
         name : $("#networkName").val(),
         type : $("#networkType").val()
     };
-    if (network.type === kimchi.NETWORK_TYPE_MACVTAP ||  network.type === kimchi.NETWORK_TYPE_VEPA) {
+    if (network.type === kimchi.NETWORK_TYPE_MACVTAP ||
+        network.type === kimchi.NETWORK_TYPE_PASSTHROUGH ||
+        network.type === kimchi.NETWORK_TYPE_VEPA) {
         network.interface = $("#networkDestinationID").val();
     }
     if (network.type === kimchi.NETWORK_TYPE_BRIDGED) {
@@ -110,16 +114,19 @@ kimchi.setupNetworkFormEvent = function() {
 
     $('#networkType').on('change', function() {
         var selectedType = $("#networkType").val();
-        if(selectedType === kimchi.NETWORK_TYPE_MACVTAP || selectedType === kimchi.NETWORK_TYPE_VEPA) {
-            if (selectedType === kimchi.NETWORK_TYPE_VEPA){
+        if(selectedType === kimchi.NETWORK_TYPE_MACVTAP ||
+           selectedType === kimchi.NETWORK_TYPE_PASSTHROUGH ||
+           selectedType === kimchi.NETWORK_TYPE_VEPA) {
+
+            if (selectedType === kimchi.NETWORK_TYPE_MACVTAP) {
+                $('#networkDestinationID').attr('multiple', false).data('liveSearch',false);
+            }
+            else {
                 $('#networkDestinationID').attr('multiple', true);
                 if($('#networkDestinationID option').length > 10 ) {
                     $('#networkDestinationID').data('liveSearch',true);
                 }
             }
-            else {
-                $('#networkDestinationID').attr('multiple', false).data('liveSearch',false);
-            }
             $('#networkDestinationID').selectpicker('destroy');
             kimchi.loadInterfaces(new Array("nic", "bonding"));
         } else {
diff --git a/ui/pages/network-add.html.tmpl b/ui/pages/network-add.html.tmpl
index 7a2fadb..fbbea3d 100644
--- a/ui/pages/network-add.html.tmpl
+++ b/ui/pages/network-add.html.tmpl
@@ -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">$_("Macvtap: Virtual machines are connected to physical network directly")</option>
+                <option value="passthrough">$_("Passthrough: Virtual machines are connected using a macvtap connection in passthrough mode.")</option>
                 <option value="vepa">$_("VEPA: special mode where virtual machines are connected to a VEPA-enabled switch")</option>
                 <option value="bridge">$_("Bridged: Virtual machines are connected through a network bridge")</option>
             </select>
-- 
2.5.5




More information about the Kimchi-devel mailing list