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

update to hyper v1 #745

Merged
merged 16 commits into from
Sep 27, 2024
838 changes: 652 additions & 186 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ clap = "4.2"
const_format = "0.2"
crossbeam-channel = "0.5"
ctrlc = "3.2"
dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main" }
dropshot = "0.12.0"
erased-serde = "0.4"
errno = "0.2.8"
escargot = "0.5.8"
Expand All @@ -116,8 +116,8 @@ futures = "0.3"
futures-util = "0.3.21"
flate2 = "1.0.28"
hex = "0.4.3"
http = "0.2.9"
hyper = "0.14"
http = "1.1.0"
hyper = "1.0"
indicatif = "0.17.3"
inventory = "0.3.0"
kstat-rs = "0.2.4"
Expand All @@ -130,10 +130,10 @@ owo-colors = "4"
pin-project-lite = "0.2.13"
proc-macro2 = "1.0"
proc-macro-error = "1"
progenitor = { git = "https://github.com/oxidecomputer/progenitor", branch = "main" }
progenitor = "0.8.0"
quote = "1.0"
rand = "0.8"
reqwest = { version = "0.11.18", default-features = false }
reqwest = { version = "0.12.0", default-features = false }
ring = "0.17"
ron = "0.8"
schemars = "0.8.10"
Expand Down
4 changes: 2 additions & 2 deletions bin/mock-server/src/lib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,15 @@ mod serial {
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;

use dropshot::WebsocketConnectionRaw;
use futures::StreamExt;
use hyper::upgrade::Upgraded;
use tokio::sync::{mpsc, Notify};
use tokio_tungstenite::tungstenite::protocol::{
frame::coding::CloseCode, CloseFrame,
};
use tokio_tungstenite::WebSocketStream;

type WsConn = WebSocketStream<Upgraded>;
type WsConn = WebSocketStream<WebsocketConnectionRaw>;

const DEFAULT_MAX_LEN: usize = 1024;

Expand Down
1 change: 0 additions & 1 deletion bin/propolis-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ crucible-client-types.workspace = true
dropshot = { workspace = true, features = ["usdt-probes"] }
erased-serde.workspace = true
futures.workspace = true
http.workspace = true
hyper.workspace = true
internal-dns.workspace = true
kstat-rs.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion bin/propolis-server/src/lib/migrate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(crate) trait MigrateConn:
}

impl MigrateConn for tokio_tungstenite::MaybeTlsStream<tokio::net::TcpStream> {}
impl MigrateConn for hyper::upgrade::Upgraded {}
impl MigrateConn for dropshot::WebsocketConnectionRaw {}

#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub enum MigrateRole {
Expand Down
14 changes: 9 additions & 5 deletions bin/propolis-server/src/lib/serial/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use crate::serial::history_buffer::{HistoryBuffer, SerialHistoryOffset};
use futures::future::Fuse;
use futures::stream::SplitSink;
use futures::{FutureExt, SinkExt, StreamExt};
use hyper::upgrade::Upgraded;
use propolis::chardev::{pollers, Sink, Source};
use propolis_api_types::InstanceSerialConsoleControlMessage;
use slog::{info, warn, Logger};
Expand Down Expand Up @@ -78,11 +77,14 @@ pub struct SerialTask {
/// clients of a migration
pub control_ch: mpsc::Sender<SerialTaskControlMessage>,
/// Channel used to send new client connections to the streaming task
pub websocks_ch: mpsc::Sender<WebSocketStream<Upgraded>>,
pub websocks_ch:
mpsc::Sender<WebSocketStream<dropshot::WebsocketConnectionRaw>>,
}

