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

initial inventory for automated update #4291

Merged
merged 21 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
26 changes: 26 additions & 0 deletions Cargo.lock

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

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ members = [
"nexus/db-model",
"nexus/db-queries",
"nexus/defaults",
"nexus/inventory",
"nexus/test-interface",
"nexus/test-utils-macros",
"nexus/test-utils",
Expand Down Expand Up @@ -108,6 +109,7 @@ default-members = [
"nexus/db-model",
"nexus/db-queries",
"nexus/defaults",
"nexus/inventory",
"nexus/types",
"oximeter/collector",
"oximeter/db",
Expand Down Expand Up @@ -234,6 +236,7 @@ nexus-client = { path = "clients/nexus-client" }
nexus-db-model = { path = "nexus/db-model" }
nexus-db-queries = { path = "nexus/db-queries" }
nexus-defaults = { path = "nexus/defaults" }
nexus-inventory = { path = "nexus/inventory" }
omicron-certificates = { path = "certificates" }
omicron-passwords = { path = "passwords" }
omicron-workspace-hack = "0.1.0"
Expand Down Expand Up @@ -372,8 +375,8 @@ tufaceous = { path = "tufaceous" }
tufaceous-lib = { path = "tufaceous-lib" }
unicode-width = "0.1.11"
update-engine = { path = "update-engine" }
uuid = { version = "1.4.1", features = ["serde", "v4"] }
usdt = "0.3"
uuid = { version = "1.4.1", features = ["serde", "v4"] }
walkdir = "2.4"
wicket = { path = "wicket" }
wicket-common = { path = "wicket-common" }
Expand Down
52 changes: 43 additions & 9 deletions common/src/nexus_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ pub struct BackgroundTaskConfig {
pub dns_external: DnsTasksConfig,
/// configuration for external endpoint list watcher
pub external_endpoints: ExternalEndpointsConfig,
/// configuration for inventory tasks
pub inventory: InventoryConfig,
}

#[serde_as]
Expand Down Expand Up @@ -369,6 +371,30 @@ pub struct ExternalEndpointsConfig {
// allow/disallow wildcard certs, don't serve expired certs, etc.)
}

#[serde_as]
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct InventoryConfig {
/// period (in seconds) for periodic activations of this background task
///
/// Each activation fetches information about all harware and software in
/// the system and inserts it into the database. This generates a moderate
/// amount of data.
#[serde_as(as = "DurationSeconds<u64>")]
pub period_secs: Duration,

/// maximum number of past collections to keep in the database
///
/// This is a very coarse mechanism to keep the system from overwhelming
/// itself with inventory data.
pub nkeep: u32,

/// disable inventory collection altogether
///
/// This is an emergency lever for support / operations. It should never be
/// necessary.
pub disable: bool,
}

/// Configuration for a nexus server
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct PackageConfig {
Expand Down Expand Up @@ -467,19 +493,16 @@ impl std::fmt::Display for SchemeName {

#[cfg(test)]
mod test {
use super::Tunables;
use super::{
default_techport_external_server_port, AuthnConfig, Config,
ConsoleConfig, LoadError, PackageConfig, SchemeName,
TimeseriesDbConfig, UpdatesConfig,
default_techport_external_server_port, AuthnConfig,
BackgroundTaskConfig, Config, ConfigDropshotWithTls, ConsoleConfig,
Database, DeploymentConfig, DnsTasksConfig, DpdConfig,
ExternalEndpointsConfig, InternalDns, InventoryConfig, LoadError,
LoadErrorKind, MgdConfig, PackageConfig, SchemeName,
TimeseriesDbConfig, Tunables, UpdatesConfig,
};
use crate::address::{Ipv6Subnet, RACK_PREFIX};
use crate::api::internal::shared::SwitchLocation;
use crate::nexus_config::{
BackgroundTaskConfig, ConfigDropshotWithTls, Database,
DeploymentConfig, DnsTasksConfig, DpdConfig, ExternalEndpointsConfig,
InternalDns, LoadErrorKind, MgdConfig,
};
use dropshot::ConfigDropshot;
use dropshot::ConfigLogging;
use dropshot::ConfigLoggingIfExists;
Expand Down Expand Up @@ -626,6 +649,9 @@ mod test {
dns_external.period_secs_propagation = 7
dns_external.max_concurrent_server_updates = 8
external_endpoints.period_secs = 9
inventory.period_secs = 10
inventory.nkeep = 11
inventory.disable = false
[default_region_allocation_strategy]
type = "random"
seed = 0
Expand Down Expand Up @@ -719,6 +745,11 @@ mod test {
},
external_endpoints: ExternalEndpointsConfig {
period_secs: Duration::from_secs(9),
},
inventory: InventoryConfig {
period_secs: Duration::from_secs(10),
nkeep: 11,
disable: false,
}
},
default_region_allocation_strategy:
Expand Down Expand Up @@ -773,6 +804,9 @@ mod test {
dns_external.period_secs_propagation = 7
dns_external.max_concurrent_server_updates = 8
external_endpoints.period_secs = 9
inventory.period_secs = 10
inventory.nkeep = 3
inventory.disable = false
[default_region_allocation_strategy]
type = "random"
"##,
Expand Down
Loading
Loading