Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! response to changes in available disks.

use crate::InternalDisksReceiver;
use crate::dump_setup::DumpSetup;
use crate::debug_collector::DebugCollector;
use camino::Utf8PathBuf;
use debug_ignore::DebugIgnore;
use sled_storage::config::MountConfig;
Expand All @@ -33,16 +33,16 @@ pub(crate) fn spawn(
// to enqueue the request or for the request to complete.
let (archive_tx, archive_rx) = mpsc::channel(1);

let dump_setup_task = DumpSetupTask {
let debug_collector_task = DebugCollectorTask {
internal_disks_rx,
external_disks_rx,
archive_rx,
dump_setup: DumpSetup::new(base_log, mount_config),
debug_collector: DebugCollector::new(base_log, mount_config),
last_disks_used: HashSet::new(),
log: base_log.new(slog::o!("component" => "DumpSetupTask")),
log: base_log.new(slog::o!("component" => "DebugCollectorTask")),
};

tokio::spawn(dump_setup_task.run());
tokio::spawn(debug_collector_task.run());

FormerZoneRootArchiver {
log: DebugIgnore(
Expand All @@ -52,23 +52,24 @@ pub(crate) fn spawn(
}
}

struct DumpSetupTask {
struct DebugCollectorTask {
// Input channels on which we receive updates about disk changes.
internal_disks_rx: InternalDisksReceiver,
external_disks_rx: watch::Receiver<HashSet<Disk>>,
// Input channel on which we receive requests to archive zone roots.
archive_rx: mpsc::Receiver<FormerZoneRootArchiveRequest>,

// Invokes dumpadm(8) and savecore(8) when new disks are encountered
dump_setup: DumpSetup,
debug_collector: DebugCollector,

// Set of internal + external disks we most recently passed to `dump_setup`.
// Set of internal + external disks we most recently passed to the
// Debug Collector
last_disks_used: HashSet<Disk>,

log: Logger,
}

impl DumpSetupTask {
impl DebugCollectorTask {
async fn run(mut self) {
self.update_setup_if_needed().await;

Expand Down Expand Up @@ -119,7 +120,7 @@ impl DumpSetupTask {
completion_tx
} = request;
self
.dump_setup
.debug_collector
.archive_former_zone_root(&path, completion_tx)
.await;
}
Expand All @@ -138,7 +139,7 @@ impl DumpSetupTask {
.collect::<HashSet<_>>();

if disks_avail != self.last_disks_used {
self.dump_setup.update_dumpdev_setup(disks_avail.iter()).await;
self.debug_collector.update_dumpdev_setup(disks_avail.iter()).await;
self.last_disks_used = disks_avail;
}
}
Expand Down
6 changes: 3 additions & 3 deletions sled-agent/config-reconciler/src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ use crate::SledAgentFacilities;
use crate::TimeSyncStatus;
use crate::dataset_serialization_task::DatasetTaskHandle;
use crate::dataset_serialization_task::NestedDatasetMountError;
use crate::dump_setup_task;
use crate::dump_setup_task::FormerZoneRootArchiver;
use crate::debug_collector_task;
use crate::debug_collector_task::FormerZoneRootArchiver;
use crate::internal_disks::InternalDisksReceiver;
use crate::ledger::CurrentSledConfig;
use crate::ledger::LedgerTaskHandle;
Expand Down Expand Up @@ -136,7 +136,7 @@ impl ConfigReconcilerHandle {
// Spawn the task that manages dump devices.
let (external_disks_tx, external_disks_rx) =
watch::channel(HashSet::new());
let former_zone_root_archiver = dump_setup_task::spawn(
let former_zone_root_archiver = debug_collector_task::spawn(
internal_disks_rx.clone(),
external_disks_rx,
Arc::clone(&mount_config),
Expand Down
4 changes: 2 additions & 2 deletions sled-agent/config-reconciler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
//! [`ConfigReconcilerHandle::inventory()`].

mod dataset_serialization_task;
mod debug_collector;
mod debug_collector_task;
mod disks_common;
mod dump_setup;
mod dump_setup_task;
mod handle;
mod host_phase_2;
mod internal_disks;
Expand Down
2 changes: 1 addition & 1 deletion sled-agent/config-reconciler/src/reconciler_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use crate::InternalDisksReceiver;
use crate::SledAgentArtifactStore;
use crate::TimeSyncConfig;
use crate::dataset_serialization_task::DatasetTaskHandle;
use crate::dump_setup_task::FormerZoneRootArchiver;
use crate::debug_collector_task::FormerZoneRootArchiver;
use crate::host_phase_2::BootPartitionReconciler;
use crate::ledger::CurrentSledConfig;
use crate::raw_disks::RawDisksReceiver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ use std::sync::Arc;
use std::sync::OnceLock;
use tokio::sync::watch;

use crate::debug_collector_task::FormerZoneRootArchiver;
use crate::disks_common::MaybeUpdatedDisk;
use crate::disks_common::update_properties_from_raw_disk;
use crate::dump_setup_task::FormerZoneRootArchiver;
use camino::Utf8PathBuf;
use illumos_utils::zfs::Mountpoint;

Expand Down Expand Up @@ -238,7 +238,7 @@ pub(super) struct ExternalDisks {
currently_managed_zpools_tx: watch::Sender<Arc<CurrentlyManagedZpools>>,

// Output channel for the raw disks we're managing. This is only consumed
// within this crate by `DumpSetupTask` (for managing dump devices).
// within this crate by `DebugCollectorTask` (for managing dump devices).
external_disks_tx: watch::Sender<HashSet<Disk>>,

// For requesting archival of former zone root directories.
Expand Down Expand Up @@ -501,8 +501,8 @@ impl ExternalDisks {

// Update the output channels now. This is important to do before
// cleaning up former zone root datasets because that step will require
// that the archival task (DumpSetup) has seen the new disks and added
// any debug datasets found on them.
// that the archival task (DebugCollector) has seen the new disks and
// added any debug datasets found on them.
self.update_output_watch_channels();

// For any newly-adopted disks, clean up any former zone root datasets
Expand Down
2 changes: 1 addition & 1 deletion sled-agent/config-reconciler/src/reconciler_task/zones.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::InternalDisks;
use crate::ResolverStatusExt;
use crate::SledAgentFacilities;
use crate::TimeSyncConfig;
use crate::dump_setup_task::FormerZoneRootArchiver;
use crate::debug_collector_task::FormerZoneRootArchiver;
use camino::Utf8PathBuf;
use futures::FutureExt as _;
use futures::future;
Expand Down
9 changes: 5 additions & 4 deletions sled-agent/src/zone_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,8 @@ async fn create_snapshot(
// A key feature of the zone-bundle process is that we pull all the log files
// for a zone. This is tricky. The logs are both being written to by the
// programs we're interested in, and also potentially being rotated by `logadm`,
// and / or archived out to the U.2s through the code in `crate::dump_setup`.
// and / or archived out to the U.2s through the code in
// `crate::debug_collector`.
//
// We need to capture all these logs, while avoiding inconsistent state (e.g., a
// missing log message that existed when the bundle was created) and also
Expand Down Expand Up @@ -1033,8 +1034,8 @@ async fn create(
//
// Both of these are dynamic. The current log file is likely being written
// by the service itself, and `logadm` may also be rotating files. At the
// same time, the log-archival process in `dump_setup.rs` may be copying
// these out to the U.2s, after which it deletes those on the zone
// same time, the log-archival process in `debug_collector.rs` may be
// copying these out to the U.2s, after which it deletes those on the zone
// filesystem itself.
//
// To avoid various kinds of corruption, such as a bad tarball or missing
Expand Down Expand Up @@ -1261,7 +1262,7 @@ async fn find_archived_log_files<'a, T: Iterator<Item = &'a Utf8PathBuf>>(
}
}
} else {
// The logic in `dump_setup` picks some U.2 in which to start
// The logic in `debug_collector` picks some U.2 in which to start
// archiving logs, and thereafter tries to keep placing new ones
// there, subject to space constraints. It's not really an error for
// there to be no entries for the named zone in any particular U.2
Expand Down
6 changes: 3 additions & 3 deletions sled-agent/types/src/support_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
// | | This is a per-bundle nested dataset
// | This is a Debug dataset
//
// NOTE: The "DumpSetupWorker" has been explicitly configured to ignore these files, so they are
// not removed. If the files used here change in the future, DumpSetupWorker should also be
// updated.
// NOTE: The DebugCollector has been explicitly configured to ignore these
// files, so they are not removed. If the files used here change in the future,
// DebugCollector should also be updated.
pub const BUNDLE_FILE_NAME: &str = "bundle.zip";
pub const BUNDLE_TMP_FILE_NAME: &str = "bundle.zip.tmp";

Expand Down