Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove old, pre-reconfigurator upgrade APIs #7431

Merged
merged 1 commit into from
Jan 29, 2025
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
10 changes: 0 additions & 10 deletions clients/nexus-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,6 @@ impl From<&omicron_common::api::internal::nexus::ProducerEndpoint>
}
}

impl From<omicron_common::api::external::SemverVersion>
for types::SemverVersion
{
fn from(s: omicron_common::api::external::SemverVersion) -> Self {
s.to_string().parse().expect(
"semver should generate output that matches validation regex",
)
}
}

impl From<std::time::Duration> for types::Duration {
fn from(s: std::time::Duration) -> Self {
Self { secs: s.as_secs(), nanos: s.subsec_nanos() }
Expand Down
57 changes: 0 additions & 57 deletions clients/sled-agent-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,63 +262,6 @@ impl From<omicron_common::api::external::L4PortRange> for types::L4PortRange {
}
}

impl From<omicron_common::api::internal::nexus::UpdateArtifactId>
for types::UpdateArtifactId
{
fn from(s: omicron_common::api::internal::nexus::UpdateArtifactId) -> Self {
types::UpdateArtifactId {
name: s.name,
version: s.version.into(),
kind: s.kind.into(),
}
}
}

impl From<omicron_common::api::external::SemverVersion>
for types::SemverVersion
{
fn from(s: omicron_common::api::external::SemverVersion) -> Self {
s.to_string().parse().expect(
"semver should generate output that matches validation regex",
)
}
}

impl From<omicron_common::api::internal::nexus::KnownArtifactKind>
for types::KnownArtifactKind
{
fn from(
s: omicron_common::api::internal::nexus::KnownArtifactKind,
) -> Self {
use omicron_common::api::internal::nexus::KnownArtifactKind;

match s {
KnownArtifactKind::GimletRotBootloader => {
types::KnownArtifactKind::GimletRotBootloader
}
KnownArtifactKind::PscRotBootloader => {
types::KnownArtifactKind::PscRotBootloader
}
KnownArtifactKind::SwitchRotBootloader => {
types::KnownArtifactKind::SwitchRotBootloader
}
KnownArtifactKind::GimletSp => types::KnownArtifactKind::GimletSp,
KnownArtifactKind::GimletRot => types::KnownArtifactKind::GimletRot,
KnownArtifactKind::Host => types::KnownArtifactKind::Host,
KnownArtifactKind::Trampoline => {
types::KnownArtifactKind::Trampoline
}
KnownArtifactKind::ControlPlane => {
types::KnownArtifactKind::ControlPlane
}
KnownArtifactKind::PscSp => types::KnownArtifactKind::PscSp,
KnownArtifactKind::PscRot => types::KnownArtifactKind::PscRot,
KnownArtifactKind::SwitchSp => types::KnownArtifactKind::SwitchSp,
KnownArtifactKind::SwitchRot => types::KnownArtifactKind::SwitchRot,
}
}
}

impl From<omicron_common::api::internal::nexus::HostIdentifier>
for types::HostIdentifier
{
Expand Down
32 changes: 9 additions & 23 deletions nexus/internal-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use std::collections::{BTreeMap, BTreeSet};

use dropshot::{
FreeformBody, HttpError, HttpResponseCreated, HttpResponseDeleted,
HttpResponseOk, HttpResponseUpdatedNoContent, Path, Query, RequestContext,
ResultsPage, TypedBody,
HttpError, HttpResponseCreated, HttpResponseDeleted, HttpResponseOk,
HttpResponseUpdatedNoContent, Path, Query, RequestContext, ResultsPage,
TypedBody,
};
use nexus_types::{
deployment::{
Expand All @@ -27,17 +27,13 @@ use nexus_types::{
views::{BackgroundTask, DemoSaga, Ipv4NatEntryView, Saga},
},
};
use omicron_common::{
api::{
external::{http_pagination::PaginatedById, Instance},
internal::nexus::{
DiskRuntimeState, DownstairsClientStopRequest,
DownstairsClientStopped, ProducerEndpoint,
ProducerRegistrationResponse, RepairFinishInfo, RepairProgress,
RepairStartInfo, SledVmmState,
},
use omicron_common::api::{
external::{http_pagination::PaginatedById, Instance},
internal::nexus::{
DiskRuntimeState, DownstairsClientStopRequest, DownstairsClientStopped,
ProducerEndpoint, ProducerRegistrationResponse, RepairFinishInfo,
RepairProgress, RepairStartInfo, SledVmmState,
},
update::ArtifactId,
};
use omicron_uuid_kinds::{
DemoSagaUuid, DownstairsKind, PropolisUuid, SledUuid, TypedUuid,
Expand Down Expand Up @@ -208,16 +204,6 @@ pub trait NexusInternalApi {
oximeter_info: TypedBody<OximeterInfo>,
) -> Result<HttpResponseUpdatedNoContent, HttpError>;

/// Endpoint used by Sled Agents to download cached artifacts.
#[endpoint {
method = GET,
path = "/artifacts/{kind}/{name}/{version}",
}]
async fn cpapi_artifact_download(
request_context: RequestContext<Self::Context>,
path_params: Path<ArtifactId>,
) -> Result<HttpResponseOk<FreeformBody>, HttpError>;

/// An Upstairs will notify this endpoint when a repair starts
#[endpoint {
method = POST,
Expand Down
14 changes: 0 additions & 14 deletions nexus/src/app/update/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use nexus_db_queries::context::OpContext;
use omicron_common::api::external::{
Error, SemverVersion, TufRepoInsertResponse, TufRepoInsertStatus,
};
use omicron_common::update::ArtifactId;
use update_common::artifacts::ArtifactsWithPlan;

mod common_sp_update;
Expand Down Expand Up @@ -113,17 +112,4 @@ impl super::Nexus {

Ok(tuf_repo_description)
}

/// Downloads a file (currently not implemented).
pub(crate) async fn updates_download_artifact(
&self,
_opctx: &OpContext,
_artifact: ArtifactId,
) -> Result<Vec<u8>, Error> {
// TODO: this is part of the TUF repo depot.
return Err(Error::internal_error(
"artifact download not implemented, \
will be part of TUF repo depot",
));
}
}
19 changes: 0 additions & 19 deletions nexus/src/internal_api/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use super::params::{OximeterInfo, RackInitializationRequest};
use crate::context::ApiContext;
use dropshot::ApiDescription;
use dropshot::Body;
use dropshot::FreeformBody;
use dropshot::HttpError;
use dropshot::HttpResponseCreated;
use dropshot::HttpResponseDeleted;
Expand Down Expand Up @@ -54,7 +52,6 @@ use omicron_common::api::internal::nexus::RepairFinishInfo;
use omicron_common::api::internal::nexus::RepairProgress;
use omicron_common::api::internal::nexus::RepairStartInfo;
use omicron_common::api::internal::nexus::SledVmmState;
use omicron_common::update::ArtifactId;
use omicron_uuid_kinds::GenericUuid;
use omicron_uuid_kinds::InstanceUuid;
use std::collections::BTreeMap;
Expand Down Expand Up @@ -366,22 +363,6 @@ impl NexusInternalApi for NexusInternalApiImpl {
.await
}

async fn cpapi_artifact_download(
request_context: RequestContext<Self::Context>,
path_params: Path<ArtifactId>,
) -> Result<HttpResponseOk<FreeformBody>, HttpError> {
let context = &request_context.context().context;
let nexus = &context.nexus;
let opctx =
crate::context::op_context_for_internal_api(&request_context).await;
// TODO: return 404 if the error we get here says that the record isn't found
let body = nexus
.updates_download_artifact(&opctx, path_params.into_inner())
.await?;

Ok(HttpResponseOk(Body::from(body).into()))
}

async fn cpapi_upstairs_repair_start(
rqctx: RequestContext<Self::Context>,
path_params: Path<UpstairsPathParam>,
Expand Down
55 changes: 0 additions & 55 deletions openapi/nexus-internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,6 @@
"version": "0.0.1"
},
"paths": {
"/artifacts/{kind}/{name}/{version}": {
"get": {
"summary": "Endpoint used by Sled Agents to download cached artifacts.",
"operationId": "cpapi_artifact_download",
"parameters": [
{
"in": "path",
"name": "kind",
"description": "The kind of artifact this is.",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "path",
"name": "name",
"description": "The artifact's name.",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "path",
"name": "version",
"description": "The artifact's version.",
"required": true,
"schema": {
"$ref": "#/components/schemas/SemverVersion"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"*/*": {
"schema": {}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/bgtasks": {
"get": {
"summary": "List background tasks",
Expand Down Expand Up @@ -6083,10 +6032,6 @@
"sled_id"
]
},
"SemverVersion": {
"type": "string",
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
},
"TypedUuidForDownstairsKind": {
"type": "string",
"format": "uuid"
Expand Down
79 changes: 0 additions & 79 deletions openapi/sled-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -1327,32 +1327,6 @@
}
}
},
"/update": {
"post": {
"operationId": "update_artifact",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateArtifactId"
}
}
},
"required": true
},
"responses": {
"204": {
"description": "resource updated"
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/v2p": {
"get": {
"summary": "List v2p mappings present on sled",
Expand Down Expand Up @@ -4388,24 +4362,6 @@
"net"
]
},
"KnownArtifactKind": {
"description": "Kinds of update artifacts, as used by Nexus to determine what updates are available and by sled-agent to determine how to apply an update when asked.",
"type": "string",
"enum": [
"gimlet_sp",
"gimlet_rot",
"gimlet_rot_bootloader",
"host",
"trampoline",
"control_plane",
"psc_sp",
"psc_rot",
"psc_rot_bootloader",
"switch_sp",
"switch_rot",
"switch_rot_bootloader"
]
},
"L4PortRange": {
"example": "22",
"title": "A range of IP ports",
Expand Down Expand Up @@ -5618,10 +5574,6 @@
"version"
]
},
"SemverVersion": {
"type": "string",
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
},
"SledDiagnosticsQueryOutput": {
"oneOf": [
{
Expand Down Expand Up @@ -6041,37 +5993,6 @@
"type": "string",
"format": "uuid"
},
"UpdateArtifactId": {
"description": "An identifier for a single update artifact.",
"type": "object",
"properties": {
"kind": {
"description": "The kind of update artifact this is.",
"allOf": [
{
"$ref": "#/components/schemas/KnownArtifactKind"
}
]
},
"name": {
"description": "The artifact's name.",
"type": "string"
},
"version": {
"description": "The artifact's version.",
"allOf": [
{
"$ref": "#/components/schemas/SemverVersion"
}
]
}
},
"required": [
"kind",
"name",
"version"
]
},
"UplinkAddressConfig": {
"type": "object",
"properties": {
Expand Down
Loading
Loading