Skip to content

storage: Avoid writing the whole device in coalesce tests#449

Merged
stormi merged 2 commits into
masterfrom
gln/storage-coalesce-test-optimization-rzlk
May 12, 2026
Merged

storage: Avoid writing the whole device in coalesce tests#449
stormi merged 2 commits into
masterfrom
gln/storage-coalesce-test-optimization-rzlk

Conversation

@glehmann
Copy link
Copy Markdown
Member

@glehmann glehmann commented Mar 31, 2026

This is done by:

  • writing in only a small piece of data at the beginning, in the middle
    and at the end of the device
  • creating the snapshot/clone
  • writing for data in an already used location and a non-used one
  • triggering the coalesce
  • finally verifying that the data we generated is accessible as expected

Still not necessarily clear to me:

  • Are we losing something by not filling the drive?
  • How much data needs to be written to the disk? For now the tests is writing 4 chunks of 2GiB of data max, independently of the actual device size.

This PR is part of a tree containing 19 PRs:

  1. master
  2. storage: avoid removing the xva/vdi before going in the debugger #436master
  3. storage: test large volumes #437storage: avoid removing the xva/vdi before going in the debugger #436
  4. host: include mdadm RAID devices in disk detection #447storage: test large volumes #437
  5. Update randstream to 0.5.0 #446host: include mdadm RAID devices in disk detection #447
  6. "storage: Avoid writing the whole device in coalesce tests" (this PR) → Update randstream to 0.5.0 #446
  7. storage: avoid writing the whole device in migration tests #450storage: Avoid writing the whole device in coalesce tests #449
  8. xva/vdi: only write a small data amount in large volumes for faster tests #452storage: avoid writing the whole device in migration tests #450
  9. storage: test full device write #453xva/vdi: only write a small data amount in large volumes for faster tests #452
  10. storage: test that we can't create a vdi over its max allowed size #454storage: test full device write #453
  11. storage: add jobs for large volume tests #461storage: test that we can't create a vdi over its max allowed size #454
  12. skip large volume tests for zvol and nfsv4 #464storage: add jobs for large volume tests #461
  13. storage: add comprehensive tests for lvmohba storage repositories #470skip large volume tests for zvol and nfsv4 #464
  14. storage: free space for XVA import by destroying source VM first #471storage: add comprehensive tests for lvmohba storage repositories #470
  15. storage: limit data written per VDI with --write-volume-cap #481storage: free space for XVA import by destroying source VM first #471
  16. Add Packer configuration to build a minimal Alpine 3.23 UEFI VM for XCP-ng tests #523storage: limit data written per VDI with --write-volume-cap #481
  17. migration: create a xfs sr on the second host for intra/cross-pool migration #497storage: limit data written per VDI with --write-volume-cap #481
  18. Enhance block device management #498migration: create a xfs sr on the second host for intra/cross-pool migration #497
  19. Add VHD_MAX and QCOW2_MAX symbolic size constants #500Enhance block device management #498
  20. partially_populate_device: align span positions to block size for better performance #509Add VHD_MAX and QCOW2_MAX symbolic size constants #500

@glehmann glehmann requested review from a team as code owners March 31, 2026 13:07
@dinhngtu
Copy link
Copy Markdown
Member

dinhngtu commented Mar 31, 2026

I'd suggest writing data based on the translation unit of the virtual disk (e.g. if LVM stripe size is 4MB, write a small block every 3.99 MB). This will test writes to many suboffsets of the translation unit, and also test the whole range of the virtual disk at the same time. However, I imagine each backend/format combination will have a different translation unit requirement

Comment thread tests/storage/storage.py Outdated
# default seed is 0
randstream(vm, f'validate --expected-checksum {checksum} {dev}')
# generate at the start, in the middle and the end of the disk
checksum1 = randstream(vm, f'generate --size {stream_size} {dev}')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be good to have a helper to generate and validate data. You could give it a list of place to write and it could return a list of checksum that you can give to the validate one. It would simplify coalesce_integrity which is becoming big.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's kind of what I did in the next commit (the list of places is hardcoded), to reuse those functions in other tests. I'm moving that commit in this PR.

