Merge "Use netaddr when comparing local_ip for changes"
This commit is contained in:
commit
1bad146a22
|
@ -312,7 +312,10 @@ def _validate_no_ip_change():
|
||||||
# Nothing to check if br-ctlplane wasn't configured
|
# Nothing to check if br-ctlplane wasn't configured
|
||||||
return
|
return
|
||||||
existing_ip = ctlplane['addresses'][0]['ip_netmask']
|
existing_ip = ctlplane['addresses'][0]['ip_netmask']
|
||||||
if existing_ip != CONF.local_ip:
|
conf_netaddr = netaddr.IPNetwork(CONF.local_ip)
|
||||||
|
existing_netaddr = netaddr.IPNetwork(existing_ip)
|
||||||
|
if (conf_netaddr != existing_netaddr
|
||||||
|
or conf_netaddr.ip != existing_netaddr.ip):
|
||||||
message = _('Changing the local_ip is not allowed. Existing IP: '
|
message = _('Changing the local_ip is not allowed. Existing IP: '
|
||||||
'{0}, Configured IP: {1}').format(
|
'{0}, Configured IP: {1}').format(
|
||||||
existing_ip, CONF.local_ip)
|
existing_ip, CONF.local_ip)
|
||||||
|
|
Loading…
Reference in New Issue