]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
addons: address: ignoring iproute2 'rtnetlink file exists' errors
authorJulien Fortin <julien@cumulusnetworks.com>
Wed, 14 Sep 2016 00:03:24 +0000 (17:03 -0700)
committerJulien Fortin <julien@cumulusnetworks.com>
Wed, 14 Sep 2016 00:03:24 +0000 (17:03 -0700)
Ticket: CM-12798
Reviewed By: Roopa
Testing Done:

A customer discovered a corner case: the kernel is shrinking/reducing the ip
address fields containing 0s. For example if we configure and address such as
2a01:75e0:0000:09b0::1/64

Then if we query the kernel (using iproute2 or netlink) it will come back as:
2a01:75e0:0:09b0::1/64

Because of this issue we were seeing
root@r4u28:~# ifreload -a
error: bridge.200: cmd 'ip -force -batch - [addr add 10.50.103.193/26 dev bridge.200
addr add 2a01:75e0:0000:09b1::1/64 dev bridge.200
]' failed: returned 1 (RTNETLINK answers: File exists
Command failed -:1
)

Before adding an address to an iface we query it to know if the change is
necessary, since we only do a string comparaison between:
2a01:75e0:0000:09b1::1/64 and 2a01:75e0:0:09b1::1/64

it fails, ifupdown2 thinks that a change is needed. So we try to add the new
address via iproute2. iproute2 will fail because this address in a "shrinked"
format already exists.

This patch hot-fixes this problem by ignoring the error if it's an "exists"
error, we don't want to confuse the user.
A later fix will the real issue by normalizing all ip addr to the IPNetwork
format.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
addons/address.py

index 74d4301e667382ba7828011b22eb2a07e5093b5a..90117bac1e114d9694bf94dd55f465fb688ffb11 100644 (file)
@@ -335,8 +335,7 @@ class address(moduleBase):
         try:
             self.ipcmd.batch_commit()
         except Exception as e:
-            self.logger.error('%s: %s' % (ifaceobj.name, str(e)))
-            ifaceobj.set_status(ifaceStatus.ERROR)
+            self.log_error('%s: %s' % (ifaceobj.name, str(e)), ifaceobj, raise_error=False)
 
         hwaddress = self._get_hwaddress(ifaceobj)
         if hwaddress: