Skip to content

Commit

Permalink
use SocketAddrV6::into::<SocketAddr>
Browse files Browse the repository at this point in the history
  • Loading branch information
gjcolombo committed Dec 20, 2024
1 parent 4292e00 commit ee3c785
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 50 deletions.
74 changes: 37 additions & 37 deletions nexus/db-queries/src/db/datastore/volume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3181,7 +3181,7 @@ impl DataStore {
gen: 1,
opts: sled_agent_client::CrucibleOpts {
id: volume_to_delete_id.0,
target: vec![std::net::SocketAddr::V6(existing.0)],
target: vec![existing.0.into()],
lossy: false,
flush_timeout: None,
key: None,
Expand Down Expand Up @@ -4216,9 +4216,9 @@ mod tests {
id: volume_id,
target: vec![
// target to replace
SocketAddr::V6(region_addresses[0]),
SocketAddr::V6(region_addresses[1]),
SocketAddr::V6(region_addresses[2]),
region_addresses[0].into(),
region_addresses[1].into(),
region_addresses[2].into(),
],
lossy: false,
flush_timeout: None,
Expand Down Expand Up @@ -4278,9 +4278,9 @@ mod tests {
opts: CrucibleOpts {
id: volume_id,
target: vec![
SocketAddr::V6(replacement_region_addr), // replaced
SocketAddr::V6(region_addresses[1]),
SocketAddr::V6(region_addresses[2]),
replacement_region_addr.into(), // replaced
region_addresses[1].into(),
region_addresses[2].into(),
],
lossy: false,
flush_timeout: None,
Expand Down Expand Up @@ -4336,9 +4336,9 @@ mod tests {
opts: CrucibleOpts {
id: volume_id,
target: vec![
SocketAddr::V6(region_addresses[0]), // back to what it was
SocketAddr::V6(region_addresses[1]),
SocketAddr::V6(region_addresses[2]),
region_addresses[0].into(), // back to what it was
region_addresses[1].into(),
region_addresses[2].into(),
],
lossy: false,
flush_timeout: None,
Expand Down Expand Up @@ -4503,9 +4503,9 @@ mod tests {
opts: CrucibleOpts {
id: volume_id,
target: vec![
SocketAddr::V6(region_addresses[0]),
SocketAddr::V6(region_addresses[1]),
SocketAddr::V6(region_addresses[2]),
region_addresses[0].into(),
region_addresses[1].into(),
region_addresses[2].into(),
],
lossy: false,
flush_timeout: None,
Expand All @@ -4527,9 +4527,9 @@ mod tests {
id: rop_id,
target: vec![
// target to replace
SocketAddr::V6(address_1),
SocketAddr::V6(address_2),
SocketAddr::V6(address_3),
address_1.into(),
address_2.into(),
address_3.into(),
],
lossy: false,
flush_timeout: None,
Expand Down Expand Up @@ -4626,9 +4626,9 @@ mod tests {
opts: CrucibleOpts {
id: volume_id,
target: vec![
SocketAddr::V6(region_addresses[0]),
SocketAddr::V6(region_addresses[1]),
SocketAddr::V6(region_addresses[2]),
region_addresses[0].into(),
region_addresses[1].into(),
region_addresses[2].into(),
],
lossy: false,
flush_timeout: None,
Expand All @@ -4650,9 +4650,9 @@ mod tests {
id: rop_id,
target: vec![
// target replaced
SocketAddr::V6(replacement_region_addr),
SocketAddr::V6(address_2),
SocketAddr::V6(address_3),
replacement_region_addr.into(),
address_2.into(),
address_3.into(),
],
lossy: false,
flush_timeout: None,
Expand Down Expand Up @@ -4692,7 +4692,7 @@ mod tests {
id: volume_to_delete_id,
target: vec![
// replaced target stashed here
SocketAddr::V6(address_1),
address_1.into(),
],
lossy: false,
flush_timeout: None,
Expand Down Expand Up @@ -4782,9 +4782,9 @@ mod tests {
opts: CrucibleOpts {
id: volume_id,
target: vec![
SocketAddr::V6(region_addresses[0]),
SocketAddr::V6(region_addresses[1]),
SocketAddr::V6(region_addresses[2]),
region_addresses[0].into(),
region_addresses[1].into(),
region_addresses[2].into(),
],
lossy: false,
flush_timeout: None,
Expand All @@ -4806,9 +4806,9 @@ mod tests {
id: rop_id,
target: vec![
// back to what it was
SocketAddr::V6(address_1),
SocketAddr::V6(address_2),
SocketAddr::V6(address_3),
address_1.into(),
address_2.into(),
address_3.into(),
],
lossy: false,
flush_timeout: None,
Expand Down Expand Up @@ -4848,7 +4848,7 @@ mod tests {
id: volume_to_delete_id,
target: vec![
// replacement stashed here
SocketAddr::V6(replacement_region_addr),
replacement_region_addr.into(),
],
lossy: false,
flush_timeout: None,
Expand Down Expand Up @@ -4964,9 +4964,9 @@ mod tests {
opts: CrucibleOpts {
id: Uuid::new_v4(),
target: vec![
SocketAddr::V6(address_1),
SocketAddr::V6(address_2),
SocketAddr::V6(address_3),
address_1.into(),
address_2.into(),
address_3.into(),
],
lossy: false,
flush_timeout: None,
Expand All @@ -4988,7 +4988,7 @@ mod tests {
let volumes = datastore
.find_volumes_referencing_socket_addr(
&opctx,
SocketAddr::V6(address_1),
address_1.into(),
)
.await
.unwrap();
Expand Down Expand Up @@ -5191,7 +5191,7 @@ mod tests {
id: volume_id,
target: vec![
"[fd00:1122:3344:104::1]:400".parse().unwrap(),
SocketAddr::V6(new_target.0),
new_target.0.into(),
"[fd00:1122:3344:106::1]:402".parse().unwrap(),
],
lossy: false,
Expand Down Expand Up @@ -5345,7 +5345,7 @@ mod tests {
"[fd33:1122:3344:305::1]:2001"
.parse()
.unwrap(),
SocketAddr::V6(new_target.0),
new_target.0.into(),
],
lossy: false,
flush_timeout: None,
Expand Down Expand Up @@ -5465,7 +5465,7 @@ mod tests {
opts: CrucibleOpts {
id: volume_id,
target: vec![
SocketAddr::V6(new_target.0),
new_target.0.into(),
"[fd33:1122:3344:305::1]:2001".parse().unwrap(),
"[fd33:1122:3344:306::1]:2002".parse().unwrap(),
],
Expand Down
4 changes: 2 additions & 2 deletions nexus/src/app/sagas/region_replacement_start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ use serde::Deserialize;
use serde::Serialize;
use sled_agent_client::CrucibleOpts;
use sled_agent_client::VolumeConstructionRequest;
use std::net::{SocketAddr, SocketAddrV6};
use std::net::SocketAddrV6;
use steno::ActionError;
use steno::Node;
use uuid::Uuid;
Expand Down Expand Up @@ -688,7 +688,7 @@ async fn srrs_create_fake_volume(
gen: 0,
opts: CrucibleOpts {
id: new_volume_id,
target: vec![SocketAddr::V6(old_region_address)],
target: vec![old_region_address.into()],
lossy: false,
flush_timeout: None,
key: None,
Expand Down
10 changes: 5 additions & 5 deletions nexus/src/app/sagas/snapshot_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1439,22 +1439,22 @@ async fn ssc_start_running_snapshot(
);

// Map from the region to the snapshot
let region_addr = SocketAddr::V6(SocketAddrV6::new(
let region_addr = SocketAddrV6::new(
*dataset_addr.ip(),
crucible_region.port_number,
0,
0,
));
);

let snapshot_addr = SocketAddr::V6(SocketAddrV6::new(
let snapshot_addr = SocketAddrV6::new(
*dataset_addr.ip(),
crucible_running_snapshot.port_number,
0,
0,
));
);

info!(log, "map {} to {}", region_addr, snapshot_addr);
map.insert(region_addr, snapshot_addr);
map.insert(region_addr.into(), snapshot_addr.into());

// Once snapshot has been validated, and running snapshot has been
// started, add an entry in the region_snapshot table to correspond to
Expand Down
12 changes: 6 additions & 6 deletions nexus/tests/integration_tests/volume_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6055,9 +6055,9 @@ async fn test_no_zombie_read_only_regions(cptestctx: &ControlPlaneTestContext) {
opts: CrucibleOpts {
id: Uuid::new_v4(),
target: vec![
SocketAddr::V6(region_addrs[0]),
SocketAddr::V6(region_addrs[1]),
SocketAddr::V6(region_addrs[2]),
region_addrs[0].into(),
region_addrs[1].into(),
region_addrs[2].into(),
],
lossy: false,
flush_timeout: None,
Expand Down Expand Up @@ -6241,9 +6241,9 @@ async fn test_no_zombie_read_write_regions(
opts: CrucibleOpts {
id: Uuid::new_v4(),
target: vec![
SocketAddr::V6(region_addrs[0]),
SocketAddr::V6(region_addrs[1]),
SocketAddr::V6(region_addrs[2]),
region_addrs[0].into(),
region_addrs[1].into(),
region_addrs[2].into(),
],
lossy: false,
flush_timeout: None,
Expand Down

0 comments on commit ee3c785

Please sign in to comment.