Skip to content

Commit 575e66a

Browse files
committed
WIP: update to hyper v1
1 parent 64350cd commit 575e66a

File tree

12 files changed

+331
-143
lines changed

12 files changed

+331
-143
lines changed

Cargo.lock

Lines changed: 305 additions & 120 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ clap = "4.2"
106106
const_format = "0.2"
107107
crossbeam-channel = "0.5"
108108
ctrlc = "3.2"
109-
dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main" }
109+
# dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main" }
110+
dropshot = { git = "https://github.com/seanmonstar/dropshot", branch = "hyper-v1-2.4-own-body" }
110111
erased-serde = "0.4"
111112
errno = "0.2.8"
112113
escargot = "0.5.8"
@@ -116,8 +117,8 @@ futures = "0.3"
116117
futures-util = "0.3.21"
117118
flate2 = "1.0.28"
118119
hex = "0.4.3"
119-
http = "0.2.9"
120-
hyper = "0.14"
120+
http = "1.1.0"
121+
hyper = "1.0"
121122
indicatif = "0.17.3"
122123
inventory = "0.3.0"
123124
kstat-rs = "0.2.3"

bin/mock-server/src/lib/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,15 +397,15 @@ mod serial {
397397
use std::sync::atomic::{AtomicBool, Ordering};
398398
use std::sync::Arc;
399399

400+
use dropshot::WebsocketConnectionRaw;
400401
use futures::StreamExt;
401-
use hyper::upgrade::Upgraded;
402402
use tokio::sync::{mpsc, Notify};
403403
use tokio_tungstenite::tungstenite::protocol::{
404404
frame::coding::CloseCode, CloseFrame,
405405
};
406406
use tokio_tungstenite::WebSocketStream;
407407

408-
type WsConn = WebSocketStream<Upgraded>;
408+
type WsConn = WebSocketStream<WebsocketConnectionRaw>;
409409

410410
const DEFAULT_MAX_LEN: usize = 1024;
411411

bin/propolis-server/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ crucible-client-types.workspace = true
3030
dropshot = { workspace = true, features = ["usdt-probes"] }
3131
erased-serde.workspace = true
3232
futures.workspace = true
33-
http.workspace = true
3433
hyper.workspace = true
3534
internal-dns.workspace = true
3635
kstat-rs.workspace = true

bin/propolis-server/src/lib/migrate/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub(crate) trait MigrateConn:
2525
}
2626

2727
impl MigrateConn for tokio_tungstenite::MaybeTlsStream<tokio::net::TcpStream> {}
28-
impl MigrateConn for hyper::upgrade::Upgraded {}
28+
impl MigrateConn for dropshot::WebsocketConnectionRaw {}
2929