@glehmann glehmann force-pushed the gln/storage-coalesce-test-optimization-rzlk branch from 3b66c5b to ca168c5 Compare March 31, 2026 18:27
@glehmann glehmann force-pushed the gln/zfsvol-disable-coalesce-test-rvxn branch from f856a46 to 74095e0 Compare March 31, 2026 18:27
@glehmann glehmann changed the title storage: Avoid writing the whole device in coalesce tests gln/storage-coalesce-test-optimization-rzlk Mar 31, 2026
@glehmann glehmann force-pushed the gln/zfsvol-disable-coalesce-test-rvxn branch from 74095e0 to 23c00cb Compare March 31, 2026 20:33
@glehmann glehmann force-pushed the gln/storage-coalesce-test-optimization-rzlk branch 2 times, most recently from a58140c to 9e09978 Compare March 31, 2026 20:36
@glehmann glehmann force-pushed the gln/zfsvol-disable-coalesce-test-rvxn branch from 23c00cb to 029b878 Compare March 31, 2026 20:36
@glehmann glehmann changed the title gln/storage-coalesce-test-optimization-rzlk storage: Avoid writing the whole device in coalesce tests Apr 1, 2026
@glehmann glehmann force-pushed the gln/zfsvol-disable-coalesce-test-rvxn branch from 029b878 to 82d41a2 Compare April 7, 2026 13:20
@glehmann glehmann force-pushed the gln/storage-coalesce-test-optimization-rzlk branch 2 times, most recently from 28a8042 to 9cd481c Compare April 7, 2026 13:32
@glehmann glehmann force-pushed the gln/zfsvol-disable-coalesce-test-rvxn branch from 82d41a2 to 81f8cee Compare April 7, 2026 13:32
@glehmann glehmann force-pushed the gln/storage-coalesce-test-optimization-rzlk branch from 9cd481c to 63d6054 Compare April 8, 2026 20:28
@glehmann glehmann force-pushed the gln/zfsvol-disable-coalesce-test-rvxn branch 2 times, most recently from 24edbe5 to bb496a2 Compare April 8, 2026 21:22
@glehmann glehmann force-pushed the gln/storage-coalesce-test-optimization-rzlk branch from 0599c79 to c594a03 Compare April 15, 2026 16:18
@glehmann glehmann force-pushed the gln/update-randstream-0-5-0-lrnw branch from 0028ba7 to 8dbcdb1 Compare April 15, 2026 16:18
@glehmann glehmann force-pushed the gln/update-randstream-0-5-0-lrnw branch from 8dbcdb1 to 769890c Compare April 16, 2026 18:00
@glehmann glehmann force-pushed the gln/storage-coalesce-test-optimization-rzlk branch from c594a03 to 3ef0c7f Compare April 16, 2026 18:00
@glehmann glehmann force-pushed the gln/update-randstream-0-5-0-lrnw branch from 769890c to db0349e Compare April 17, 2026 13:52
@glehmann glehmann force-pushed the gln/storage-coalesce-test-optimization-rzlk branch 2 times, most recently from 9988aaf to 5ed2bbc Compare April 21, 2026 06:08
@glehmann glehmann force-pushed the gln/update-randstream-0-5-0-lrnw branch from db0349e to 13a2c24 Compare April 21, 2026 06:08
@glehmann glehmann force-pushed the gln/storage-coalesce-test-optimization-rzlk branch from 5ed2bbc to 6024db3 Compare April 24, 2026 14:56
@glehmann glehmann requested a review from a team as a code owner April 24, 2026 14:56
@glehmann glehmann force-pushed the gln/update-randstream-0-5-0-lrnw branch from 13a2c24 to 8863a2a Compare April 24, 2026 14:57
@glehmann glehmann requested a review from Nambrok April 28, 2026 09:42
Comment thread tests/storage/storage.py
# generate at the start, in the middle and the end of the disk
# use seeds unlikely to collide with other usages
checksum1 = randstream(vm, f'generate --seed 10 --size {size} {dev_path}')
checksum2 = randstream(vm, f'generate --seed 11 --position {dev_size // 2} --size {size} {dev_path}')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The write size can be as big as 2 GiB, this might not work on smaller VDIs especially if writes overlap. Although it'll just need a note.

glehmann added 2 commits May 11, 2026 17:48
This is necessary with large volumes to run in a reasonable amount of
time on standard hardware.

This is done by:
* writing in only a small piece of data at the beginning, in the middle
  and at the end of the device
* creating the snapshot/clone
* writing for data in an already used location and a non used one
* triggering the coalesce
* finally verifying that the data we generated is accessible as expected

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
Extract reusable functions for partially populating and validating disk
contents to reduce code duplication in storage tests.

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
@glehmann glehmann force-pushed the gln/storage-coalesce-test-optimization-rzlk branch from 94b427a to accd1d0 Compare May 11, 2026 15:48
Base automatically changed from gln/update-randstream-0-5-0-lrnw to master May 12, 2026 12:51
@stormi stormi merged commit f2b314d into master May 12, 2026
9 checks passed
@stormi stormi deleted the gln/storage-coalesce-test-optimization-rzlk branch May 12, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants