[inventory] Add svcs enabled not online to DB#10195
[inventory] Add svcs enabled not online to DB#10195karencfv merged 19 commits intooxidecomputer:mainfrom
Conversation
| id UUID NOT NULL, | ||
| fmri TEXT NOT NULL, | ||
| zone TEXT NOT NULL, | ||
| state omicron.public.inv_svc_state_enum NOT NULL, |
There was a problem hiding this comment.
This maybe gets at a design issue with the types on the Rust side, but - what would it mean to have a row in a table named ..._not_online_service with the state online?
There was a problem hiding this comment.
I see where you're getting at 🤔 . What about using an enum on the DB side (inv_svc_not_online_state ?) that does not include the online state?
There was a problem hiding this comment.
I think not including the online state is the right call, if the intent of this is to store "not online" statuses. But we probably need to remove it on the Rust side too, right? For a couple reasons: the same question applies there (what would it mean for a SvcsEnabledNotOnline to contain a service in the state SvcState::Online), and what would you do at runtime if you had that and needed to store it in the db?
That does make the type names awkward; it probably needs to be something like SvcState becomes NotOnlineSvcState and Svc becomes NotOnlineSvc? I don't love that but it does seem like we probably don't want the generic-sounding Svc and SvcState types to not be able to represent online services.
There was a problem hiding this comment.
Ha! Looks like this was already on my mind 😄
https://github.com/oxidecomputer/omicron/blob/main/sled-agent/types/versions/src/modify_services_in_inventory/inventory.rs#L56-L58
There was a problem hiding this comment.
In the end I decided to keep the SvcState enum for the initial parse() method. It seemed just wrong not have a complete enum of all of the possible states as part of the svcs module. I did add additional enums SvcEnabledNotOnlineState and InvSvcEnabledNotOnlineState for the "enabled not online" filtering functionality.
There was a problem hiding this comment.
Thanks, I think that makes perfect sense. 👍
karencfv
left a comment
There was a problem hiding this comment.
Thanks for the review! I think I've addressed all of your comments @jgallagher
| id UUID NOT NULL, | ||
| fmri TEXT NOT NULL, | ||
| zone TEXT NOT NULL, | ||
| state omicron.public.inv_svc_state_enum NOT NULL, |
There was a problem hiding this comment.
I see where you're getting at 🤔 . What about using an enum on the DB side (inv_svc_not_online_state ?) that does not include the online state?
|
Changes look good - just one nit with the error string conversion, and then the somewhat-painful "what do we do about online services" question in #10195 (comment). |
karencfv
left a comment
There was a problem hiding this comment.
Thanks for taking a look @jgallagher! I think this should be ready to go 🤞
jgallagher
left a comment
There was a problem hiding this comment.
Thanks for all the work on the back-and-forth here! Looks great.
Follow up to #9977
Closes: #9516
Manual testing with no data from services
Happy system
With failed services
With a command error