-
Notifications
You must be signed in to change notification settings - Fork 935
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
Storage: Show correct instance root disk size on API #14511
Conversation
752fbf9
to
0ad2e26
Compare
0ad2e26
to
760adc8
Compare
0a5d38d
to
4ccdd4c
Compare
f3a8f96
to
47d7fe1
Compare
There are two situations that aren't fixed by this PR:
|
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.
There seems to be one more usage of DefaultBlockSize
in the instance scriptlet https://github.com/canonical/lxd/blob/main/lxd/scriptlet/instance_placement.go#L224.
Can we do something similar to https://github.com/canonical/lxd/blob/main/lxd/project/limits/permissions.go#L1472 to load the storage driver and fetch the respective DefaultBlockSize
? Not sure if it will cause an import loop though.
aed4e82
to
6d75211
Compare
@roosterfish I believe everything was addressed. I did something different from what is done on https://github.com/canonical/lxd/blob/main/lxd/project/limits/permissions.go#L1472 to get Tests for VMs will follow on LXD CI. |
Going back to Draft to add support for the situations described in #14511 (comment). |
61cba04
to
e422622
Compare
7db2378
to
b964ab2
Compare
This includes the simpler fixes related to showing accurate disk sizes on the API. To address the use cases described in #14511 (comment), a follow up draft PR was opened to unblock these changes from getting merged: #14511 (comment). |
b964ab2
to
c239c75
Compare
@tomponline This includes the simpler fixes for getting correct root disk sizes and don't address the scenarios described in #14511 (comment). These are addressed in a follow up PR: #14595. The tests for these changes are included in the follow up PR, but we can check that they are passing on the follow up's test runs. All that said, this is ready for a review :D |
This includes some improvements that were originally a part of the fix implemented in #14511, but ended up not being needed for that fix. They are still nice to have and thus were included here.
When driver does not support getting the volume usage, we are returning prematurely and abstaining from getting the disk total size. Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
This proposes using -1 as a disk size to indicate we do not impose limits on the volume level and thus it has access to the entire pool storage. Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Previously, when usage was not supported, we returned null root disk and thus did not show disk total size, even when it was possible. Now we represent not supporting showing disk usage with usage=-1. Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
c239c75
to
4f17d26
Compare
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.
Thanks!
@edlerd please can you see whether this helps with storage reporting in the UI. Thanks |
This aims to get instance root disk sizes correctly, as it currently often shows as 0 or null on the API, either though
/1.0/instances?recursion=2
or/1.0/instances/<instance_name>/state
, as reported by #14277.This is still not a perfect solution but is a significant improvement as it:
size
key set.