Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter virbr0 when finding addresses for a machine #6850

Merged
merged 5 commits into from
Jan 24, 2017

Conversation

jameinel
Copy link
Member

Without filtering virbr0 we run into things where 'bootstrap' tries to use
the virbr0 address which exists both remotely and locally.
We were already filtering lxc and lxdbr0, this just includes virbr0
to be omitted as well.
This also cleans up the logging output by aggregating the addresses for all bridges in the beginning, and then filtering them all at once, instead of doing them one-by-one. Without this, each IP address that we kept would have 3 entries in the log file that we were keeping it.

Should help with bug #1644429.

To test this, you'll want to bootstrap and install libvirt-bin both locally and on the controller machine. At which point, juju should not think one of the remote machine's valid addresses is 192.168.122.1 (the default virbr0 address.) You can test this using lxd using the following cheats:
Something like these steps:

$ sudo apt install libvirt-bin
$ juju bootstrap lxd test-lxd
$ juju switch controller
$ juju ssh 0
$$ sudo apt install libvirt-bin
$$ sudo brctl addbr virbr0
$$ sudo ip addr add 192.168.122.1 dev virbr0
$$ service restart jujud-machine-0
$$ ^D
$ juju show-machine 0

This patch may not be fully sufficient to filter the virbr0 for 'lxd', because lxd itself reports 'virbr0' as one of the valid interfaces to contact the machine, and the above only filters our "machine addresses" not the addresses that the Provider reports. However, MAAS and AWS shouldn't report virbr0 as one of the known-to-the-provider addresses, which is what this patch helps with.
I did dump the database with and without this patch and saw that the new way does suppress virbr0 just like we suppress other bridge ip addresses.

This is a forward port of #6849 to 2.2.

Without filtering virbr0 we run into things where 'bootstrap' tries to use
the virbr0 address which exists both remotely and locally.
We were already filtering lxc and lxdbr0, this just includes virbr0
to be omitted as well.

Should help with bug #1644429
This was suggested in the initial work, now that we were doing 3 passes over
the address list, the noise about keeping vs filtering was annoying, so this
cleans up the noise quite a bit.
The list of addresses can also include hostnames (like 'localhost').
We don't want to filter those out, as they are still valid ways to
connect to the machine.
Don't hang the test suite under that circumstance. And in the happy path, it should
stop right away, so we can die quickly if it doesn't look like it will succeed.
@jameinel
Copy link
Member Author

The 2.1 version just landed in 2.1, and this is just a forward port of that code.
$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jan 24, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 243ea7a into juju:develop Jan 24, 2017
@jameinel jameinel deleted the 2.2-filter-virbr0-1644429 branch April 22, 2017 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants