-
Notifications
You must be signed in to change notification settings - Fork 40
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
Fix filters for probe v2p mappings #5960
Conversation
@@ -44,23 +42,19 @@ impl BackgroundTask for V2PManager { | |||
|
|||
// Get sleds | |||
// we only care about sleds that are active && inservice | |||
let sleds = match self.datastore.sled_list_all_batched(opctx, SledFilter::InService).await | |||
let sleds = match self.datastore.sled_list_all_batched(opctx, SledFilter::V2PMapping).await |
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've basically cribbed the same logic from this block to select the sleds we talk to in the VPC route background task:
omicron/nexus/src/app/background/tasks/vpc_routes.rs
Lines 60 to 88 in 97fe552
let sleds = match self | |
.datastore | |
.sled_list_all_batched(opctx, SledFilter::InService) | |
.await | |
{ | |
Ok(v) => v, | |
Err(e) => { | |
let msg = format!("failed to enumerate sleds: {:#}", e); | |
error!(&log, "{msg}"); | |
return json!({"error": msg}); | |
} | |
} | |
.into_iter() | |
.filter(|sled| { | |
matches!(sled.state(), SledState::Active) | |
&& matches!(sled.policy(), SledPolicy::InService { .. }) | |
}); | |
// Map sled db records to sled-agent clients | |
let sled_clients: Vec<(Sled, sled_agent_client::Client)> = sleds | |
.map(|sled| { | |
let client = sled_client_from_address( | |
sled.id(), | |
sled.address(), | |
&log, | |
); | |
(sled, client) | |
}) | |
.collect(); |
Is this fix something we should apply there, too?
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 could cause issues if we want these sleds to receive updates / be managed even after they are marked as non_provisionable
, as in this issue:
#5872
Does that scenario apply here?
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 it does; my understanding of 'non-provisionable' is that we're not placing new instances on such a sled, but existing ones should still function as intended? In that case we should be making sure that those sleds have up-to-date routing tables for their instances' OPTE ports while they still exist.
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.
Ok, so maybe we need to rename it from SledFilter::V2PMapping
to SledFilter::VpcConfig
or similar and apply it to both RPWs?
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 that would work!
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'd like to make this less error-prone! The docs on SledFilter
have this note:
/// The meaning of a particular filter should not be overloaded -- each time a
/// new use case wants to make a decision based on the zone disposition, a new
/// variant should be added to this enum.
but I imagine it's easy to miss and InService
seems general to a fault, given that guidance. I'm inclined to try removing the InService
variant altogether and updating all its users with more specific variant names, but am open to other suggestions!
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.
Also FWIW, I believe SledFilter::InService
actually does do the right thing here - it includes sleds that are not provisionable. #5872 was caused by the raw DB query inspecting the sled policy/state columns directly and not going through the SledFilter
machinery at all. That said, I stand by the previous point that I think InService
is still too general and will still try the renaming exercise.
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.
Looks good, thank you!
During the changes made in #5917, we accidentally filtered for instances when querying for probe v2p mappings. This PR fixes that filter, and also updates the v2p mapping RPW to use the
SledFilter::V2PMapping
enum.