Skip to content

OPTE port cleanup and refactor. - #2856

Merged
luqmana merged 6 commits into
mainfrom
luqmana/port-refactor
Apr 20, 2023
Merged

luqmana merged 6 commits into
mainfrom
luqmana/port-refactor

Conversation

@luqmana

@luqmana luqmana commented Apr 17, 2023

Copy link
Copy Markdown
Contributor

Some refactoring and cleanup primarily to support OPTE ports for services. Each commit is relatively self-contained but the higlights are:

  1. Updating PortManager to handle service vs guest ports.
  2. Enabling IPv6 support (opte has supported this for a while now, just needed to plumb things through).
  3. Leaving port cleanup to RunningZone.

Comment thread illumos-utils/src/running_zone.rs Outdated

/// Remove the OPTE ports on this zone from the port manager.
///
/// Returns the last error, if any.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is how it was before, so I don't think a change here is in scope for this PR, but why only return the last error? Won't an error in the middle be dropped if we just return the last result?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's not ideal but I think the original idea was we also don't want to release some of the ports and not do the rest if we encounter a failure. Maybe worth returning all the errors encountered instead?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, I agree that we should try to delete all the ports, even if some fail. I was just worried that a failure in
the middle would be ignored and not reported. Now, is anyone listening to that failure on the other side and
what possibly could they do if a port release failed, I don't know, but I would think it nicer to at least give
the caller the option of doing something about it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok looking at the code again I realized we could just make this infallible by having PortTicket::release take self by-value. There's always a single PortTicket per-port and the error condition as it was written before was if you somehow tried to release and already release Port. By just consuming the PortTicket instead we shouldn't be able to run into that scenario altogether.

Comment thread illumos-utils/src/opte/mod.rs Resolved
Comment thread illumos-utils/src/opte/port.rs Resolved
@luqmana
luqmana force-pushed the luqmana/port-refactor branch from f3c673b to 7d7a6de Compare April 19, 2023 07:36
@luqmana
luqmana force-pushed the luqmana/port-refactor branch from 7d7a6de to cb52630 Compare April 20, 2023 02:24
@leftwo
leftwo self-requested a review April 20, 2023 21:36

@leftwo leftwo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No further comments

@luqmana
luqmana merged commit e200738 into main Apr 20, 2023
@luqmana
luqmana deleted the luqmana/port-refactor branch April 20, 2023 22:20
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.

2 participants