Repository navigation
Conversation
Linstor rounds the storage of a volume up (e.g. to the LVM extent size) and DRBD makes all of it usable, so the device a VM sees is usually a few MiB larger than the size CloudStack requested and records: a 512 MiB volume has a 540909568 byte device. Filesystems the guest creates on the whole disk, or grows to its end (cloud-init growpart), use that space, but the copies CloudStack makes are cut at the recorded size: snapshot backups to secondary storage are shrunk to it, and a copy opened at its own size then holds a filesystem larger than the disk. The driver now records the size of the device after creating a volume (new, cloned from a template or from a snapshot) and after a resize, and notifies the hypervisor of that size. Existing volumes are corrected before a snapshot and before a copy to secondary storage. The recorded size only grows, and the difference is counted against the account's primary storage, except on resize, which counts the recorded size itself. The device size is the smallest usable size of the top layer on the diskful resources; diskless resources only report the size of the volume definition. With DrbdOptions/ExactSize the device has the size of the volume definition.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14658 +/- ##
=========================================
Coverage 18.32% 18.32%
- Complexity 16644 16657 +13
=========================================
Files 5939 5939
Lines 537768 537843 +75
Branches 65929 65943 +14
=========================================
+ Hits 98551 98569 +18
- Misses 428008 428063 +55
- Partials 11209 11211 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR makes the LINSTOR plugin record the size of a volume's DRBD device as the volume size in CloudStack.
LINSTOR rounds the storage of a volume up (e.g. to the LVM extent size, plus DRBD metadata) and DRBD makes all of
it usable, so the block device a VM sees is usually a few MiB larger than the size CloudStack requested and
records. Examples from a 3-node LVM-thin setup:
Filesystems the guest creates on the whole disk, or grows to its end (e.g. cloud-init growpart), use that space,
but the copies CloudStack makes of the volume are cut at the recorded size: snapshot backups to secondary storage
are shrunk to it, so the last few MiB of the disk are missing in the backup, and a volume or template created from
such a copy then holds a filesystem that is larger than its disk.
The driver now:
resize, and passes the device size to the hypervisor in the resize notification,
snapshot backups and volume copies cover the whole device,
orchestrator already counts the (now recorded) size.
The device size is the smallest usable size of the top layer (DRBD, LUKS or storage) over the diskful resources;
diskless resources only report the size of the volume definition. With
DrbdOptions/ExactSizeset on the resourcedefinition the device has the size of the volume definition, which is used as is.
Volumes created on the agent side (e.g. migrated into LINSTOR) are corrected at their next snapshot or copy.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Unit tests (
LinstorUtilTest,LinstorPrimaryDataStoreDriverImplTest) for the device size (smallest diskfulDRBD device, no DRBD layer,
DrbdOptions/ExactSize, fallback to the volume definition, missing resourcedefinition) and for recording it (larger device, no resource count adjustment on resize, never shrinking, LINSTOR
API failure).
3-node KVM cluster with CloudStack 4.23 and this patch applied to the LINSTOR plugin, LINSTOR primary storage
(LVM-thin, DRBD 9.3, LINSTOR 1.35):
1077665792, the account's primary storage count rose by exactly the difference, and the backed up qcow2 on
secondary storage has a virtual size of 1077665792 bytes
resource count matches
How did you try to break this feature and the system with this change?
Covered by the unit tests:
definitions with
DrbdOptions/ExactSize.