-
-
Notifications
You must be signed in to change notification settings - Fork 18
Add storage API #210
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
base: main
Are you sure you want to change the base?
Add storage API #210
Conversation
incus-osd/api/system_storage.go
Outdated
// SystemStorage defines a struct to hold information about the system's local storage. | ||
type SystemStorage struct { | ||
State struct { | ||
SMARTStatus map[string]json.RawMessage `json:"smart_status" yaml:"smart_status"` |
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.
It'll be more work, but I think we should try to abstract things a bit more.
Basically having a Drives []SystemStorageDrive
with each drive then including at least:
- ID
- Manufacturer
- Model
- Serial number
- Bus
- Removable
- WWN
- SMART status
- Pool
We'll also want to do a bit of filtering.
For example, if we find a multipath device, we should only show the ID for the multipath device itself and exclude all of the individual drives that are part of it.
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.
I think I've got a pretty good solution for this, although it will be interesting to see if any fields are missing/incorrect across wider hardware.
lsblk
has a merge option (-M
), which supposedly should handle cases like multipath devices and only show the actual device, but we'll need to test that.
) | ||
|
||
// SystemStorage defines a struct to hold information about the system's local storage. | ||
type SystemStorage struct { |
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.
I think defining and updating pools should be done through the Config
struct same we do elsewhere.
So having something like:
Config {
Pools [
Pool {
Name: "local-nvme",
Type: "zfs-raidz1",
Devices: ["dev1", "dev2"],
}
Pool {
Name: "local-nvme",
Type: "zfs-raidz2",
Devices: ["dev1", "dev2", "dev3", "dev4", "dev5"],
Cache: ["dev6", "dev7"],
Log: ["dev8", "dev9"],
}
]
}
We'd define those types for now:
- zfs-raid0 (stripe across all devices)
- zfs-raid1 (mirror across all devices)
- zfs-raid10 (stripe across pairs of devices)
- zfs-raidz1
- zfs-raidz2
- zfs-raidz3
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.
Replacement operations would then literally be a PUT to the config, replacing one drive ID with another. Same would go for device addition or removal (when supported).
Looks like there's a small test migration related to the state |
Too much muscle memory typing apt :) Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Signed-off-by: Mathias Gibbens <[email protected]>
Static analysis isn't happy ;) |
Adds a preliminary storage API:
/1.0/system/storage
:blkdiscard
on its former members/1.0/system/security
:Closes #145