Comment 6 for bug 1841582

Revision history for this message
Dan Watkins (oddbloke) wrote : Re: Interface detach and attach does not work with CentOS 7 and Ubuntu 18.04 cloud images

Hi sutefun,

Thanks for the details! So the issue here is that cloud-init only generates network configuration at first boot for OpenStack instances. So it's generating configuration that is tied to the MAC of your first network interface, which you then remove. As a result, the system ends up with no configured network interfaces on the next boot.

To work around this, I would suggest either modifying your network configuration before reboot (with netplan on Ubuntu, you should be able to relax the match clause in the cloud-init file in /etc/netplan/), or attaching the new network interface before reboot, so that you can configure it exactly.

From a longer term cloud-init POV, I see a couple of things we could do to improve this: (a) add a way for users to indicate that they would like network configuration regenerated every boot (or perhaps at just the next boot) which would override the data source setting, and/or (b) detect when the fallback configuration that was previously generated is no longer applicable (e.g. in this case, the MAC address it specifies is gone) and regenerate network configuration regardless of boot status in that situation.

Thanks,

Dan