-
Notifications
You must be signed in to change notification settings - Fork 39
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
[nexus] Expunge disk internal API, omdb commands #5994
Merged
Merged
Changes from 74 commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
cee78bc
Start requiring zone filesystem argument
smklein 3be4b6e
Deprecate the old service format
smklein 8756076
Merge branch 'main' into nexus-zone-filesystems-2
smklein 0aac450
Merge branch 'deprecate-services-migration' into nexus-zone-filesyste…
smklein 3833549
Plumbing through filesystem_pool, still need to make it optional
smklein aea4bdb
Merge branch 'main' into deprecate-services-migration
smklein b58352f
review feedback
smklein a04e9c7
no bail just warn
smklein 4615f1b
Merge branch 'deprecate-services-migration' into nexus-zone-filesyste…
smklein 9f09c32
Merge branch 'main' into deprecate-services-migration
smklein 9db3042
Merge branch 'deprecate-services-migration' into nexus-zone-filesyste…
smklein a96fc81
optional value
smklein 9858dbf
are we optional yet
smklein f1e6f7a
lie about filesystem_pools for simulated sled agent
smklein 8a9ade7
Patch test_builder_zones
smklein d7c462c
Fix test_silos_external_dns_end_to_end
smklein 3c59610
patch v3 schema
smklein 1270098
Patch blueprint edit
smklein f48fba3
Add schema change
smklein 684932d
fmt
smklein 87b8df9
Merge branch 'main' into nexus-zone-filesystems-2
smklein 52406a6
helios tests
smklein acaf91f
Merge branch 'main' into nexus-zone-filesystems-2
smklein b1339d4
Cleanup
smklein fcea2f1
Merge branch 'main' into nexus-zone-filesystems-2
smklein 53027a3
only pick in-service zpools from reconfigurator - regression test wanted
smklein ae41399
Merge zpool selection fns
smklein 5b38070
Add colocation test
smklein f0ab1c2
Merge branch 'main' into nexus-zone-filesystems-2
smklein b883eec
Ensure expunged disks are not in use after omicron_physical_disks_ensure
smklein 83c7cdf
Fix tests, add comments
smklein 6869d92
Zone bundler
smklein 4292158
Plumb 'PathInPool' structure
smklein 17db428
Destroy instances
smklein 32596df
Remove unused zone code
smklein d83a553
Merge branch 'main' into nexus-zone-filesystems-2
smklein d6618e7
Merge branch 'nexus-zone-filesystems-2' into physical_disks_ensure_le…
smklein 2c6eb01
fix helios tests
smklein e4123a9
Add TODO, re: concurrency safety
smklein 98278d4
Merge branch 'main' into nexus-zone-filesystems-2
smklein fa91e75
Merge branch 'nexus-zone-filesystems-2' into physical_disks_ensure_le…
smklein 1207c9e
very WIP - adjusting generation
smklein 892a7ca
Stop self-managing disks
smklein 15b8d21
Merge branch 'stop-self-managing-disks' into physical_disks_ensure_le…
smklein c0e8e07
Fix imports
smklein 654a4ce
Merge branch 'stop-self-managing-disks' into physical_disks_ensure_le…
smklein 187aea3
generation number unity
smklein 7c5a67f
Merge branch 'main' into stop-self-managing-disks
smklein b50007b
Merge branch 'stop-self-managing-disks' into physical_disks_ensure_le…
smklein c2ee842
Remove self-managing test too
smklein a437cc2
imports
smklein d9ab0e2
Merge branch 'main' into stop-self-managing-disks
smklein 3d91d67
Merge branch 'stop-self-managing-disks' into physical_disks_ensure_le…
smklein c7d4e2e
Merge branch 'main' into stop-self-managing-disks
smklein 7751f12
Merge branch 'stop-self-managing-disks' into physical_disks_ensure_le…
smklein 8f2301d
Safe against concurrent updates
smklein 48c3578
Patch firmware tests
smklein e933a46
Add a bunch of logging
smklein c71504a
[wip] Expunge disk internal API, omdb commands
smklein 05a9f38
More omdb commands, physical disk filtering, safer expunge
smklein df9835e
copy-pastes, minor diskfilter cleanup
smklein 154a071
review feedback
smklein 691bc85
tx naming
smklein e360dae
more explicit instance termination
smklein 1c7fb2f
Merge branch 'physical_disks_ensure_lets_go' into omdb-disk-expungement
smklein bc80de5
typo fix
smklein ec013d9
better handling of oneshot tx in instance manager
smklein a818de2
use_only_these_disks
smklein ec75032
Merge branch 'physical_disks_ensure_lets_go' into omdb-disk-expungement
smklein f242e0a
Mark vmm failed
smklein 9d93c82
Merge branch 'physical_disks_ensure_lets_go' into omdb-disk-expungement
smklein 77931fd
Merge branch 'main' into stop-self-managing-disks
smklein 6babd19
Merge branch 'stop-self-managing-disks' into physical_disks_ensure_le…
smklein 5ca0f8e
Merge branch 'physical_disks_ensure_lets_go' into omdb-disk-expungement
smklein d8a5465
Merge branch 'main' into stop-self-managing-disks
smklein d57ec70
Merge branch 'stop-self-managing-disks' into physical_disks_ensure_le…
smklein da39958
Merge branch 'physical_disks_ensure_lets_go' into omdb-disk-expungement
smklein 9e1d729
Merge branch 'main' into stop-self-managing-disks
smklein 426daf1
Merge branch 'stop-self-managing-disks' into physical_disks_ensure_le…
smklein 6c15263
Merge branch 'physical_disks_ensure_lets_go' into omdb-disk-expungement
smklein 65a03ce
review feedback
smklein 9181512
fmt
smklein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ use nexus_db_model::IpAttachState; | |
use nexus_db_model::IpKind; | ||
use nexus_db_model::NetworkInterface; | ||
use nexus_db_model::NetworkInterfaceKind; | ||
use nexus_db_model::PhysicalDisk; | ||
use nexus_db_model::Probe; | ||
use nexus_db_model::Project; | ||
use nexus_db_model::Region; | ||
|
@@ -96,7 +97,10 @@ use nexus_types::deployment::Blueprint; | |
use nexus_types::deployment::BlueprintZoneDisposition; | ||
use nexus_types::deployment::BlueprintZoneFilter; | ||
use nexus_types::deployment::BlueprintZoneType; | ||
use nexus_types::deployment::DiskFilter; | ||
use nexus_types::deployment::SledFilter; | ||
use nexus_types::external_api::views::PhysicalDiskPolicy; | ||
use nexus_types::external_api::views::PhysicalDiskState; | ||
use nexus_types::external_api::views::SledPolicy; | ||
use nexus_types::external_api::views::SledState; | ||
use nexus_types::identity::Resource; | ||
|
@@ -281,12 +285,14 @@ pub struct DbFetchOptions { | |
enum DbCommands { | ||
/// Print information about the rack | ||
Rack(RackArgs), | ||
/// Print information about disks | ||
/// Print information about virtual disks | ||
Disks(DiskArgs), | ||
/// Print information about internal and external DNS | ||
Dns(DnsArgs), | ||
/// Print information about collected hardware/software inventory | ||
Inventory(InventoryArgs), | ||
/// Print information about physical disks | ||
PhysicalDisks(PhysicalDisksArgs), | ||
/// Save the current Reconfigurator inputs to a file | ||
ReconfiguratorSave(ReconfiguratorSaveArgs), | ||
/// Print information about regions | ||
|
@@ -407,8 +413,8 @@ enum InventoryCommands { | |
Cabooses, | ||
/// list and show details from particular collections | ||
Collections(CollectionsArgs), | ||
/// show all physical disks every found | ||
PhysicalDisks(PhysicalDisksArgs), | ||
/// show all physical disks ever found | ||
PhysicalDisks(InvPhysicalDisksArgs), | ||
/// list all root of trust pages ever found | ||
RotPages, | ||
} | ||
|
@@ -437,14 +443,21 @@ struct CollectionsShowArgs { | |
} | ||
|
||
#[derive(Debug, Args, Clone, Copy)] | ||
struct PhysicalDisksArgs { | ||
struct InvPhysicalDisksArgs { | ||
#[clap(long)] | ||
collection_id: Option<CollectionUuid>, | ||
|
||
#[clap(long, requires("collection_id"))] | ||
sled_id: Option<SledUuid>, | ||
} | ||
|
||
#[derive(Debug, Args)] | ||
struct PhysicalDisksArgs { | ||
/// Show disks that match the given filter | ||
#[clap(short = 'F', long, value_enum)] | ||
filter: Option<DiskFilter>, | ||
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. Happy to add more filters, just wanted at least one option here. |
||
} | ||
|
||
#[derive(Debug, Args)] | ||
struct ReconfiguratorSaveArgs { | ||
/// where to save the output | ||
|
@@ -611,6 +624,15 @@ impl DbArgs { | |
) | ||
.await | ||
} | ||
DbCommands::PhysicalDisks(args) => { | ||
cmd_db_physical_disks( | ||
&opctx, | ||
&datastore, | ||
&self.fetch_opts, | ||
args, | ||
) | ||
.await | ||
} | ||
DbCommands::ReconfiguratorSave(reconfig_save_args) => { | ||
cmd_db_reconfigurator_save( | ||
&opctx, | ||
|
@@ -1385,6 +1407,68 @@ async fn cmd_db_disk_physical( | |
Ok(()) | ||
} | ||
|
||
#[derive(Tabled)] | ||
#[tabled(rename_all = "SCREAMING_SNAKE_CASE")] | ||
struct PhysicalDiskRow { | ||
id: Uuid, | ||
serial: String, | ||
vendor: String, | ||
model: String, | ||
sled_id: Uuid, | ||
policy: PhysicalDiskPolicy, | ||
state: PhysicalDiskState, | ||
} | ||
|
||
impl From<PhysicalDisk> for PhysicalDiskRow { | ||
fn from(d: PhysicalDisk) -> Self { | ||
PhysicalDiskRow { | ||
id: d.id(), | ||
serial: d.serial.clone(), | ||
vendor: d.vendor.clone(), | ||
model: d.model.clone(), | ||
sled_id: d.sled_id, | ||
policy: d.disk_policy.into(), | ||
state: d.disk_state.into(), | ||
} | ||
} | ||
} | ||
|
||
/// Run `omdb db physical-disks`. | ||
async fn cmd_db_physical_disks( | ||
opctx: &OpContext, | ||
datastore: &DataStore, | ||
fetch_opts: &DbFetchOptions, | ||
args: &PhysicalDisksArgs, | ||
) -> Result<(), anyhow::Error> { | ||
let limit = fetch_opts.fetch_limit; | ||
let filter = match args.filter { | ||
Some(filter) => filter, | ||
None => { | ||
eprintln!( | ||
"note: listing all in-service disks \ | ||
(use -F to filter, e.g. -F in-service)" | ||
); | ||
DiskFilter::InService | ||
} | ||
}; | ||
|
||
let sleds = datastore | ||
.physical_disk_list(&opctx, &first_page(limit), filter) | ||
.await | ||
.context("listing physical disks")?; | ||
check_limit(&sleds, limit, || String::from("listing physical disks")); | ||
|
||
let rows = sleds.into_iter().map(|s| PhysicalDiskRow::from(s)); | ||
let table = tabled::Table::new(rows) | ||
.with(tabled::settings::Style::empty()) | ||
.with(tabled::settings::Padding::new(1, 1, 0, 0)) | ||
.to_string(); | ||
|
||
println!("{}", table); | ||
|
||
Ok(()) | ||
} | ||
|
||
// SERVICES | ||
|
||
// Snapshots | ||
|
@@ -3187,7 +3271,7 @@ async fn cmd_db_inventory_cabooses( | |
async fn cmd_db_inventory_physical_disks( | ||
conn: &DataStoreConnection<'_>, | ||
limit: NonZeroU32, | ||
args: PhysicalDisksArgs, | ||
args: InvPhysicalDisksArgs, | ||
) -> Result<(), anyhow::Error> { | ||
#[derive(Tabled)] | ||
#[tabled(rename_all = "SCREAMING_SNAKE_CASE")] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
A disk in the inventory is a different thing than a "control plane physical disk", so this was renamed to be more explicit.