[pve-devel] [PATCH] Commits for feature request documented here, http://pve.proxmox.com/pipermail/pve-devel/2014-September/012730.html This introduces functionality to use a single multi-tagged interface within a guest (ie. for routers/firewalls)

Ben Lessani ben at sonassi.com
Mon Sep 15 19:49:08 CEST 2014


Signed-off-by: Ben Lessani <ben at sonassi.com>
---
 www/manager/Parser.js           |    8 +++++++-
 www/manager/openvz/Network.js   |    7 ++++++-
 www/manager/qemu/NetworkEdit.js |    9 +++++++++
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/www/manager/Parser.js b/www/manager/Parser.js
index 11fbe49..407adf7 100644
--- a/www/manager/Parser.js
+++ b/www/manager/Parser.js
@@ -33,6 +33,8 @@ Ext.define('PVE.Parser', { statics: {
                 res.tag = match_res[1];
 	    } else if ((match_res = p.match(/^firewall=(\d+)$/)) !== null) {
                 res.firewall = match_res[1];
+        } else if ((match_res = p.match(/^trunks=([0-9;]+)$/)) !== null) {
+          res.trunks = match_res[1];          
 	    } else {
 		errors = true;
 		return false; // break
@@ -60,6 +62,9 @@ Ext.define('PVE.Parser', { statics: {
 	    if (net.firewall) {
 		netstr += ",firewall=" + net.firewall;
 	    }
+        if (net.trunks) {
+        netstr += ",trunks=" + net.trunks;
+        }        
 	}
 	if (net.rate) {
 	    netstr += ",rate=" + net.rate;
@@ -169,6 +174,7 @@ Ext.define('PVE.Parser', { statics: {
 		    data['bridge'] = bridge_res[1];
 		    data['tag'] = bridge_res[4];
 		    data['firewall'] = bridge_res[5] ? 1 : 0;
+            data['trunks'] = bridge_res[6];
 		} else {
 		    data[match_res[1]] = match_res[2];
 		}
@@ -192,7 +198,7 @@ Ext.define('PVE.Parser', { statics: {
 
 	Ext.Object.each(netif, function(iface, data) {
 	    var tmparray = [];
-	    Ext.Array.each(['ifname', 'mac', 'bridge', 'host_ifname' , 'host_mac', 'mac_filter', 'tag', 'firewall'], function(key) {
+        Ext.Array.each(['ifname', 'mac', 'bridge', 'host_ifname' , 'host_mac', 'mac_filter', 'tag', 'firewall', 'trunks'], function(key) {
 		var value = data[key];
 		if (key === 'bridge'){
 		    if(data['tag']){
diff --git a/www/manager/openvz/Network.js b/www/manager/openvz/Network.js
index 13986db..a1bf675 100644
--- a/www/manager/openvz/Network.js
+++ b/www/manager/openvz/Network.js
@@ -88,6 +88,11 @@ Ext.define('PVE.OpenVZ.NetIfEdit', {
 		    value: cdata.tag,
 		},
 		{
+            xtype: 'pveVlansField', 
+            name: 'trunks', 
+            value: cdata.trunks,
+        },    
+        {
 		    xtype: 'pvecheckbox',
 		    fieldLabel: gettext('Firewall'),
 		    name: 'firewall',
@@ -441,7 +446,7 @@ Ext.define('PVE.openvz.NetworkView', {
     Ext.define('pve-openvz-network', {
 	extend: "Ext.data.Model",
 	proxy: { type: 'memory' },
-	fields: [ 'id', 'type', 'value', 'ifname', 'mac', 'bridge', 'host_ifname', 'host_mac', 'tag', 'firewall' ]
+    fields: [ 'id', 'type', 'value', 'ifname', 'mac', 'bridge', 'host_ifname', 'host_mac', 'tag', 'firewall', 'trunks' ]
     });
 
 });
diff --git a/www/manager/qemu/NetworkEdit.js b/www/manager/qemu/NetworkEdit.js
index 1e5b97b..21d131e 100644
--- a/www/manager/qemu/NetworkEdit.js
+++ b/www/manager/qemu/NetworkEdit.js
@@ -14,6 +14,7 @@ Ext.define('PVE.qemu.NetworkInputPanel', {
 	    me.network.bridge = values.bridge;
 	    me.network.tag = values.tag;
 	    me.network.firewall = values.firewall;
+        me.network.trunks = values.trunks;
 	} else {
 	    me.network.bridge = undefined;
 	}
@@ -86,6 +87,7 @@ Ext.define('PVE.qemu.NetworkInputPanel', {
 			me.down('field[name=bridge]').validate();
 			me.down('field[name=tag]').setDisabled(!value);
 			me.down('field[name=firewall]').setDisabled(!value);
+            me.down('field[name=trunks]').setDisabled(!value);
 		    }
 		}
 	    },
@@ -98,6 +100,13 @@ Ext.define('PVE.qemu.NetworkInputPanel', {
 	    },
 	    me.bridgesel,
 	    {
+        xtype: 'pveVlansField', 
+        name: 'trunks', 
+        value: '', 
+        labelAlign: 'right' 
+        }, 
+        me.bridgesel, 
+        {             
 		xtype: 'pvecheckbox',
 		fieldLabel: gettext('Firewall'),
 		name: 'firewall',
-- 
1.7.10.4




More information about the pve-devel mailing list