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

networking.bonds: add support for arbitrary driverOptions #22388

Merged
merged 2 commits into from Feb 16, 2017

Conversation

Profpatsch
Copy link
Member

Until now the four attributes available very selectively provided a small
subset, while copying upstream documentation.

We make driver options an arbitrary key-value set and point to kernel
documentation, which is always up-to-date. This way every option can be set.
The four already existing options are deprecated with a warning.

Motivation for this change
Things done
  • Tested using sandboxing
  • Built on platform(s)
    • NixOS
  • ran & corrected vm-test

@mention-bot
Copy link

@Profpatsch, thanks for your PR! By analyzing the history of the files in this pull request, we identified @wkennington, @edolstra and @aszlig to be potential reviewers.

description = ''
Options for the bonding driver.
Documentation can be found in
https://www.kernel.org/doc/Documentation/networking/bonding.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<link xlink:href="https://www.kernel.org/doc/Documentation/networking/bonding.txt" />

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix’d

Until now the four attributes available very selectively provided a small
subset, while copying upstream documentation.

We make driver options an arbitrary key-value set and point to kernel
documentation, which is always up-to-date. This way every option can be set.
The four already existing options are deprecated with a warning.
@aszlig
Copy link
Member

aszlig commented Feb 2, 2017

I'm not sure why you deprecate the explicit options instead of the generic driverOptions, because they can work happily side-by-side by just passing those options to driverOptions by default, which also has the advantage that for eg. miimon an integer can be passed instead of a string, so it's even more type-safe.

@@ -565,6 +582,7 @@ in
example = 100;
type = types.nullOr types.int;
description = ''
DEPRECATED, use `driverOptions`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of writing "DEPRECATED" in the description, I'd either pass down miimon/lacp_rate/mode/... to driverOptions in the definition or properly deprecate/remove it via rename.nix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, it’s not really renamed, it’s been deprecated and is still being merged right now (with a warning), but will be removed in 17.09 or something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true, at least not using the scripted networking. This breaks bonding for me. Where do you merge the deprecated settings?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we have a LACP bond that is configured with the deprecated options but after this change came up with balance-rr instead. Which broke its networking. 😞

This should either trigger an error or merging should work. As this breaks peoples' setups I'm inclined to revert this for now.

👍 on the change, though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, after trying to reproduce this: This problem only applies to networkd. Investigating.

@Profpatsch
Copy link
Member Author

why you deprecate the explicit options

Because they have to stay in sync with upstream options. And who watches that?
As for the extra type-safety, I’m not sure that’s a very big gain compared to the possible mismatch after one/two years or so.

${optionalString (v.miimon != null) "miimon ${toString v.miimon}"} \
${optionalString (v.xmit_hash_policy != null) "xmit_hash_policy ${toString v.xmit_hash_policy}"} \
${optionalString (v.lacp_rate != null) "lacp_rate ${toString v.lacp_rate}"}
${let opts = (mapAttrs (const toString)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird indentation... I'd join this into something like: ip link add name "${n}" type bond ${let ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is done by the function that creates the lines.

ip link add … \
  mode foo \
  other_option bar

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the indentation on the Nix side.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it’s like that because otherwise the first line will be indented by two spaces more (since it starts with two spaces already).

Since the bonds interface changed to a lot more possible values we create a
mapping of kernel bond attribute names and values to networkd attributes.
Those match for the most part, but have to transformed slightly.

There is also an assert that unknown options won’t slip through silently.
@Profpatsch Profpatsch merged commit bb797c1 into NixOS:master Feb 16, 2017
@globin
Copy link
Member

globin commented Feb 18, 2017

Please don't merge stuff like this yourself which can break (and broke) networking and can possibly lock people out of machines that are not on-site. This heavily frustrates people and shipping broken networking code even on unstable is highly unprofessional..

@Profpatsch
Copy link
Member Author

Profpatsch commented Feb 18, 2017

Point taken; the code itself is correct, the interaction of automatic translation to networkd options left out the deprecated options.
If the deprecated options are not used, it works in any case, as well as when networkd is not used.

I’m not sure how to pass the merged options through to the networkd implementation.

@Profpatsch
Copy link
Member Author

@qknight noticed me that the descriptions are off. I’ll fix.

@Profpatsch
Copy link
Member Author

Fixed in #23555

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants