optional => 1,
type => 'string', format => 'pve-iface-list',
},
+ ovs_tag => {
+ description => "Specify a VLan tag (used by OVSPort, OVSIntPort, OVSBond)",
+ optional => 1,
+ type => 'integer',
+ minimum => 1,
+ maximum => 4094,
+ },
ovs_options => {
description => "OVS interface options.",
optional => 1,
type => {
description => "Only list specific interface types.",
type => 'string',
- enum => $network_type_enum,
+ enum => [ @$network_type_enum, 'any_bridge' ],
optional => 1,
},
},
if ($param->{type}) {
foreach my $k (keys %$config) {
- delete $config->{$k} if $param->{type} ne $config->{$k}->{type};
+ my $type = $config->{$k}->{type};
+ my $match = ($param->{type} eq $type) || (
+ ($param->{type} eq 'any_bridge') &&
+ ($type eq 'bridge' || $type eq 'OVSBridge'));
+ delete $config->{$k} if !$match;
}
}
data/DiffStore.js \
data/ObjectStore.js \
data/ResourceStore.js \
+ form/VLanField.js \
form/Checkbox.js \
form/TextField.js \
form/RRDTypeSelector.js \
extend: 'PVE.form.ComboGrid',
alias: ['widget.PVE.form.BridgeSelector'],
- bridgeType: 'bridge', // or OVSBridge
+ bridgeType: 'any_bridge', // bridge, OVSBridge or any_bridge
setNodename: function(nodename) {
var me = this;
--- /dev/null
+Ext.define('PVE.form.VlanField', {
+ extend: 'Ext.form.field.Number',
+ alias: ['widget.pveVlanField'],
+
+ deleteEmpty: false,
+
+ emptyText: 'no VLAN',
+
+ fieldLabel: gettext('VLAN Tag'),
+
+ allowBlank: true,
+
+ getSubmitData: function() {
+ var me = this,
+ data = null,
+ val;
+ if (!me.disabled && me.submitValue) {
+ val = me.getSubmitValue();
+ if (val) {
+ data = {};
+ data[me.getName()] = val;
+ } else if (me.deleteEmpty) {
+ data = {};
+ data['delete'] = me.getName();
+ }
+ }
+ return data;
+ },
+
+ initComponent: function() {
+ var me = this;
+
+ Ext.apply(me, {
+ minValue: 1,
+ maxValue: 4094
+ });
+
+ me.callParent();
+ }
+});
bridgeType: 'OVSBridge',
name: 'ovs_bridge'
});
+ column2.push({
+ xtype: 'pveVlanField',
+ deleteEmpty: !me.create,
+ name: 'ovs_tag',
+ value: ''
+ });
column2.push({
xtype: 'textfield',
fieldLabel: gettext('OVS options'),
bridgeType: 'OVSBridge',
name: 'ovs_bridge'
});
+ column2.push({
+ xtype: 'pveVlanField',
+ deleteEmpty: !me.create,
+ name: 'ovs_tag',
+ value: ''
+ });
column2.push({
xtype: 'textfield',
fieldLabel: gettext('OVS options'),
if (me.iftype === 'OVSBond') {
column1.push([
- {
- xtype: 'textfield',
- fieldLabel: gettext('Slaves'),
- name: 'ovs_bonds'
- },
{
xtype: 'bondModeSelector',
fieldLabel: gettext('Mode'),
openvswitch: true,
value: me.create ? 'active-backup' : undefined,
allowBlank: false
+ },
+ {
+ xtype: 'textfield',
+ fieldLabel: gettext('Slaves'),
+ name: 'ovs_bonds'
}
]);
} else {
},
me.bridgesel,
{
- xtype: 'numberfield',
+ xtype: 'pveVlanField',
name: 'tag',
- minValue: 1,
- maxValue: 4094,
value: '',
- emptyText: 'no VLAN',
- fieldLabel: gettext('VLAN Tag'),
- labelAlign: 'right',
- allowBlank: true
+ labelAlign: 'right'
},
{
xtype: 'radiofield',