iface setup on centos does not remove previously set IPs

Bug #1275098 reported by Ahmed Rahal
This bug affects 3 people
Affects Status Importance Assigned to Milestone

Bug Description

This happens on centos release 6.5 (probably previous versions as well).
VM runs in an openstack Havana kvm compute node.
cloud-init 0.7.2

At boot, the system init scripts set IP addresses from configuration files (we do not use dhcp).
Later on in the boot process, cloudinit gets called.
At that point, cloud-init fetches IP configuration (in our case, from configdrive) and tries to ifup the interfaces.
On first launch, there were no IP addresses in the local config files, cloudinit runs ifup and all is fine.
On subsequent launches, configuration files already provided relevant IP information and IPs are already set, so when cloudinit fires up, we get this on the console:

__init__.py[WARNING]: Running ['ifup', 'eth0'] resulted in stderr output: RTNETLINK answers: File exists

This is not critical as the correct IP is already set. It is just an annoying warning.

However, we run on a remote storage backend and do clone the volumes.
In that case, once we boot off the cloned volume, the old IPs are still in the configration files, and get temporarily assigned to interfaces. As soon as cloudinit kicks in, new IPs are fetched from the configdrive and interfaces are ifup-ed.
The new IPs get assigned to the interfaces, but, the old IPs are still there. So until the next reboot, the old IPs stick to the interfaces potentially creating havoc in that new VM.

To avoid any side-effect, we added a _bring_down_interface() method that we call off a rhel specific overload of _bring_up_interface().
We fixed this in:

This bug serves the purpose of documenting the case and hopefully merging the fix

Related branches

Revision history for this message
Ahmed Rahal (arahal) wrote :
Revision history for this message
Ahmed Rahal (arahal) wrote :
Ahmed Rahal (arahal)
description: updated
Ahmed Rahal (arahal)
description: updated
Revision history for this message
Joshua Harlow (harlowja) wrote :

Can u make a bzr branch with these patches so that can be merged?

Revision history for this message
Ahmed Rahal (arahal) wrote :

I'll try to install bzr.
Also, I have the same kind of issue with ubuntu 12.04/13.10.
I'm looking into that as well.

Revision history for this message
Ahmed Rahal (arahal) wrote :

After checking, the specific problem with CentOS is a more general problem.
I proceeded with creating a more general patch to this issue.
The _bring_up_interface() method being called in multiple ways, I had to put the call to _bring_down_interface() inside of the former.
Not the best way of doing it but this solves the problem broadly with minimum changes to existing implementation.

I patched this branch: lp:~arahal/cloud-init/ifdown_before_ifup

(I'm unsure whether this is the right way to do it in lp/bzr, but well ...)

Revision history for this message
Anthony Woods (awoods-0) wrote :

This appears to be a duplicate of bug 1225922

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.