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 #6849

Merged
merged 5 commits into from
Jan 24, 2017

Conversation

jameinel
Copy link
Member

@jameinel jameinel commented Jan 22, 2017

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.

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.
@jameinel
Copy link
Member Author

See also #6850

@jameinel
Copy link
Member Author

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jan 23, 2017

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

@jujubot
Copy link
Collaborator

jujubot commented Jan 23, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10081

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.
@jameinel
Copy link
Member Author

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jan 23, 2017

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

@jujubot
Copy link
Collaborator

jujubot commented Jan 23, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10083

@jameinel
Copy link
Member Author

!!build!!

@jameinel
Copy link
Member Author

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jan 23, 2017

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

@jujubot
Copy link
Collaborator

jujubot commented Jan 23, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/10085

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

$$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 4acbb2a into juju:2.1 Jan 24, 2017
jujubot added a commit that referenced this pull request Jan 24, 2017
Filter virbr0 when finding addresses for a machine

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.
@jameinel jameinel deleted the 2.1-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
3 participants