Commit f2f1a82d authored by Alexandre Derumier's avatar Alexandre Derumier Committed by Dietmar Maurer

openvz: add bridge vlan && firewall options to gui

parse bridge= vmbrX(vY)?(f)?
Signed-off-by: 's avatarAlexandre Derumier <aderumier@odiso.com>
parent 1e341647
...@@ -159,7 +159,21 @@ Ext.define('PVE.Parser', { statics: { ...@@ -159,7 +159,21 @@ Ext.define('PVE.Parser', { statics: {
errors = true; errors = true;
return false; // break return false; // break
} }
if (match_res[1]==='bridge'){
var bridgevlanf = match_res[2];
var bridge_res = bridgevlanf.match(/^(vmbr(\d+))(v(\d+))?(f)?$/);
if (!bridge_res) {
errors = true;
return false; // break
}
data['bridge'] = bridge_res[1];
data['tag'] = bridge_res[4];
if(bridge_res[5]){
data['firewall'] = 1;
}
}else{
data[match_res[1]] = match_res[2]; data[match_res[1]] = match_res[2];
}
}); });
if (errors || !data.ifname) { if (errors || !data.ifname) {
...@@ -180,11 +194,21 @@ Ext.define('PVE.Parser', { statics: { ...@@ -180,11 +194,21 @@ Ext.define('PVE.Parser', { statics: {
Ext.Object.each(netif, function(iface, data) { Ext.Object.each(netif, function(iface, data) {
var tmparray = []; var tmparray = [];
Ext.Array.each(['ifname', 'mac', 'bridge', 'host_ifname' , 'host_mac', 'mac_filter'], function(key) { Ext.Array.each(['ifname', 'mac', 'bridge', 'host_ifname' , 'host_mac', 'mac_filter', 'tag', 'firewall'], function(key) {
var value = data[key]; var value = data[key];
if(key === 'bridge'){
if(data['tag']){
value = value + 'v' + data['tag'];
}
if(data['firewall']){
value = value + 'f';
}
}
if (value) { if (value) {
tmparray.push(key + '=' + value); tmparray.push(key + '=' + value);
} }
}); });
netarray.push(tmparray.join(',')); netarray.push(tmparray.join(','));
}); });
......
...@@ -82,6 +82,17 @@ Ext.define('PVE.OpenVZ.NetIfEdit', { ...@@ -82,6 +82,17 @@ Ext.define('PVE.OpenVZ.NetIfEdit', {
value: cdata.bridge, value: cdata.bridge,
allowBlank: false allowBlank: false
}, },
{
xtype: 'pveVlanField',
name: 'tag',
value: cdata.tag,
},
{
xtype: 'pvecheckbox',
fieldLabel: gettext('Firewall'),
name: 'firewall',
checked: cdata.firewall,
},
{ {
xtype: 'textfield', xtype: 'textfield',
name: 'host_ifname', name: 'host_ifname',
...@@ -430,7 +441,7 @@ Ext.define('PVE.openvz.NetworkView', { ...@@ -430,7 +441,7 @@ Ext.define('PVE.openvz.NetworkView', {
Ext.define('pve-openvz-network', { Ext.define('pve-openvz-network', {
extend: "Ext.data.Model", extend: "Ext.data.Model",
proxy: { type: 'memory' }, proxy: { type: 'memory' },
fields: [ 'id', 'type', 'value', 'ifname', 'mac', 'bridge', 'host_ifname', 'host_mac' ] fields: [ 'id', 'type', 'value', 'ifname', 'mac', 'bridge', 'host_ifname', 'host_mac', 'tag', 'firewall' ]
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment