-
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 disk size #14595
base: main
Are you sure you want to change the base?
Conversation
5ad4a57
to
81fe9da
Compare
doc/api-extensions.md
Outdated
|
||
## `storage_volume_rootfs_size` | ||
|
||
Introduces a `volatile.rootfs.size` key, previously only supported for images, for container and virtual machine volumes that is used to store that volume's current size at any point. |
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.
Should this be showing up in one of the reference documents that are
Introduces a `volatile.rootfs.size` key, previously only supported for images, for container and virtual machine volumes that is used to store that volume's current size at any point. | |
Introduces a `volatile.rootfs.size` key, previously only supported for images, for container and virtual machine volumes. This key is used to store a volume's current size at any point. |
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.
Clarifying that the clause following "virtual machine volumes that ..." is meant to refer to key
and not volumes
.
Question: Should the volatile.rootfs.size
key show up in a reference page somewhere? I could not find it in the PR's RTD build. For example, should it show up here? Or in the storage volume configuration options like here?
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.
Clarifying that the clause following "virtual machine volumes that ..." is meant to refer to key and not volumes.
Yes, it is. Now I see how that is confusing,
Question: Should the volatile.rootfs.size key show up in a reference page somewhere?
I always assumed it was a pattern to not include volatile.*
keys in the docs as they are not intended (I think) to be set by users. Although for some reason it is apparentely allowed.
There seems to be a lack of pattern, the only volatile.*
keys that are included are defined here and here(https://github.com/hamistao/lxd/blob/disk_size_fixes/lxd/instance/instancetype/instance.go#L111). Everywhere else they are do not follow a metadata doc comment and I do not see a pattern for why some of them are included and some aren't.
doc/rest-api.yaml
Outdated
example: 502239232 | ||
format: int64 | ||
type: integer | ||
x-go-name: Total | ||
usage: | ||
description: Disk usage in bytes | ||
description: Disk usage in bytes. We use -1 to indicate the storage driver for the instance's pool does not support getting the disk usage. |
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.
description: Disk usage in bytes. We use -1 to indicate the storage driver for the instance's pool does not support getting the disk usage. | |
description: Disk usage in bytes. We use -1 to indicate that the storage driver for the instance's pool does not support retrieving the disk usage. |
lxd/storage/backend_lxd.go
Outdated
@@ -3287,12 +3302,20 @@ func (b *lxdBackend) GetInstanceUsage(inst instance.Instance) (*VolumeUsage, err | |||
} | |||
} | |||
|
|||
// If the instance volume is not block based/typed and neither bound by the device's size config key, |
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.
// If the instance volume is not block based/typed and neither bound by the device's size config key, | |
// If the instance volume is neither block based/typed nor bound by the device's size config key, |
2a2e63c
to
7c08121
Compare
Signed-off-by: hamistao <[email protected]>
Signed-off-by: hamistao <[email protected]>
All the handling of `volatile.rootfs.size` for images considers that it can be a '123 GiB' type string as well, so this also considers these strings when validating the key Signed-off-by: hamistao <[email protected]>
Signed-off-by: hamistao <[email protected]>
Signed-off-by: hamistao <[email protected]>
This makes it so that the an instance volume's `size` config is aligned with the volume's actual size in any point in time. i.e. some configs like disk device `size` and pool `volume.config` propagate into `volume.size`, similarly to what happens with custom volumes. Signed-off-by: hamistao <[email protected]>
For running instances, the instance volume 'size' config key is the most accurate representation of the instance root disk size. The device's own 'size' may be inaccurate when the instance does not support online resizing. When getting instance disk total size of a stopped instance, you want to see what is the size of the root disk you will be dealing with when you start the instance, even if the volume quota is only applied on instance start. Signed-off-by: hamistao <[email protected]>
…nces When getting instance disk total size of a stopped instance, you want to see what size is the root disk you will be dealing with when you start it. But it could be the case that the current volume size is different from the instance configuration as the volume when gets resizes (if needed) when the instance starts. So for the volume state, we always get the actual current size of the volume. Signed-off-by: hamistao <[email protected]>
Signed-off-by: hamistao <[email protected]>
7c08121
to
4b13a2a
Compare
Is this only for container filesystem based volumes or for VM block volumes too? Is this key used for VM image volumes too? |
This is for all instance types, since all can be restrained by setting the device's
Yes, it is currently only used for image volumes. |
thats not what i asked, is it currently populated for VM image volumes as well as container image volumes? |
Oh sorry, I misread your question. Yes, it is used for both container and VM images. |
This is a follow up PR for #14511 and this aims to address the problems outlined in #14511 (comment).
To do this, we need a way to determine wether the instance volume had its quota set based on
volume.size
on the pool level. For this, we are introducing thevolatile.rootfs.size
config key for instance volumes, previously it was only recognized in image volumes. This config key is used to represent the current quota of an instance volume at any point in time. This way we can determine whether a volume had its quota set based onvolume.size
or not.Also, any changes to the disk only cascade onto the volume's
volatile.rootfs.size
when the quota is applied on the volume. Thus, we are able to handle instances that don't support online resizing as the field we are looking for will only change when a quota is applied on the volume, i.e. when the instance restarts.This key was chosen instead of the
size
key because the intended behavior of this config key fits better the pattern we see withvolatile.*
keys, that can be changed by LXD itself, without the user specifying them. Plus this way we don't need complicated volume validation, wheresize
would be unsettable only if a user is setting it.