Skip to content

Commit

Permalink
wrap too-long strings in background task subsystem (#5934)
Browse files Browse the repository at this point in the history
  • Loading branch information
davepacheco authored Jun 26, 2024
1 parent d9e638a commit ff0c914
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 99 deletions.
54 changes: 30 additions & 24 deletions nexus/src/app/background/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl BackgroundTasks {
String::from("metrics_producer_gc"),
String::from(
"unregisters Oximeter metrics producers that have not \
renewed their lease",
renewed their lease",
),
config.metrics_producer_gc.period_secs,
Box::new(gc),
Expand All @@ -184,8 +184,8 @@ impl BackgroundTasks {
String::from("external_endpoints"),
String::from(
"reads config for silos and TLS certificates to determine \
the right set of HTTP endpoints, their HTTP server names, \
and which TLS certificates to use on each one",
the right set of HTTP endpoints, their HTTP server \
names, and which TLS certificates to use on each one",
),
config.external_endpoints.period_secs,
Box::new(watcher),
Expand All @@ -199,13 +199,13 @@ impl BackgroundTasks {
driver.register(
"nat_v4_garbage_collector".to_string(),
String::from(
"prunes soft-deleted IPV4 NAT entries from ipv4_nat_entry table \
based on a predetermined retention policy",
"prunes soft-deleted IPV4 NAT entries from ipv4_nat_entry \
table based on a predetermined retention policy",
),
config.nat_cleanup.period_secs,
Box::new(nat_cleanup::Ipv4NatGarbageCollector::new(
datastore.clone(),
resolver.clone()
resolver.clone(),
)),
opctx.child(BTreeMap::new()),
vec![],
Expand All @@ -217,7 +217,7 @@ impl BackgroundTasks {
"bfd_manager".to_string(),
String::from(
"Manages bidirectional fowarding detection (BFD) \
configuration on rack switches",
configuration on rack switches",
),
config.bfd_manager.period_secs,
Box::new(bfd::BfdManager::new(
Expand Down Expand Up @@ -311,7 +311,7 @@ impl BackgroundTasks {
String::from("inventory_collection"),
String::from(
"collects hardware and software inventory data from the \
whole system",
whole system",
),
config.inventory.period_secs,
Box::new(collector),
Expand Down Expand Up @@ -343,7 +343,8 @@ impl BackgroundTasks {
driver.register(
"service_zone_nat_tracker".to_string(),
String::from(
"ensures service zone nat records are recorded in NAT RPW table",
"ensures service zone nat records are recorded in NAT RPW \
table",
),
config.sync_service_zone_nat.period_secs,
Box::new(ServiceZoneNatTracker::new(
Expand Down Expand Up @@ -390,7 +391,10 @@ impl BackgroundTasks {

let task = driver.register(
String::from("region_replacement"),
String::from("detects if a region requires replacing and begins the process"),
String::from(
"detects if a region requires replacing and begins the \
process",
),
config.region_replacement.period_secs,
Box::new(detector),
opctx.child(BTreeMap::new()),
Expand Down Expand Up @@ -442,8 +446,8 @@ impl BackgroundTasks {
let task_service_firewall_propagation = driver.register(
String::from("service_firewall_rule_propagation"),
String::from(
"propagates VPC firewall rules for Omicron \
services with external network connectivity",
"propagates VPC firewall rules for Omicron services with \
external network connectivity",
),
config.service_firewall_propagation.period_secs,
Box::new(service_firewall_rules::ServiceRulePropagator::new(
Expand All @@ -457,12 +461,11 @@ impl BackgroundTasks {
let task_abandoned_vmm_reaper = driver.register(
String::from("abandoned_vmm_reaper"),
String::from(
"deletes sled reservations for VMMs that have been abandoned by their instances",
"deletes sled reservations for VMMs that have been abandoned \
by their instances",
),
config.abandoned_vmm_reaper.period_secs,
Box::new(abandoned_vmm_reaper::AbandonedVmmReaper::new(
datastore,
)),
Box::new(abandoned_vmm_reaper::AbandonedVmmReaper::new(datastore)),
opctx.child(BTreeMap::new()),
vec![],
);
Expand Down Expand Up @@ -551,8 +554,8 @@ fn init_dns(
format!("dns_propagation_{}", dns_group),
format!(
"propagates latest {} DNS configuration (from {:?} background \
task) to the latest list of DNS servers (from {:?} background \
task)",
task) to the latest list of DNS servers (from {:?} background \
task)",
dns_group, task_name_config, task_name_servers,
),
config.period_secs_propagation,
Expand Down Expand Up @@ -634,7 +637,10 @@ pub mod test {
};
match record.get(0) {
Some(dns_service_client::types::DnsRecord::Srv(srv)) => srv,
record => panic!("expected a SRV record for {internal_dns_srv_name}, found {record:?}"),
record => panic!(
"expected a SRV record for {internal_dns_srv_name}, found \
{record:?}"
),
}
};

Expand Down Expand Up @@ -781,7 +787,7 @@ pub mod test {
) {
println!(
"waiting for propagation of generation {generation} to {label} \
DNS server ({addr})",
DNS server ({addr})",
);

let client = dns_service_client::Client::new(
Expand Down Expand Up @@ -812,13 +818,13 @@ pub mod test {
.await;
if let Err(err) = result {
panic!(
"DNS generation {generation} not propagated to \
{label} DNS server ({addr}) within {poll_max:?}: {err}"
"DNS generation {generation} not propagated to {label} DNS \
server ({addr}) within {poll_max:?}: {err}"
);
} else {
println!(
"DNS generation {generation} propagated to {label} \
DNS server ({addr}) successfully."
"DNS generation {generation} propagated to {label} DNS server \
({addr}) successfully."
);
}
}
Expand Down
3 changes: 2 additions & 1 deletion nexus/src/app/background/tasks/abandoned_vmm_reaper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ impl AbandonedVmmReaper {
results.error_count += 1;
*last_err = Err(e).with_context(|| {
format!(
"failed to delete sled reservation for VMM {vmm_id}"
"failed to delete sled reservation for VMM \
{vmm_id}"
)
});
}
Expand Down
4 changes: 2 additions & 2 deletions nexus/src/app/background/tasks/blueprint_load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ impl BackgroundTask for TargetBlueprintLoader {
// bugs further up the stack.
if *old_blueprint != new_blueprint {
let message = format!(
"blueprint for id {} changed. \
Blueprints are supposed to be immutable.",
"blueprint for id {} changed. Blueprints are supposed \
to be immutable.",
target_id
);
error!(&log, "{}", message);
Expand Down
8 changes: 4 additions & 4 deletions nexus/src/app/background/tasks/dns_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ impl BackgroundTask for DnsConfigWatcher {
// we just read. This should never happen because we
// never remove the latest generation.
let message = format!(
"found latest DNS generation ({}) is older \
than the one we already know about ({})",
"found latest DNS generation ({}) is older than \
the one we already know about ({})",
new.generation, old.generation
);

Expand All @@ -115,8 +115,8 @@ impl BackgroundTask for DnsConfigWatcher {
// immutable once created.
let message = format!(
"found DNS config at generation {} that does \
not match the config that we already have for \
the same generation",
not match the config that we already have \
for the same generation",
new.generation
);
error!(&log, "{}", message);
Expand Down
12 changes: 6 additions & 6 deletions nexus/src/app/background/tasks/inventory_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ mod test {
// has pushed us out.
if our_collections.is_empty() {
println!(
"iter {i}: no test collections \
({num_collections} Nexus collections)",
"iter {i}: no test collections ({num_collections} Nexus \
collections)",
);
continue;
}
Expand All @@ -285,8 +285,8 @@ mod test {
// tail of all IDs we've seen matches the ones we saw in this
// iteration (i.e., we're pushing out old collections in order).
println!(
"iter {i}: saw {our_collections:?}; \
should match tail of {all_our_collection_ids:?}"
"iter {i}: saw {our_collections:?}; should match tail of \
{all_our_collection_ids:?}"
);
assert_eq!(
all_our_collection_ids
Expand Down Expand Up @@ -398,8 +398,8 @@ mod test {
assert_eq!(
removed_urls.len(),
1,
"expected to find exactly one sled URL matching our \
expunged sled's URL"
"expected to find exactly one sled URL matching our expunged \
sled's URL"
);
let mut found_urls = db_enum.list_sled_agents().await.unwrap();
found_urls.sort();
Expand Down
2 changes: 1 addition & 1 deletion nexus/src/app/background/tasks/metrics_producer_gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ mod tests {
{
panic!(
"failed to update time_modified for producer {producer_id}: \
{err}"
{err}"
);
}
}
Expand Down
3 changes: 2 additions & 1 deletion nexus/src/app/background/tasks/phantom_disks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ impl BackgroundTask for PhantomDiskDetector {
if let Err(e) = result {
error!(
&log,
"error un-deleting disk {} and setting to faulted: {:#}",
"error un-deleting disk {} and setting to faulted: \
{:#}",
disk.id(),
e,
);
Expand Down
13 changes: 6 additions & 7 deletions nexus/src/app/background/tasks/region_replacement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ impl BackgroundTask for RegionReplacementDetector {
Err(e) => {
error!(
&log,
"find_regions_on_expunged_physical_disks failed: \
{e}"
"find_regions_on_expunged_physical_disks failed: {e}"
);
err += 1;

Expand All @@ -110,8 +109,8 @@ impl BackgroundTask for RegionReplacementDetector {
Err(e) => {
error!(
&log,
"error looking for existing region \
replacement requests for {}: {e}",
"error looking for existing region replacement \
requests for {}: {e}",
region.id(),
);
continue;
Expand All @@ -130,7 +129,7 @@ impl BackgroundTask for RegionReplacementDetector {
info!(
&log,
"added region replacement request \
{request_id} for {} volume {}",
{request_id} for {} volume {}",
region.id(),
region.volume_id(),
);
Expand All @@ -140,7 +139,7 @@ impl BackgroundTask for RegionReplacementDetector {
error!(
&log,
"error adding region replacement request for \
region {} volume id {}: {e}",
region {} volume id {}: {e}",
region.id(),
region.volume_id(),
);
Expand Down Expand Up @@ -172,7 +171,7 @@ impl BackgroundTask for RegionReplacementDetector {
error!(
&log,
"sending region replacement start request \
failed: {e}",
failed: {e}",
);
err += 1;
}
Expand Down
4 changes: 2 additions & 2 deletions nexus/src/app/background/tasks/service_firewall_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ impl BackgroundTask for ServiceRulePropagator {
.new(slog::o!("component" => "service-firewall-rule-progator"));
debug!(
log,
"starting background task for service \
firewall rule propagation"
"starting background task for service firewall rule \
propagation"
);
let start = std::time::Instant::now();
let res = nexus_networking::plumb_service_firewall_rules(
Expand Down
Loading

0 comments on commit ff0c914

Please sign in to comment.