Skip to content

Commit

Permalink
fix ExternalIp name conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
rcgoodfellow committed Feb 28, 2024
1 parent 370787e commit e7bbd34
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 65 deletions.
1 change: 1 addition & 0 deletions end-to-end-tests/src/instance_launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ async fn instance_launch() -> Result<()> {
.first()
.context("no external IPs")?
.clone();

let ExternalIp::Ephemeral { ip: ip_addr } = ip_addr else {
anyhow::bail!("IP bound to instance was not ephemeral as required.")
};
Expand Down
6 changes: 3 additions & 3 deletions nexus/db-queries/src/db/datastore/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ pub struct ProbeInfo {
pub id: Uuid,
pub name: Name,
sled: Uuid,
pub external_ips: Vec<ExternalIp>,
pub external_ips: Vec<ProbeExternalIp>,
pub interface: NetworkInterface,
}

#[derive(Debug, Clone, JsonSchema, Serialize, Deserialize)]
pub struct ExternalIp {
pub struct ProbeExternalIp {
ip: IpAddr,
first_port: u16,
last_port: u16,
kind: IpKind,
}

impl From<nexus_db_model::ExternalIp> for ExternalIp {
impl From<nexus_db_model::ExternalIp> for ProbeExternalIp {
fn from(value: nexus_db_model::ExternalIp) -> Self {
Self {
ip: value.ip.ip(),
Expand Down
58 changes: 29 additions & 29 deletions openapi/nexus-internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -3516,34 +3516,6 @@
"request_id"
]
},
"ExternalIp": {
"type": "object",
"properties": {
"first_port": {
"type": "integer",
"format": "uint16",
"minimum": 0
},
"ip": {
"type": "string",
"format": "ip"
},
"kind": {
"$ref": "#/components/schemas/IpKind"
},
"last_port": {
"type": "integer",
"format": "uint16",
"minimum": 0
}
},
"required": [
"first_port",
"ip",
"kind",
"last_port"
]
},
"ExternalPortDiscovery": {
"oneOf": [
{
Expand Down Expand Up @@ -5560,13 +5532,41 @@
"speed400_g"
]
},
"ProbeExternalIp": {
"type": "object",
"properties": {
"first_port": {
"type": "integer",
"format": "uint16",
"minimum": 0
},
"ip": {
"type": "string",
"format": "ip"
},
"kind": {
"$ref": "#/components/schemas/IpKind"
},
"last_port": {
"type": "integer",
"format": "uint16",
"minimum": 0
}
},
"required": [
"first_port",
"ip",
"kind",
"last_port"
]
},
"ProbeInfo": {
"type": "object",
"properties": {
"external_ips": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ExternalIp"
"$ref": "#/components/schemas/ProbeExternalIp"
}
},
"id": {
Expand Down
62 changes: 31 additions & 31 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ExternalIp2"
"$ref": "#/components/schemas/ExternalIp"
}
}
}
Expand Down Expand Up @@ -11761,34 +11761,6 @@
]
},
"ExternalIp": {
"type": "object",
"properties": {
"first_port": {
"type": "integer",
"format": "uint16",
"minimum": 0
},
"ip": {
"type": "string",
"format": "ip"
},
"kind": {
"$ref": "#/components/schemas/IpKind"
},
"last_port": {
"type": "integer",
"format": "uint16",
"minimum": 0
}
},
"required": [
"first_port",
"ip",
"kind",
"last_port"
]
},
"ExternalIp2": {
"oneOf": [
{
"type": "object",
Expand Down Expand Up @@ -11931,7 +11903,7 @@
"description": "list of items on this page of results",
"type": "array",
"items": {
"$ref": "#/components/schemas/ExternalIp2"
"$ref": "#/components/schemas/ExternalIp"
}
},
"next_page": {
Expand Down Expand Up @@ -14370,13 +14342,41 @@
"sled"
]
},
"ProbeExternalIp": {
"type": "object",
"properties": {
"first_port": {
"type": "integer",
"format": "uint16",
"minimum": 0
},
"ip": {
"type": "string",
"format": "ip"
},
"kind": {
"$ref": "#/components/schemas/IpKind"
},
"last_port": {
"type": "integer",
"format": "uint16",
"minimum": 0
}
},
"required": [
"first_port",
"ip",
"kind",
"last_port"
]
},
"ProbeInfo": {
"type": "object",
"properties": {
"external_ips": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ExternalIp"
"$ref": "#/components/schemas/ProbeExternalIp"
}
},
"id": {
Expand Down
4 changes: 2 additions & 2 deletions sled-agent/src/probe_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use illumos_utils::opte::params::VpcFirewallRule;
use illumos_utils::opte::{DhcpCfg, PortManager};
use illumos_utils::running_zone::{RunningZone, ZoneBuilderFactory};
use illumos_utils::zone::Zones;
use nexus_client::types::{ExternalIp, ProbeInfo};
use nexus_client::types::{ProbeExternalIp, ProbeInfo};
use omicron_common::api::external::{
VpcFirewallRuleAction, VpcFirewallRuleDirection, VpcFirewallRulePriority,
VpcFirewallRuleStatus,
Expand Down Expand Up @@ -95,7 +95,7 @@ struct ProbeState {
/// Runtime state on this sled
status: zone::State,
/// The external IP addresses the probe has been assigned.
external_ips: Vec<ExternalIp>,
external_ips: Vec<ProbeExternalIp>,
/// The probes networking interface.
interface: Option<NetworkInterface>,
}
Expand Down

0 comments on commit e7bbd34

Please sign in to comment.