pub async fn instance_serial_task<Device: Sink + Source>(
mut websocks_recv: mpsc::Receiver<WebSocketStream<Upgraded>>,
mut websocks_recv: mpsc::Receiver<
WebSocketStream<dropshot::WebsocketConnectionRaw>,
>,
mut control_recv: mpsc::Receiver<SerialTaskControlMessage>,
serial: Arc<Serial<Device>>,
log: Logger,
Expand All @@ -94,11 +96,13 @@ pub async fn instance_serial_task<Device: Sink + Source>(

let mut ws_sinks: HashMap<
usize,
SplitSink<WebSocketStream<Upgraded>, Message>,
SplitSink<WebSocketStream<dropshot::WebsocketConnectionRaw>, Message>,
> = HashMap::new();
let mut ws_streams: HashMap<
usize,
futures::stream::SplitStream<WebSocketStream<Upgraded>>,
futures::stream::SplitStream<
WebSocketStream<dropshot::WebsocketConnectionRaw>,
>,
> = HashMap::new();

let (send_ch, mut recv_ch) = mpsc::channel(4);
Expand Down
10 changes: 5 additions & 5 deletions bin/propolis-server/src/lib/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ async fn instance_ensure_common(
| VmError::AlreadyInitialized
| VmError::RundownInProgress => HttpError::for_client_error(
Some(api::ErrorCode::AlreadyInitialized.to_string()),
http::StatusCode::CONFLICT,
hyper::StatusCode::CONFLICT,
"instance already initialized".to_string(),
),
VmError::InitializationFailed(e) => HttpError::for_internal_error(
Expand Down Expand Up @@ -409,7 +409,7 @@ async fn instance_state_monitor(
state_watcher.changed().await.map_err(|_| {
HttpError::for_client_error(
Some(api::ErrorCode::NoInstance.to_string()),
http::status::StatusCode::GONE,
hyper::StatusCode::GONE,
format!(
"No instance present; will never reach generation {}",
gen
Expand Down Expand Up @@ -439,7 +439,7 @@ async fn instance_state_put(
}
VmError::ForbiddenStateChange(reason) => HttpError::for_status(
Some(format!("instance state change not allowed: {}", reason)),
http::status::StatusCode::FORBIDDEN,
hyper::StatusCode::FORBIDDEN,
),
_ => HttpError::for_internal_error(format!(
"unexpected error from VM controller: {e}"
Expand Down Expand Up @@ -693,7 +693,7 @@ async fn instance_issue_crucible_vcr_request(
.map_err(|e| match e {
VmError::ForbiddenStateChange(reason) => HttpError::for_status(
Some(format!("instance state change not allowed: {}", reason)),
http::status::StatusCode::FORBIDDEN,
hyper::StatusCode::FORBIDDEN,
),
_ => HttpError::for_internal_error(format!(
"unexpected error from VM controller: {e}"
Expand Down Expand Up @@ -749,7 +749,7 @@ pub fn api() -> ApiDescription<Arc<DropshotEndpointContext>> {
fn not_created_error() -> HttpError {
HttpError::for_client_error(
Some(api::ErrorCode::NoInstance.to_string()),
http::StatusCode::FAILED_DEPENDENCY,
hyper::StatusCode::FAILED_DEPENDENCY,
"Server not initialized (no instance)".to_string(),
)
}
Expand Down
2 changes: 1 addition & 1 deletion bin/propolis-server/src/lib/vm/request_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ impl Drop for ExternalRequestQueue {
"VM destroyed before request could be handled"
.to_string(),
),
http::StatusCode::GONE,
hyper::StatusCode::GONE,
)));
}

Expand Down
1 change: 0 additions & 1 deletion phd-tests/framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ fatfs.workspace = true
futures.workspace = true
flate2.workspace = true
hex.workspace = true
http.workspace = true
libc.workspace = true
newtype_derive.workspace = true
propolis-client.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion phd-tests/framework/src/test_vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ async fn try_ensure_vm_destroyed(client: &Client) {
// nothing else that *can* be done, but the error is unusual and should
// be logged.
match error.status() {
Some(http::status::StatusCode::FAILED_DEPENDENCY) => {}
Some(reqwest::StatusCode::FAILED_DEPENDENCY) => {}
_ => {
error!(
%error,
Expand Down
1 change: 1 addition & 0 deletions phd-tests/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ futures.workspace = true
http.workspace = true
propolis-client.workspace = true
phd-testcase.workspace = true
reqwest.workspace = true
tracing.workspace = true
uuid.workspace = true
6 changes: 3 additions & 3 deletions phd-tests/tests/src/server_state_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ async fn instance_stop_causes_destroy_test(ctx: &Framework) {

assert!(matches!(
vm.run().await.unwrap_err().status().unwrap(),
http::status::StatusCode::FAILED_DEPENDENCY
reqwest::StatusCode::FAILED_DEPENDENCY
));
assert!(matches!(
vm.stop().await.unwrap_err().status().unwrap(),
http::status::StatusCode::FAILED_DEPENDENCY
reqwest::StatusCode::FAILED_DEPENDENCY
));
assert!(matches!(
vm.reset().await.unwrap_err().status().unwrap(),
http::status::StatusCode::FAILED_DEPENDENCY
reqwest::StatusCode::FAILED_DEPENDENCY
));
}

Expand Down
Loading