Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
Created using spr 1.3.5
  • Loading branch information
sunshowers committed Nov 7, 2023
2 parents bf996ed + 6db8819 commit 7a41675
Show file tree
Hide file tree
Showing 17 changed files with 176 additions and 81 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ static_assertions = "1.1.0"
steno = "0.4.0"
strum = { version = "0.25", features = [ "derive" ] }
subprocess = "0.2.9"
swrite = "0.1.0"
libsw = { version = "3.3.0", features = ["tokio"] }
syn = { version = "2.0" }
tabled = "0.14"
Expand Down
3 changes: 3 additions & 0 deletions bootstore/src/schemes/v0/peer_networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,9 @@ async fn perform_handshake(

let end = INITIAL_READ + identify_len;

// Clippy for Rust 1.73 warns on this but there doesn't seem to be a
// better way to write it?
#[allow(clippy::unnecessary_unwrap)]
if identify.is_some() && !out_cursor.has_remaining() {
return Ok((read_sock, write_sock, identify.unwrap()));
}
Expand Down
2 changes: 1 addition & 1 deletion nexus/db-queries/src/db/datastore/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ impl DataStore {
.rev()
.find(|(_i, (_collection_id, nerrors))| *nerrors == 0);
let candidate = match last_completed_idx {
Some((i, _)) if i == 0 => candidates.iter().skip(1).next(),
Some((0, _)) => candidates.iter().skip(1).next(),
_ => candidates.iter().next(),
}
.map(|(collection_id, _nerrors)| *collection_id);
Expand Down
85 changes: 61 additions & 24 deletions openapi/wicketd.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,44 +131,31 @@
}
}
},
"/clear-update-state/{type}/{slot}": {
"/clear-update-state": {
"post": {
"summary": "Resets update state for a sled.",
"description": "Use this to clear update state after a failed update.",
"operationId": "post_clear_update_state",
"parameters": [
{
"in": "path",
"name": "slot",
"required": true,
"schema": {
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
{
"in": "path",
"name": "type",
"required": true,
"schema": {
"$ref": "#/components/schemas/SpType"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClearUpdateStateOptions"
"$ref": "#/components/schemas/ClearUpdateStateParams"
}
}
},
"required": true
},
"responses": {
"204": {
"description": "resource updated"
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClearUpdateStateResponse"
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
Expand Down Expand Up @@ -1014,6 +1001,56 @@
}
}
},
"ClearUpdateStateParams": {
"type": "object",
"properties": {
"options": {
"description": "Options for clearing update state",
"allOf": [
{
"$ref": "#/components/schemas/ClearUpdateStateOptions"
}
]
},
"targets": {
"description": "The SP identifiers to clear the update state for. Must be non-empty.",
"type": "array",
"items": {
"$ref": "#/components/schemas/SpIdentifier"
},
"uniqueItems": true
}
},
"required": [
"options",
"targets"
]
},
"ClearUpdateStateResponse": {
"type": "object",
"properties": {
"cleared": {
"description": "The SPs for which update data was cleared.",
"type": "array",
"items": {
"$ref": "#/components/schemas/SpIdentifier"
},
"uniqueItems": true
},
"no_update_data": {
"description": "The SPs that had no update state to clear.",
"type": "array",
"items": {
"$ref": "#/components/schemas/SpIdentifier"
},
"uniqueItems": true
}
},
"required": [
"cleared",
"no_update_data"
]
},
"CurrentRssUserConfig": {
"type": "object",
"properties": {
Expand Down
12 changes: 6 additions & 6 deletions package-manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ only_for_targets.image = "standard"
# 2. Copy dendrite.tar.gz from dendrite/out to omicron/out
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "559fad2f379900a05ced410944353c1d19100390"
source.sha256 = "ce14c1f0481b13ce47a25386a3b1e49d9570f4c1c31cad3f13c14f75b130dafa"
source.commit = "147b03901aa8305b5271e0133a09f628b8140949"
source.sha256 = "14fe7f904f963b50188d6e060106b63df6d061ca64238f7b21623c432b5944e3"
output.type = "zone"
output.intermediate_only = true

Expand All @@ -498,8 +498,8 @@ only_for_targets.image = "standard"
# 2. Copy the output zone image from dendrite/out to omicron/out
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "559fad2f379900a05ced410944353c1d19100390"
source.sha256 = "1a1246e2e596f36182eb6a5e402c272d0cd91aab351c5289cc4a29cb822c8888"
source.commit = "147b03901aa8305b5271e0133a09f628b8140949"
source.sha256 = "f3aa685e4096f8f6e2ea6c169f391dbb88707abcbf1d2bde29163d81736e8ec6"
output.type = "zone"
output.intermediate_only = true

Expand All @@ -516,8 +516,8 @@ only_for_targets.image = "standard"
# 2. Copy dendrite.tar.gz from dendrite/out to omicron/out/dendrite-softnpu.tar.gz
source.type = "prebuilt"
source.repo = "dendrite"
source.commit = "559fad2f379900a05ced410944353c1d19100390"
source.sha256 = "b9ff0f7f9e6193f4fa0aff77f7ec80f726f431ce1024a88021f207beb9079793"
source.commit = "147b03901aa8305b5271e0133a09f628b8140949"
source.sha256 = "dece729ce4127216fba48e9cfed90ec2e5a57ee4ca6c4afc5fa770de6ea636bf"
output.type = "zone"
output.intermediate_only = true

Expand Down
1 change: 1 addition & 0 deletions package/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ slog-async.workspace = true
slog-term.workspace = true
smf.workspace = true
strum.workspace = true
swrite.workspace = true
tar.workspace = true
tempfile.workspace = true
thiserror.workspace = true
Expand Down
12 changes: 6 additions & 6 deletions package/src/bin/omicron-package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use std::io::Write;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::sync::Arc;
use swrite::{swrite, SWrite};
use tokio::io::{AsyncReadExt, AsyncWriteExt, BufReader};
use tokio::process::Command;

Expand Down Expand Up @@ -153,12 +154,11 @@ async fn do_for_all_rust_packages(
})
.partition(|(_, release)| *release);

let features = config
.target
.0
.iter()
.map(|(name, value)| format!("{}-{} ", name, value))
.collect::<String>();
let features =
config.target.0.iter().fold(String::new(), |mut acc, (name, value)| {
swrite!(acc, "{}-{} ", name, value);
acc
});

// Execute all the release / debug packages at the same time.
if !release_pkgs.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
#
# We choose a specific toolchain (rather than "stable") for repeatability. The
# intent is to keep this up-to-date with recently-released stable Rust.
channel = "1.72.1"
channel = "1.73.0"
profile = "default"
4 changes: 2 additions & 2 deletions sled-agent/src/sled_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ impl SledAgent {
sz,
)?;
}
Some(sz) if sz == 0 => {
Some(0) => {
panic!("Invalid requested swap device size of 0 GiB");
}
None | Some(_) => {
Expand Down Expand Up @@ -375,7 +375,7 @@ impl SledAgent {
e
})?;
}
Some(sz) if sz == 0 => {
Some(0) => {
warn!(log, "Not using VMM reservoir (size 0 bytes requested)");
}
None => {
Expand Down
2 changes: 1 addition & 1 deletion sled-agent/src/zone_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ async fn find_service_log_files(
if path != current_log_file
&& path_ref.starts_with(current_log_file_ref)
{
log_files.push(path.clone().into());
log_files.push(path.into());
}
}

Expand Down
2 changes: 1 addition & 1 deletion tools/dendrite_openapi_version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
COMMIT="559fad2f379900a05ced410944353c1d19100390"
COMMIT="147b03901aa8305b5271e0133a09f628b8140949"
SHA2="82437c74afd4894aa5b9ea800d5777793e8777fe87471321dd22ad1a1c9c9ef3"
4 changes: 2 additions & 2 deletions tools/dendrite_stub_checksums
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CIDL_SHA256_ILLUMOS="ce14c1f0481b13ce47a25386a3b1e49d9570f4c1c31cad3f13c14f75b130dafa"
CIDL_SHA256_LINUX_DPD="d7da0aaed4e824a8e98b1a39e9ee41ad934ce38b0faa140ab4e7e2ca8c194e4e"
CIDL_SHA256_ILLUMOS="14fe7f904f963b50188d6e060106b63df6d061ca64238f7b21623c432b5944e3"
CIDL_SHA256_LINUX_DPD="fff6c7484bbb06aa644e3fe41b200e4f7f8d7f65d067cbecd851c834c15fe2ec"
CIDL_SHA256_LINUX_SWADM="0449383a57468aec3b5a4ad26962cfc9e9a121bd13e777329e8a70767e6d9aae"
2 changes: 1 addition & 1 deletion wicket-common/src/update_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ pub enum UpdateTerminalError {
#[source]
error: anyhow::Error,
},
#[error("failed to find correctly-singed RoT image")]
#[error("failed to find correctly-signed RoT image")]
FailedFindingSignedRotImage {
#[source]
error: anyhow::Error,
Expand Down
22 changes: 12 additions & 10 deletions wicket/src/wicketd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ use std::net::SocketAddrV6;
use tokio::sync::mpsc::{self, Sender, UnboundedSender};
use tokio::time::{interval, Duration, MissedTickBehavior};
use wicketd_client::types::{
AbortUpdateOptions, ClearUpdateStateOptions, GetInventoryParams,
GetInventoryResponse, GetLocationResponse, IgnitionCommand, SpIdentifier,
SpType, StartUpdateOptions, StartUpdateParams,
AbortUpdateOptions, ClearUpdateStateOptions, ClearUpdateStateParams,
GetInventoryParams, GetInventoryResponse, GetLocationResponse,
IgnitionCommand, SpIdentifier, SpType, StartUpdateOptions,
StartUpdateParams,
};

use crate::events::EventReportMap;
Expand Down Expand Up @@ -229,14 +230,15 @@ impl WicketdManager {
tokio::spawn(async move {
let update_client =
create_wicketd_client(&log, addr, WICKETD_TIMEOUT);
let sp: SpIdentifier = component_id.into();
let response = match update_client
.post_clear_update_state(sp.type_, sp.slot, &options)
.await
{
Ok(_) => Ok(()),
Err(error) => Err(error.to_string()),
let params = ClearUpdateStateParams {
targets: vec![component_id.into()],
options,
};
let response =
match update_client.post_clear_update_state(&params).await {
Ok(_) => Ok(()),
Err(error) => Err(error.to_string()),
};

slog::info!(
log,
Expand Down
42 changes: 33 additions & 9 deletions wicketd/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,13 +708,31 @@ pub(crate) enum UpdateSimulatedResult {
Failure,
}

#[derive(Clone, Debug, JsonSchema, Deserialize)]
pub(crate) struct ClearUpdateStateParams {
/// The SP identifiers to clear the update state for. Must be non-empty.
pub(crate) targets: BTreeSet<SpIdentifier>,

/// Options for clearing update state
pub(crate) options: ClearUpdateStateOptions,
}

#[derive(Clone, Debug, JsonSchema, Deserialize)]
pub(crate) struct ClearUpdateStateOptions {
/// If passed in, fails the clear update state operation with a simulated
/// error.
pub(crate) test_error: Option<UpdateTestError>,
}

#[derive(Clone, Debug, Default, JsonSchema, Serialize)]
pub(crate) struct ClearUpdateStateResponse {
/// The SPs for which update data was cleared.
pub(crate) cleared: BTreeSet<SpIdentifier>,

/// The SPs that had no update state to clear.
pub(crate) no_update_data: BTreeSet<SpIdentifier>,
}

#[derive(Clone, Debug, JsonSchema, Deserialize)]
pub(crate) struct AbortUpdateOptions {
/// The message to abort the update with.
Expand Down Expand Up @@ -1080,25 +1098,31 @@ async fn post_abort_update(
/// Use this to clear update state after a failed update.
#[endpoint {
method = POST,
path = "/clear-update-state/{type}/{slot}",
path = "/clear-update-state",
}]
async fn post_clear_update_state(
rqctx: RequestContext<ServerContext>,
target: Path<SpIdentifier>,
opts: TypedBody<ClearUpdateStateOptions>,
) -> Result<HttpResponseUpdatedNoContent, HttpError> {
params: TypedBody<ClearUpdateStateParams>,
) -> Result<HttpResponseOk<ClearUpdateStateResponse>, HttpError> {
let log = &rqctx.log;
let target = target.into_inner();
let rqctx = rqctx.context();
let params = params.into_inner();

let opts = opts.into_inner();
if let Some(test_error) = opts.test_error {
if params.targets.is_empty() {
return Err(HttpError::for_bad_request(
None,
"No targets specified".into(),
));
}

if let Some(test_error) = params.options.test_error {
return Err(test_error
.into_http_error(log, "clearing update state")
.await);
}

match rqctx.context().update_tracker.clear_update_state(target).await {
Ok(()) => Ok(HttpResponseUpdatedNoContent {}),
match rqctx.update_tracker.clear_update_state(params.targets).await {
Ok(response) => Ok(HttpResponseOk(response)),
Err(err) => Err(err.to_http_error()),
}
}
Expand Down
Loading

0 comments on commit 7a41675

Please sign in to comment.