Skip to content

storage: avoid removing the xva/vdi before going in the debugger#436

Merged
stormi merged 2 commits into
masterfrom
gln/storage-debugger-xva-retention-uxrt
May 12, 2026
Merged

storage: avoid removing the xva/vdi before going in the debugger#436
stormi merged 2 commits into
masterfrom
gln/storage-debugger-xva-retention-uxrt

Conversation

@glehmann
Copy link
Copy Markdown
Member

@glehmann glehmann commented Mar 25, 2026

In case of exception, the cleanup code in try…finally was removing the
xva image before getting in the debugger, making impossible to look at
the xva content.

This PR is part of a tree containing 19 PRs:

  1. master
  2. "storage: avoid removing the xva/vdi before going in the debugger" (this PR) → master
  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 #449Update 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 25, 2026 10:42
@glehmann glehmann force-pushed the gln/storage-debugger-xva-retention-uxrt branch from 879aec3 to 7c53280 Compare March 25, 2026 10:44
@glehmann glehmann changed the title storage: avoid removing the xva before going in the debugger storage: avoid removing the xva/vdi before going in the debugger Mar 25, 2026
@glehmann glehmann force-pushed the gln/storage-debugger-xva-retention-uxrt branch from 80ec1b3 to 76b60de Compare March 25, 2026 13:40
Comment thread tests/storage/zfsvol/test_zfsvol_sr.py Outdated
Comment thread tests/storage/zfsvol/test_zfsvol_sr.py
@glehmann glehmann force-pushed the gln/storage-debugger-xva-retention-uxrt branch from 76b60de to 12bb98b Compare March 25, 2026 16:47
@glehmann glehmann requested a review from Nambrok March 25, 2026 16:48
@glehmann glehmann force-pushed the gln/storage-debugger-xva-retention-uxrt branch 3 times, most recently from 080ee74 to c130ebc Compare March 31, 2026 18:27
@glehmann glehmann changed the title storage: avoid removing the xva/vdi before going in the debugger gln/storage-debugger-xva-retention-uxrt Mar 31, 2026
@glehmann glehmann changed the title gln/storage-debugger-xva-retention-uxrt storage: avoid removing the xva/vdi before going in the debugger Apr 1, 2026
Comment thread tests/storage/lvm/test_lvm_sr.py Outdated
def test_coalesce(self, storage_test_vm: VM, vdi_on_lvm_sr: VDI, vdi_op: CoalesceOperation):
coalesce_integrity(storage_test_vm, vdi_on_lvm_sr, vdi_op)
def test_coalesce(
self, storage_test_vm: VM, vdi_on_lvm_sr: VDI, vdi_op: CoalesceOperation, defer: Defer
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.

nitpick: some newlines would help readability

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.

I could agree, but I won't start arguing about coding style :)

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.

Nitpick 2 : so much reformatting in commit 2 that I had difficulties finding the actual changes.

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.

Meld does a better job than github, thankfully

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.

Ok, so we are talking about coding style.

nitpick: some newlines would help readability

In this code base, I think the coding style tends to keep things vertically compact. Newlines would go against that.

Nitpick 2 : so much reformatting in commit 2 that I had difficulties finding the actual changes.

Indeed github is not very good at that.
The lines became longer than our 120-character limit. Would you have preferred to keep the first part of the parameters on the same line? The line would still have been modified

    def test_coalesce(self, storage_test_vm: VM, vdi_on_lvm_sr: VDI, vdi_op: CoalesceOperation):

would become

    def test_coalesce(self, storage_test_vm: VM, vdi_on_lvm_sr: VDI, vdi_op: CoalesceOperation,
                      defer: Defer):

Copy link
Copy Markdown
Member

@stormi stormi Apr 10, 2026

Choose a reason for hiding this comment

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

With a good diff tool, the current commit is fine for me. But the "onboarding" when opening commit 2 in github was not the best, and it's not necessarily on you :)

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.

I reordered the commit to use defer directly and avoid reaching the 120-character limit in most cases, and minimized changes as much as possible.

Comment thread conftest.py
sr.forget()

@pytest.fixture()
def defer(request: pytest.FixtureRequest) -> Defer:
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.

It would be nice to describe the defer fixture in the commit message. Here all the details are in the documentation of the fixture, which is nice in itself, but at first I was confused by the diff, and people from the future looking for the origin of this change might be do. Something as simple as inviting to check the doc of the defer fixture in the global conftest.py would be enough.

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.

done

Comment thread lib/common.py Outdated
args = {'uuid': uuid, 'param-name': param_name}
host.xe(f'{xe_prefix}-param-clear', args)

Defer = Callable[[Callable[[], object]], None]
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.

Move this up with the other type definitions?

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.

done

Copy link
Copy Markdown
Member

@stormi stormi left a comment

Choose a reason for hiding this comment

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

Minor comments. Overall it's a clear improvement vs try... finally structures in tests.

Let's however continue to strive to keep this an exception for things that we can't nicely handle via fixtures.

@glehmann glehmann force-pushed the gln/storage-debugger-xva-retention-uxrt branch from c130ebc to 89b31a9 Compare April 9, 2026 05:39
@glehmann glehmann changed the base branch from master to gln/zfsvol-disable-coalesce-test-rvxn April 9, 2026 05:45
Base automatically changed from gln/zfsvol-disable-coalesce-test-rvxn to master April 9, 2026 07:09
@glehmann glehmann force-pushed the gln/storage-debugger-xva-retention-uxrt branch 2 times, most recently from 6d2d859 to ef4ead1 Compare April 10, 2026 19:18
@glehmann glehmann force-pushed the gln/storage-debugger-xva-retention-uxrt branch from ef4ead1 to cd1c5d4 Compare April 15, 2026 16:18
@glehmann glehmann force-pushed the gln/storage-debugger-xva-retention-uxrt branch from cd1c5d4 to 27d715c Compare April 17, 2026 13:52
@glehmann glehmann force-pushed the gln/storage-debugger-xva-retention-uxrt branch from 27d715c to aeaca44 Compare April 24, 2026 14:57
@glehmann glehmann force-pushed the gln/storage-debugger-xva-retention-uxrt branch from aeaca44 to b2250b7 Compare April 29, 2026 17:39
glehmann added 2 commits May 11, 2026 17:48
In case of exception, the cleanup code in try…finally was removing the
xva image before getting in the debugger, making impossible to look at
the xva content.

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
Replace try-finally blocks with defer calls in storage tests to keep VDIs
available when entering the debugger.

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
Copy link
Copy Markdown
Contributor

@Lankou66 Lankou66 left a comment

Choose a reason for hiding this comment

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

LGTM

@stormi stormi merged commit e9bddd2 into master May 12, 2026
9 checks passed
@stormi stormi deleted the gln/storage-debugger-xva-retention-uxrt branch May 12, 2026 12:32
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