-
Notifications
You must be signed in to change notification settings - Fork 908
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
net: exclude OVS internal interfaces in get_interfaces #829
Conversation
user_data=SETUP_USER_DATA, | ||
) as instance: | ||
instance.instance.clean() | ||
session_cloud.snapshot_id = instance.snapshot() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this again, I wonder if this is going to mean that this OVS-enabled image is used for all future launches: I'll check now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is; working on this now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks well done. Some in-line questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think main implementation and unit tests look good. I'll revisit when the WIP tag is removed since you're still working on the integration test.
Not necessary for this PR but...
Given the fairly random places I'm seeing
@mock.patch(
"cloudinit.net.is_openvswitch_internal_interface",
mock.Mock(return_value=False),
)
I'm wondering if it might make sense to create a top-level autorun fixture that provides default mocks for things that we obviously don't want running in unit tests. In this case we would default is_openvswitch_internal_interface
to False
, and then actual openvswitch tests could change it to True
when needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm speaking only for the Open vSwitch specific bits in this patch set, and as we have discussed on the LP this is a good approach and LGTM.
`get_interfaces` is used to in two ways, broadly: firstly, to determine the available interfaces when converting cloud network configuration formats to cloud-init's network configuration formats; and, secondly, to ensure that any interfaces which are specified in network configuration are (a) available, and (b) named correctly. The first of these is unaffected by this commit, as no clouds support Open vSwitch configuration in their network configuration formats. For the second, we check that MAC addresses of physical devices are unique. In some OVS configurations, there are OVS-created devices which have duplicate MAC addresses, either with each other or with physical devices. As these interfaces are created by OVS, we can be confident that (a) they will be available when appropriate, and (b) that OVS will name them correctly. As such, this commit excludes any OVS-internal interfaces from the set of interfaces returned by `get_interfaces`. LP: #1912844
Proposed Commit Message
Test Steps
Use included integration test.
Checklist: