Skip to content

[sled-agent-config-reconciler] Flesh out ExternalDisks type #8111

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jgallagher
Copy link
Contributor

Staged on top of #8103, and is pretty similar to it. The biggest difference is that #8103 adds a tokio task responsible for adopting internal disks automatically, and this adds an ExternalDisks type that will be used by the reconciler task to adopt external disks only when asked to via OmicronSledConfig.

@jgallagher jgallagher requested review from andrewjstone and smklein May 7, 2025 20:44
Base automatically changed from john/sled-agent-config-reconciler-internal-disks to main May 8, 2025 19:07

impl DiskAdopter for RealDiskAdopter<'_> {
async fn adopt_disk(
&mut self,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to be &mut self? Or is that just a convenience for tests?

Comment on lines +307 to +319
// Take ownership of our current disk state (if we have one), then
// immediately put back the new state.
let maybe_current = self.disks.remove(&config.id);
self.disks.insert(
self.try_ensure_disk_managed(
maybe_current,
config,
raw_disk,
disk_adopter,
log,
)
.await,
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given that "disk adoption" might involve creating partitions on the underlying disks, it seems like it might be nice to do this operation concurrently?

This appears to currently be:

  • Take out the Option for the disk
  • Call "try_ensure_disk_managed" to transform that state (or create it, if it was None)
  • Put that state back into self.disks

Each operation seems to be acting on independent parts of self.disks, and I don't think the disk_adopter actually needs mutability. WDYT about doing this concurrently?

Copy link
Collaborator

Choose a reason for hiding this comment

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

(I care less about this in the removal path, because that's significantly cheaper)


#[derive(Debug, Default)]
struct TestDiskAdopter {
requests: Vec<RawDisk>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

AFAICT, wrapping this in an Arc<Mutex<..>>> should enable us to operate on &self instead of &mut self within adopt_disk

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