Skip to content
Merged
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
2 changes: 1 addition & 1 deletion end-to-end-tests/src/instance_launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async fn instance_launch() -> Result<()> {
.context("no external IPs")?
.clone();

let ExternalIp::Ephemeral { ip: ip_addr } = ip_addr else {
let ExternalIp::Ephemeral { ip: ip_addr, .. } = ip_addr else {
anyhow::bail!("IP bound to instance was not ephemeral as required.")
};
eprintln!("instance external IP: {}", ip_addr);
Expand Down
7 changes: 4 additions & 3 deletions nexus/db-model/src/external_ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,10 @@ impl TryFrom<ExternalIp> for views::ExternalIp {
}
match ip.kind {
IpKind::Floating => Ok(views::ExternalIp::Floating(ip.try_into()?)),
IpKind::Ephemeral => {
Ok(views::ExternalIp::Ephemeral { ip: ip.ip.ip() })
}
IpKind::Ephemeral => Ok(views::ExternalIp::Ephemeral {
ip: ip.ip.ip(),
ip_pool_id: ip.ip_pool_id,
}),
IpKind::SNat => Err(Error::internal_error(
"SNAT IP addresses should not be exposed in the API",
)),
Expand Down
4 changes: 2 additions & 2 deletions nexus/types/src/external_api/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,14 +501,14 @@ pub struct IpPoolRange {
#[derive(Debug, Clone, Deserialize, PartialEq, Serialize, JsonSchema)]
#[serde(tag = "kind", rename_all = "snake_case")]
pub enum ExternalIp {
Ephemeral { ip: IpAddr },
Ephemeral { ip: IpAddr, ip_pool_id: Uuid },
Floating(FloatingIp),
}

impl ExternalIp {
pub fn ip(&self) -> IpAddr {
match self {
Self::Ephemeral { ip } => *ip,
Self::Ephemeral { ip, .. } => *ip,
Self::Floating(float) => float.ip,
}
}
Expand Down
5 changes: 5 additions & 0 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -17507,6 +17507,10 @@
"type": "string",
"format": "ip"
},
"ip_pool_id": {
"type": "string",
"format": "uuid"
},
"kind": {
"type": "string",
"enum": [
Expand All @@ -17516,6 +17520,7 @@
},
"required": [
"ip",
"ip_pool_id",
"kind"
]
},
Expand Down
Loading