Repository navigation
Do not create a link local for tfpkt links - #2903
Merged
Merged
Conversation
Change `links_needed` to return whether or not a link needs a link local address in the zone. This was required for non-gimlet testing but broke gimlets - see: oxidecomputer/stlouis#391. This also changes `links_needed` to check all service requests for required links, not just stopping at the first one found.
jgallagher
reviewed
Apr 21, 2023
jgallagher
left a comment
Contributor
There was a problem hiding this comment.
Changes look good to me. Building a ramdisk with this change now to test on madrid; will update here once that's done.
| ) -> Result<Vec<Link>, Error> { | ||
| ) -> Result<Vec<(Link, bool)>, Error> { | ||
| let mut links: Vec<(Link, bool)> = | ||
| Vec::with_capacity(req.services.len()); |
Contributor
There was a problem hiding this comment.
Tiny nit - I'd probably just make this Vec::new() because (a) it looks like Nexus/Ntp/ExternalDns may not need a link at all in the future and (b) Maghemite looks like it needs multiple links.
| &AddrObject::new(link.name(), IPV6_LINK_LOCAL_NAME).unwrap(), | ||
| )?; | ||
| for (link, needs_link_local) in | ||
| running_zone.links().iter().zip(links_need_link_local) |
Contributor
There was a problem hiding this comment.
On a lark I tried using .filter_map() here (since we're already doing .iter().zip(..)):
@@ -787,22 +787,21 @@ impl ServiceManager {
let running_zone = RunningZone::boot(installed_zone).await?;
- for (link, needs_link_local) in
- running_zone.links().iter().zip(links_need_link_local)
+ for link in
+ running_zone.links().iter().zip(links_need_link_local).filter_map(
+ |(link, needs_link_local)| needs_link_local.then_some(link),
+ )
{
- if needs_link_local {
- info!(
- self.inner.log,
- "Ensuring {}/{} exists in zone",
- link.name(),
- IPV6_LINK_LOCAL_NAME
- );
- Zones::ensure_has_link_local_v6_address(
- Some(running_zone.name()),
- &AddrObject::new(link.name(), IPV6_LINK_LOCAL_NAME)
- .unwrap(),
- )?;
- }
+ info!(
+ self.inner.log,
+ "Ensuring {}/{} exists in zone",
+ link.name(),
+ IPV6_LINK_LOCAL_NAME
+ );
+ Zones::ensure_has_link_local_v6_address(
+ Some(running_zone.name()),
+ &AddrObject::new(link.name(), IPV6_LINK_LOCAL_NAME).unwrap(),
+ )?;
}I don't feel like either version is clearly better; take your pick.
jgallagher
approved these changes
Apr 21, 2023
jgallagher
left a comment
Contributor
There was a problem hiding this comment.
madrid is back to working with this change, thank you!
root@oxz_switch:~# ping -i gimlet14 fe80::aa40:25ff:fe04:345
fe80::aa40:25ff:fe04:345 is alive
jmpesp
marked this pull request as ready for review
April 21, 2023 19:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
links_neededto return whether or not a link needs a link local address in the zone. This was required for non-gimlet testing but broke gimlets - see: oxidecomputer/stlouis#391.This also changes
links_neededto check all service requests for required links, not just stopping at the first one found.