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: {
errors = true;
return false; // break
}
data[match_res[1]] = match_res[2];
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];
}
});
if (errors || !data.ifname) {
......@@ -180,11 +194,21 @@ 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'], function(key) {
Ext.Array.each(['ifname', 'mac', 'bridge', 'host_ifname' , 'host_mac', 'mac_filter', 'tag', 'firewall'], function(key) {
var value = data[key];
if(key === 'bridge'){
if(data['tag']){
value = value + 'v' + data['tag'];
}
if(data['firewall']){
value = value + 'f';
}
}
if (value) {
tmparray.push(key + '=' + value);
}
});
netarray.push(tmparray.join(','));
});
......
......@@ -82,6 +82,17 @@ Ext.define('PVE.OpenVZ.NetIfEdit', {
value: cdata.bridge,
allowBlank: false
},
{
xtype: 'pveVlanField',
name: 'tag',
value: cdata.tag,
},
{
xtype: 'pvecheckbox',
fieldLabel: gettext('Firewall'),
name: 'firewall',
checked: cdata.firewall,
},
{
xtype: 'textfield',
name: 'host_ifname',
......@@ -430,7 +441,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' ]
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