[nexus] Add zpool to inventory#5249
Conversation
|
Chatted with @davepacheco a little about this PR, here's our consensus:
|
| let it_will_fit = (old_zpool_usage::dsl::size_used | ||
| + diesel::dsl::sql(&zpool_size_delta.to_string())) | ||
| .le(diesel::dsl::sql(zpool_dsl::total_size::NAME)); | ||
| .le(diesel::dsl::sql( |
There was a problem hiding this comment.
Hours spent trying to make this work with Diesel, getting pushed away from subqueries, fighting aliases, and then fumbling with full-table scans as I tried to split this into a separate query:
~4
I am still motivated to make #5063 work after getting through this disk expungement stuff.
| .unwrap(); | ||
| } | ||
|
|
||
| async fn inventory_collect_and_get_latest_collection( |
There was a problem hiding this comment.
This API is part of the nexus_test_interface API, and is basically punched through so tests which create synthetic disks can also "cause inventory collection to happen". They need it, to get the inv_zpool table populated.
|
I need to take a lap through the instructions here for fixing the reconfigurator "test_complex" test (see: #5145 (comment)), but this is otherwise ready for review |
| logctx.cleanup_successful(); | ||
| } | ||
|
|
||
| #[tokio::test] |
sunshowers
left a comment
There was a problem hiding this comment.
Looks fantastic, thanks!



This PR adds zpools to the inventory, and updates the existing
omicron.public.zpooltable to only include aspects of the zpool which are fully controlled by Nexus.This PR is intended to solve a problem introduced by #5172 . In that PR, physical disk and zpool provisioning will be decided by Nexus, and sent to the Sled Agent as a request. As a result, the
total_sizevalue of zpools is not known when a pool is provisioned. Here, we add zpools to the inventory, and JOIN with that table to access the "total_size" of the zpool if it is known.Additionally, this PR adds a test to validate that the database (appropriately) throws "Insufficient capacity" errors if the Zpool exists, but has not appeared in the inventory.