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

[sled-diagnostics] Add pfiles output #7258

Merged
Merged
Show file tree
Hide file tree
Changes from 5 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
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.

175 changes: 166 additions & 9 deletions openapi/sled-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -678,10 +678,16 @@
"operationId": "support_dladm_info",
"responses": {
"200": {
"description": "",
"description": "successful operation",
"content": {
"*/*": {
"schema": {}
"application/json": {
"schema": {
"title": "Array_of_SledDiagnosticsQueryOutput",
"type": "array",
"items": {
"$ref": "#/components/schemas/SledDiagnosticsQueryOutput"
}
}
}
}
},
Expand All @@ -699,10 +705,97 @@
"operationId": "support_ipadm_info",
"responses": {
"200": {
"description": "",
"description": "successful operation",
"content": {
"*/*": {
"schema": {}
"application/json": {
"schema": {
"title": "Array_of_SledDiagnosticsQueryOutput",
"type": "array",
"items": {
"$ref": "#/components/schemas/SledDiagnosticsQueryOutput"
}
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/support/pargs-info": {
"get": {
"operationId": "support_pargs_info",
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"title": "Array_of_SledDiagnosticsQueryOutput",
"type": "array",
"items": {
"$ref": "#/components/schemas/SledDiagnosticsQueryOutput"
}
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/support/pfiles-info": {
"get": {
"operationId": "support_pfiles_info",
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"title": "Array_of_SledDiagnosticsQueryOutput",
"type": "array",
"items": {
"$ref": "#/components/schemas/SledDiagnosticsQueryOutput"
}
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/support/pstack-info": {
"get": {
"operationId": "support_pstack_info",
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"title": "Array_of_SledDiagnosticsQueryOutput",
"type": "array",
"items": {
"$ref": "#/components/schemas/SledDiagnosticsQueryOutput"
}
}
}
}
},
Expand All @@ -720,10 +813,12 @@
"operationId": "support_zoneadm_info",
"responses": {
"200": {
"description": "",
"description": "successful operation",
"content": {
"*/*": {
"schema": {}
"application/json": {
"schema": {
"$ref": "#/components/schemas/SledDiagnosticsQueryOutput"
}
}
}
},
Expand Down Expand Up @@ -5527,6 +5622,68 @@
"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": [
{
"type": "object",
"properties": {
"success": {
"type": "object",
"properties": {
"command": {
"description": "The command and its arguments.",
"type": "string"
},
"exit_code": {
"nullable": true,
"description": "The exit code if one was present when the command exited.",
"type": "integer",
"format": "int32"
},
"exit_status": {
"description": "The exit status of the command. This will be the exit code (if any) and exit reason such as from a signal.",
"type": "string"
},
"stdio": {
"description": "Any stdout/stderr produced by the command.",
"type": "string"
}
},
"required": [
"command",
"exit_status",
"stdio"
]
}
},
"required": [
"success"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"failure": {
"type": "object",
"properties": {
"error": {
"description": "The reason the command failed to execute.",
"type": "string"
}
},
"required": [
"error"
]
}
},
"required": [
"failure"
],
"additionalProperties": false
}
]
},
"SledIdentifiers": {
"description": "Identifiers for a single sled.\n\nThis is intended primarily to be used in timeseries, to identify sled from which metric data originates.",
"type": "object",
Expand Down
1 change: 1 addition & 0 deletions sled-agent/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ schemars.workspace = true
serde.workspace = true
sled-agent-types.workspace = true
sled-hardware-types.workspace = true
sled-diagnostics.workspace = true
uuid.workspace = true
31 changes: 28 additions & 3 deletions sled-agent/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ use sled_agent_types::{
ZoneBundleId, ZoneBundleMetadata,
},
};
use sled_diagnostics::SledDiagnosticsQueryOutput;
use uuid::Uuid;

#[dropshot::api_description]
Expand Down Expand Up @@ -630,23 +631,47 @@ pub trait SledAgentApi {
}]
async fn support_zoneadm_info(
request_context: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<FreeformBody>, HttpError>;
) -> Result<HttpResponseOk<SledDiagnosticsQueryOutput>, HttpError>;

#[endpoint {
method = GET,
path = "/support/ipadm-info",
}]
async fn support_ipadm_info(
request_context: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<FreeformBody>, HttpError>;
) -> Result<HttpResponseOk<Vec<SledDiagnosticsQueryOutput>>, HttpError>;

#[endpoint {
method = GET,
path = "/support/dladm-info",
}]
async fn support_dladm_info(
request_context: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<FreeformBody>, HttpError>;
) -> Result<HttpResponseOk<Vec<SledDiagnosticsQueryOutput>>, HttpError>;

#[endpoint {
method = GET,
path = "/support/pargs-info",
}]
async fn support_pargs_info(
request_context: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<Vec<SledDiagnosticsQueryOutput>>, HttpError>;

#[endpoint {
method = GET,
path = "/support/pstack-info",
}]
async fn support_pstack_info(
request_context: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<Vec<SledDiagnosticsQueryOutput>>, HttpError>;

#[endpoint {
method = GET,
path = "/support/pfiles-info",
}]
async fn support_pfiles_info(
request_context: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<Vec<SledDiagnosticsQueryOutput>>, HttpError>;
}

#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)]
Expand Down
Loading
Loading