3030
#[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
3131
pub enum MigrateRole {

bin/propolis-server/src/lib/serial/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ use std::sync::Arc;
1414
use std::time::Duration;
1515

1616
use crate::serial::history_buffer::{HistoryBuffer, SerialHistoryOffset};
17+
use dropshot::WebsocketConnectionRaw;
1718
use futures::future::Fuse;
1819
use futures::stream::SplitSink;
1920
use futures::{FutureExt, SinkExt, StreamExt};
20-
use hyper::upgrade::Upgraded;
2121
use propolis::chardev::{pollers, Sink, Source};
2222
use propolis_api_types::InstanceSerialConsoleControlMessage;
2323
use slog::{info, warn, Logger};
@@ -78,11 +78,14 @@ pub struct SerialTask {
7878
/// clients of a migration
7979
pub control_ch: mpsc::Sender<SerialTaskControlMessage>,
8080
/// Channel used to send new client connections to the streaming task
81-
pub websocks_ch: mpsc::Sender<WebSocketStream<Upgraded>>,
81+
pub websocks_ch:
82+
mpsc::Sender<WebSocketStream<dropshot::WebsocketConnectionRaw>>,
8283
}
8384

8485
pub async fn instance_serial_task<Device: Sink + Source>(
85-
mut websocks_recv: mpsc::Receiver<WebSocketStream<Upgraded>>,
86+
mut websocks_recv: mpsc::Receiver<
87+
WebSocketStream<dropshot::WebsocketConnectionRaw>,
88+
>,
8689
mut control_recv: mpsc::Receiver<SerialTaskControlMessage>,
8790
serial: Arc<Serial<Device>>,
8891
log: Logger,
@@ -94,11 +97,11 @@ pub async fn instance_serial_task<Device: Sink + Source>(
9497

9598
let mut ws_sinks: HashMap<
9699
usize,
97-
SplitSink<WebSocketStream<Upgraded>, Message>,
100+
SplitSink<WebSocketStream<dropshot::WebsocketConnectionRaw>, Message>,
98101
> = HashMap::new();
99102
let mut ws_streams: HashMap<
100103
usize,
101-
futures::stream::SplitStream<WebSocketStream<Upgraded>>,
104+
futures::stream::SplitStream<WebSocketStream<WebsocketConnectionRaw>>,
102105
> = HashMap::new();
103106

104107
let (send_ch, mut recv_ch) = mpsc::channel(4);

bin/propolis-server/src/lib/server.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ async fn instance_ensure_common(
258258
| VmError::AlreadyInitialized
259259
| VmError::RundownInProgress => HttpError::for_client_error(
260260
Some(api::ErrorCode::AlreadyInitialized.to_string()),
261-
http::StatusCode::CONFLICT,
261+
hyper::StatusCode::CONFLICT,
262262
"instance already initialized".to_string(),
263263
),
264264
VmError::InitializationFailed(e) => HttpError::for_internal_error(
@@ -390,7 +390,7 @@ async fn instance_state_monitor(
390390
state_watcher.changed().await.map_err(|_| {
391391
HttpError::for_client_error(
392392
Some(api::ErrorCode::NoInstance.to_string()),
393-
http::status::StatusCode::GONE,
393+
hyper::StatusCode::GONE,
394394
format!(
395395
"No instance present; will never reach generation {}",
396396
gen
@@ -420,7 +420,7 @@ async fn instance_state_put(
420420
}
421421
VmError::ForbiddenStateChange(reason) => HttpError::for_status(
422422
Some(format!("instance state change not allowed: {}", reason)),
423-
http::status::StatusCode::FORBIDDEN,
423+
hyper::StatusCode::FORBIDDEN,
424424
),
425425
_ => HttpError::for_internal_error(format!(
426426
"unexpected error from VM controller: {e}"
@@ -674,7 +674,7 @@ async fn instance_issue_crucible_vcr_request(
674674
.map_err(|e| match e {
675675
VmError::ForbiddenStateChange(reason) => HttpError::for_status(
676676
Some(format!("instance state change not allowed: {}", reason)),
677-
http::status::StatusCode::FORBIDDEN,
677+
hyper::StatusCode::FORBIDDEN,
678678
),
679679
_ => HttpError::for_internal_error(format!(
680680
"unexpected error from VM controller: {e}"
@@ -730,7 +730,7 @@ pub fn api() -> ApiDescription<Arc<DropshotEndpointContext>> {
730730
fn not_created_error() -> HttpError {
731731
HttpError::for_client_error(
732732
Some(api::ErrorCode::NoInstance.to_string()),
733-
http::StatusCode::FAILED_DEPENDENCY,
733+
hyper::StatusCode::FAILED_DEPENDENCY,
734734
"Server not initialized (no instance)".to_string(),
735735
)
736736
}

bin/propolis-server/src/lib/vm/request_queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ impl Drop for ExternalRequestQueue {
433433
"VM destroyed before request could be handled"
434434
.to_string(),
435435
),
436-
http::StatusCode::GONE,
436+
hyper::StatusCode::GONE,
437437
)));
438438
}
439439

phd-tests/framework/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ fatfs.workspace = true
2020
futures.workspace = true
2121
flate2.workspace = true
2222
hex.workspace = true
23-
http.workspace = true
2423
libc.workspace = true
2524
newtype_derive.workspace = true
2625
propolis-client.workspace = true

phd-tests/framework/src/test_vm/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ async fn try_ensure_vm_destroyed(client: &Client) {
985985
// nothing else that *can* be done, but the error is unusual and should
986986
// be logged.
987987
match error.status() {
988-
Some(http::status::StatusCode::FAILED_DEPENDENCY) => {}
988+
Some(reqwest::StatusCode::FAILED_DEPENDENCY) => {}
989989
_ => {
990990
error!(
991991
%error,

0 commit comments

Comments
 (0)