Skip to content

Commit 200f4ad

Browse files
jgallagherandrewjstoneNieuwejaarrcgoodfellow
authored
Configure tfport uplinks via uplink service (#3765)
Co-authored-by: Andrew J. Stone <andrew.j.stone.1@gmail.com> Co-authored-by: Nils Nieuwejaar <nils@oxidecomputer.com> Co-authored-by: Ryan Goodfellow <ryan.goodfellow@oxide.computer>
1 parent d27b130 commit 200f4ad

File tree

24 files changed

+1050
-389
lines changed

24 files changed

+1050
-389
lines changed

common/src/api/internal/shared.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub struct UplinkConfig {
101101

102102
/// Identifies switch physical location
103103
#[derive(
104-
Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema, Hash, Eq,
104+
Clone, Copy, Debug, Deserialize, Serialize, PartialEq, JsonSchema, Hash, Eq,
105105
)]
106106
#[serde(rename_all = "snake_case")]
107107
pub enum SwitchLocation {

common/src/backoff.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ use std::time::Instant;
1717

1818
pub use ::backoff::future::{retry, retry_notify};
1919
pub use ::backoff::Error as BackoffError;
20-
pub use ::backoff::{backoff::Backoff, ExponentialBackoff, Notify};
20+
pub use ::backoff::{
21+
backoff::Backoff, ExponentialBackoff, ExponentialBackoffBuilder, Notify,
22+
};
2123

2224
/// A helper function which modifies what information is tracked within the
2325
/// callback of the notify function.

illumos-utils/src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pub enum ExecutionError {
6565
#[cfg_attr(any(test, feature = "testing"), mockall::automock, allow(dead_code))]
6666
mod inner {
6767
use super::*;
68+
use std::process::Stdio;
6869

6970
fn to_string(command: &mut std::process::Command) -> String {
7071
command
@@ -93,13 +94,15 @@ mod inner {
9394
// Helper functions for starting the process and checking the
9495
// exit code result.
9596

96-
pub fn spawn(
97+
pub fn spawn_with_piped_stdout_and_stderr(
9798
command: &mut std::process::Command,
9899
) -> Result<std::process::Child, ExecutionError> {
99-
command.spawn().map_err(|err| ExecutionError::ExecutionStart {
100-
command: to_string(command),
101-
err,
102-
})
100+
command.stdout(Stdio::piped()).stderr(Stdio::piped()).spawn().map_err(
101+
|err| ExecutionError::ExecutionStart {
102+
command: to_string(command),
103+
err,
104+
},
105+
)
103106
}
104107

105108
pub fn run_child(

illumos-utils/src/running_zone.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,10 @@ impl RunningZone {
381381
}
382382
let command = command.args(args);
383383

384-
let child = crate::spawn(command).map_err(|err| RunCommandError {
385-
zone: self.name().to_string(),
386-
err,
387-
})?;
384+
let child =
385+
crate::spawn_with_piped_stdout_and_stderr(command).map_err(
386+
|err| RunCommandError { zone: self.name().to_string(), err },
387+
)?;
388388

389389
// Record the process contract now in use by the child; the contract
390390
// just created from the template that we applied to this thread
@@ -437,10 +437,10 @@ impl RunningZone {
437437
// that's actually run is irrelevant.
438438
let mut command = std::process::Command::new("echo");
439439
let command = command.args(args);
440-
let child = crate::spawn(command).map_err(|err| RunCommandError {
441-
zone: self.name().to_string(),
442-
err,
443-
})?;
440+
let child =
441+
crate::spawn_with_piped_stdout_and_stderr(command).map_err(
442+
|err| RunCommandError { zone: self.name().to_string(), err },
443+
)?;
444444
crate::run_child(command, child)
445445
.map_err(|err| RunCommandError {
446446
zone: self.name().to_string(),

internal-dns/src/resolver.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ impl Resolver {
139139
Resolver::new_from_addrs(log, dns_ips)
140140
}
141141

142+
/// Remove all entries from the resolver's cache.
143+
pub fn clear_cache(&self) {
144+
self.resolver.clear_cache();
145+
}
146+
142147
/// Looks up a single [`Ipv6Addr`] based on the SRV name.
143148
/// Returns an error if the record does not exist.
144149
// TODO: There are lots of ways this API can expand: Caching,

nexus/src/app/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl Nexus {
209209
&format!("http://[{address}]:{port}"),
210210
client_state.clone(),
211211
);
212-
dpd_clients.insert(location.clone(), Arc::new(dpd_client));
212+
dpd_clients.insert(*location, Arc::new(dpd_client));
213213
}
214214
if config.pkg.dendrite.is_empty() {
215215
loop {
@@ -232,8 +232,7 @@ impl Nexus {
232232
&format!("http://[{addr}]:{port}"),
233233
client_state.clone(),
234234
);
235-
dpd_clients
236-
.insert(location.clone(), Arc::new(dpd_client));
235+
dpd_clients.insert(*location, Arc::new(dpd_client));
237236
}
238237
break;
239238
}

nexus/src/app/sagas/instance_create.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ impl NexusSaga for SagaInstanceCreate {
330330
// If a primary NIC exists, create a NAT entry for the default external IP,
331331
// as well as additional NAT entries for each requested ephemeral IP
332332
for i in 0..(params.create_params.external_ips.len() + 1) {
333-
for switch_location in &params.boundary_switches {
333+
for &switch_location in &params.boundary_switches {
334334
let subsaga_name = SagaName::new(&format!(
335335
"instance-configure-nat-{i}-{switch_location}"
336336
));
@@ -346,7 +346,7 @@ impl NexusSaga for SagaInstanceCreate {
346346
saga_params: params.clone(),
347347
instance_id,
348348
which: i,
349-
switch_location: switch_location.clone(),
349+
switch_location,
350350
};
351351
subsaga_append(
352352
basename,

nexus/test-utils/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> {
354354
// Set up a stub instance of dendrite
355355
let dendrite = dev::dendrite::DendriteInstance::start(0).await.unwrap();
356356
let port = dendrite.port;
357-
self.dendrite.insert(switch_location.clone(), dendrite);
357+
self.dendrite.insert(switch_location, dendrite);
358358

359359
let address = SocketAddrV6::new(Ipv6Addr::LOCALHOST, port, 0, 0);
360360

openapi/sled-agent.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,13 +2221,6 @@
22212221
"format": "ipv6"
22222222
}
22232223
},
2224-
"boundary_switches": {
2225-
"type": "array",
2226-
"items": {
2227-
"type": "string",
2228-
"format": "ipv6"
2229-
}
2230-
},
22312224
"dataset": {
22322225
"nullable": true,
22332226
"default": null,
@@ -2253,7 +2246,6 @@
22532246
},
22542247
"required": [
22552248
"addresses",
2256-
"boundary_switches",
22572249
"id",
22582250
"services",
22592251
"zone_type"

package-manifest.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,8 @@ only_for_targets.image = "standard"
421421
# 2. Copy dendrite.tar.gz from dendrite/out to omicron/out
422422
source.type = "prebuilt"
423423
source.repo = "dendrite"
424-
source.commit = "db270160e514a14dd409a8e1455756d017d54ae0"
425-
source.sha256 = "72233bc4d7b2d47b7cb170ac366b94abcb25f32a8edadaf3d85d17fd0cc22230"
424+
source.commit = "ef8a97532214c795abb6c7de05289c161e9a80ca"
425+
source.sha256 = "a63c05e81cf58efd28f89f4f860f4e5e68865c234eb071bec03184437521245b"
426426
output.type = "zone"
427427
output.intermediate_only = true
428428

@@ -446,8 +446,8 @@ only_for_targets.image = "standard"
446446
# 2. Copy the output zone image from dendrite/out to omicron/out
447447
source.type = "prebuilt"
448448
source.repo = "dendrite"
449-
source.commit = "db270160e514a14dd409a8e1455756d017d54ae0"
450-
source.sha256 = "e844ad779fe1e390fa5de707e2be66c2882cb36e96c489009a8609516df09d6b"
449+
source.commit = "ef8a97532214c795abb6c7de05289c161e9a80ca"
450+
source.sha256 = "7a828286c4e3c97cff56b347fa5922acb6ba93fd8fdfb3e9ea61f1d5fb9b53a5"
451451
output.type = "zone"
452452
output.intermediate_only = true
453453

@@ -464,8 +464,8 @@ only_for_targets.image = "standard"
464464
# 2. Copy dendrite.tar.gz from dendrite/out to omicron/out/dendrite-softnpu.tar.gz
465465
source.type = "prebuilt"
466466
source.repo = "dendrite"
467-
source.commit = "db270160e514a14dd409a8e1455756d017d54ae0"
468-
source.sha256 = "24098c91ba9057d0c33571ee28a859bc480009bc55bdf7fa03882b4ab1542dbe"
467+
source.commit = "ef8a97532214c795abb6c7de05289c161e9a80ca"
468+
source.sha256 = "aef8ecec0ebdbf8ea790cb65702be636b7e1fae007dcd1434fdba2bc4ccbc06f"
469469
output.type = "zone"
470470
output.intermediate_only = true
471471

0 commit comments

Comments
 (0)