-
Notifications
You must be signed in to change notification settings - Fork 5
make mg-admin and ddm-admin APIs versioned #558
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,14 +8,14 @@ use bgp::params::*; | |
| use bgp_admin::BgpContext; | ||
| use dropshot::{ | ||
| ApiDescription, ConfigDropshot, HttpError, HttpResponseDeleted, | ||
| HttpResponseOk, HttpResponseUpdatedNoContent, HttpServerStarter, Path, | ||
| Query, RequestContext, TypedBody, | ||
| HttpResponseOk, HttpResponseUpdatedNoContent, Path, Query, RequestContext, | ||
| TypedBody, | ||
| }; | ||
| use mg_api::*; | ||
| use mg_common::stats::MgLowerStats; | ||
| use rdb::{BfdPeerConfig, Db, Prefix}; | ||
| use slog::o; | ||
| use slog::{Logger, error, info, warn}; | ||
| use slog::{Logger, error, info}; | ||
| use std::collections::HashMap; | ||
| use std::net::{IpAddr, Ipv6Addr, SocketAddr}; | ||
| use std::sync::{Arc, Mutex}; | ||
|
|
@@ -49,14 +49,26 @@ pub fn start_server( | |
|
|
||
| let api = api_description(); | ||
|
|
||
| let server = HttpServerStarter::new(&ds_config, api, context, &ds_log) | ||
| .map_err(|e| format!("new admin dropshot: {}", e))?; | ||
| let server = dropshot::ServerBuilder::new(api, context, ds_log) | ||
| .config(ds_config) | ||
| .version_policy(dropshot::VersionPolicy::Dynamic(Box::new( | ||
| dropshot::ClientSpecifiesVersionInHeader::new( | ||
| omicron_common::api::VERSION_HEADER, | ||
| mg_api::latest_version(), | ||
| ), | ||
| ))); | ||
|
|
||
| info!(log, "admin: listening on {}", sa); | ||
|
|
||
| Ok(tokio::spawn(async move { | ||
| match server.start().await { | ||
| Ok(_) => warn!(log, "admin: unexpected server exit"), | ||
| match server.start() { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also needs to be something like match server.start().expect("failed to start API server").await
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah yeah, whoops |
||
| Ok(server) => { | ||
| info!(log, "admin: server started"); | ||
| match server.await { | ||
| Ok(()) => info!(log, "admin: server exited"), | ||
| Err(e) => error!(log, "admin: server error {:?}", e), | ||
| } | ||
| } | ||
| Err(e) => error!(log, "admin: server start error {:?}", e), | ||
| } | ||
| })) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| "url": "https://oxide.computer", | ||
| "email": "[email protected]" | ||
| }, | ||
| "version": "0.1.0" | ||
| "version": "1.0.0" | ||
| }, | ||
| "paths": { | ||
| "/disable-stats": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ddm-admin-1.0.0-b6eac7.json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| "url": "https://oxide.computer", | ||
| "email": "[email protected]" | ||
| }, | ||
| "version": "0.1.0" | ||
| "version": "1.0.0" | ||
| }, | ||
| "paths": { | ||
| "/bestpath/config/fanout": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| mg-admin-1.0.0-69e2d5.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe dropping the
awaitis what's causing the test failures. The logs show the "unexpected server exit line". This code expects to wait on the API server, which never really returns.Probably want something like this