Repository navigation
MGS: disallow resetting our local sidecar - #11544
Conversation
davepacheco
left a comment
There was a problem hiding this comment.
This seems fine. I guess the official procedure for doing an update with a broken sidecar will be to use faux-mgs?
|
Laura noted in testing that the error we were sending back was wrong: e15ea1b fixes that, and 9dfc079 adds an integration test. These made the diff quite a bit larger than it was when initially reviewed, but I think are pretty uncontroversial. I'll leave this open for a bit if @hawkw or @davepacheco want to give the latest changes a skim, but don't feel obligated to. |
|
@claude review |
hawkw
left a comment
There was a problem hiding this comment.
Still looks good to me, though I wonder if we could move more of the logic out of the API endpoint?
| .is_local_sp_reset_allowed() | ||
| .map_err(HttpError::from)? | ||
| { | ||
| return Err(SpComponentResetError::ResetSpOfLocalSled); | ||
| match apictx | ||
| .mgmt_switch | ||
| .sp_locality(sp_id) | ||
| .map_err(HttpError::from)? | ||
| { | ||
| SpLocality::NotLocal => (), // ok, fall through | ||
| SpLocality::LocalSled => { | ||
| return Err(SpComponentResetError::ResetSpOfLocalSled); | ||
| } | ||
| SpLocality::LocalSwitch => { | ||
| return Err( | ||
| SpComponentResetError::ResetSpOfLocalSwitch, | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
take it or leave it: it seems to me that we could have all of this logic remain encapsulated behind ManagementSwitch::allowed_to_reset_sp, and include both the "is the SP local" and "are we allowed to reset our local sled/switch SP?" checks there, if we changed that function to return a Result? The error type would have to be something that bundled together both the ``SpComponentResetErrorandSpLookupError`, though, which might make it a bit messier. So, I dunno if it's actually worth it or not, just a thought.
There was a problem hiding this comment.
Yeah, I started down that road and
The error type would have to be something that bundled together both the
SpComponentResetErrorandSpLookupError, though, which might make it a bit messier
is exactly why I punted on it. I do think it would be nicer, though; I guess it's fine to have a SpResetValidityError that combines the two. I'll give that a whirl.
There was a problem hiding this comment.
Mmkay it's less code but more awkward - didn't need a new error type at all, at the expense of a "I'm sorry for my past crimes" comment:
// Error conversion here is a little awkward. If we don't yet have our
// location map, we can convert that error into an
// `SpComponentResetError` by travelling through `HttpError`, which
// turns into `SpComponentResetError::Other { .. }`.
let location_map = self.location_map().map_err(HttpError::from)?;There was a problem hiding this comment.
Hmm, well, if this feels too awkward to you, I'd be fine with putting it back the way it was before, but I do also kinda like having everything in one function. Up to you.
There was a problem hiding this comment.
Nah, I like it better in one place too. I can live with the out-of-place HttpError.
Attempting to reset a sidecar a SP to perform an update that includes a new FPGA image through the MGS on that sidecar's scrimlet cannot succeed:
This matches the symptoms we see in #11512, if we assume that we eventually broke out of this loop by getting lucky and issuing the reset via the other scrimlet's MGS. It exactly matches behavior @labbott induced on london while trying to reproduce the dogfood issue.
This change means we'll always reject sidecar SP resets from that sidecar's local MGS. This is overly cautious, given we only need to reject them when there's a new FPGA image, and it means a reconfigurator-driven update now explicitly requires two healthy scrimlets/sidecars. (Based on the description above, we believe it already implicitly required that anyway!)