sometimes, if users do not want a ipv4/6 address, they set the network mode to 'dhcp' instead of 'static' (with no ip set), in believe this will result in no ip
in reality, often no ipv6 dhcp server exists in the environment, and the container start stalls for ~5min trying to get a ipv6 to improve ux, add the option 'none', which functionally is the same as having selected 'static' with no ip set, and simultaniously make the ip required Signed-off-by: Dominik Csapak <d.csa...@proxmox.com> --- changes from v1: * make 'static' default for new nics (e.g. in the wizard) * rename none4/6 to noIPv4/6Addr * remove unnecessary comments * use NoneText (this requires a new widget-toolkit with my other patch applied) www/manager6/lxc/Network.js | 63 ++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/www/manager6/lxc/Network.js b/www/manager6/lxc/Network.js index be40a8fa..bfa61180 100644 --- a/www/manager6/lxc/Network.js +++ b/www/manager6/lxc/Network.js @@ -36,10 +36,10 @@ Ext.define('PVE.lxc.NetworkInputPanel', { var newdata = {}; - if (values.ipv6mode !== 'static') { + if (values.ipv6mode !== 'static' && values.ipv6mode !== 'none') { values.ip6 = values.ipv6mode; } - if (values.ipv4mode !== 'static') { + if (values.ipv4mode !== 'static' && values.ipv4mode !== 'none') { values.ip = values.ipv4mode; } newdata[id] = PVE.Parser.printLxcNetwork(values); @@ -161,6 +161,7 @@ Ext.define('PVE.lxc.NetworkInputPanel', { cdata.ip = ''; cdata.gw = ''; } + var noIPv4Addr = (!cdata.ip && !cdata.gw && !dhcp4); var auto6 = (cdata.ip6 === 'auto'); var dhcp6 = (cdata.ip6 === 'dhcp'); @@ -168,26 +169,36 @@ Ext.define('PVE.lxc.NetworkInputPanel', { cdata.ip6 = ''; cdata.gw6 = ''; } - + + var noIPv6Addr = (!cdata.ip6 && !cdata.gw6 && !auto6 && !dhcp6); + me.column2 = [ + { + xtype: 'label', + text: 'IPv4:', + }, { layout: { type: 'hbox', align: 'middle' }, border: false, - margin: '0 0 5 0', + margin: '5 0 5 0', items: [ { - xtype: 'label', - text: 'IPv4:' // do not localize + xtype: 'radiofield', + boxLabel: Proxmox.Utils.NoneText, + name: 'ipv4mode', + inputValue: 'none', + checked: !me.isCreate && noIPv4Addr, + margin: '0 0 0 10', }, { xtype: 'radiofield', boxLabel: gettext('Static'), name: 'ipv4mode', inputValue: 'static', - checked: !dhcp4, + checked: me.isCreate || !(dhcp4 || noIPv4Addr), margin: '0 0 0 10', listeners: { change: function(cb, value) { @@ -198,7 +209,7 @@ Ext.define('PVE.lxc.NetworkInputPanel', { }, { xtype: 'radiofield', - boxLabel: 'DHCP', // do not localize + boxLabel: 'DHCP', name: 'ipv4mode', inputValue: 'dhcp', checked: dhcp4, @@ -211,22 +222,27 @@ Ext.define('PVE.lxc.NetworkInputPanel', { name: 'ip', vtype: 'IPCIDRAddress', value: cdata.ip, - disabled: dhcp4, - fieldLabel: 'IPv4/CIDR' // do not localize + allowBlank: false, + disabled: !me.isCreate && (dhcp4 || noIPv4Addr), + fieldLabel: 'IPv4/CIDR', }, { xtype: 'textfield', name: 'gw', value: cdata.gw, vtype: 'IPAddress', - disabled: dhcp4, + disabled: dhcp4 || noIPv4Addr, fieldLabel: gettext('Gateway') + ' (IPv4)', margin: '0 0 3 0' // override bottom margin to account for the menuseparator }, { xtype: 'menuseparator', height: '3', - margin: '0' + margin: '0 0 5 0', + }, + { + xtype: 'label', + text: 'IPv6:', }, { layout: { @@ -234,18 +250,22 @@ Ext.define('PVE.lxc.NetworkInputPanel', { align: 'middle' }, border: false, - margin: '0 0 5 0', + margin: '5 0 5 0', items: [ { - xtype: 'label', - text: 'IPv6:' // do not localize + xtype: 'radiofield', + boxLabel: Proxmox.Utils.NoneText, + name: 'ipv6mode', + inputValue: 'none', + checked: !me.isCreate && noIPv6Addr, + margin: '0 0 0 10', }, { xtype: 'radiofield', boxLabel: gettext('Static'), name: 'ipv6mode', inputValue: 'static', - checked: !(auto6 || dhcp6), + checked: me.isCreate || !(auto6 || dhcp6 || noIPv6Addr), margin: '0 0 0 10', listeners: { change: function(cb, value) { @@ -256,7 +276,7 @@ Ext.define('PVE.lxc.NetworkInputPanel', { }, { xtype: 'radiofield', - boxLabel: 'DHCP', // do not localize + boxLabel: 'DHCP', name: 'ipv6mode', inputValue: 'dhcp', checked: dhcp6, @@ -264,7 +284,7 @@ Ext.define('PVE.lxc.NetworkInputPanel', { }, { xtype: 'radiofield', - boxLabel: 'SLAAC', // do not localize + boxLabel: 'SLAAC', name: 'ipv6mode', inputValue: 'auto', checked: auto6, @@ -277,15 +297,16 @@ Ext.define('PVE.lxc.NetworkInputPanel', { name: 'ip6', value: cdata.ip6, vtype: 'IP6CIDRAddress', - disabled: (dhcp6 || auto6), - fieldLabel: 'IPv6/CIDR' // do not localize + allowBlank: false, + disabled: !me.isCreate && (dhcp6 || auto6 || noIPv6Addr), + fieldLabel: 'IPv6/CIDR', }, { xtype: 'textfield', name: 'gw6', vtype: 'IP6Address', value: cdata.gw6, - disabled: (dhcp6 || auto6), + disabled: (dhcp6 || auto6 || noIPv6Addr), fieldLabel: gettext('Gateway') + ' (IPv6)' } ]; -- 2.20.1 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel