Skip to content

Prepare for VDI.revert: add tests and robustify error paths (26.1-lcm)#7103

Open
psafont wants to merge 14 commits into
xapi-project:26.1-lcmfrom
psafont:dev/vdi-revert-prepare
Open

Prepare for VDI.revert: add tests and robustify error paths (26.1-lcm)#7103
psafont wants to merge 14 commits into
xapi-project:26.1-lcmfrom
psafont:dev/vdi-revert-prepare

Conversation

@psafont
Copy link
Copy Markdown
Member

@psafont psafont commented May 29, 2026

These changes add both unit-tests and quicktests to make sure that regressions introduced with VDI.revert will be visible as early as possible.

In particular:

  • unit tests have been added to make sure adding the VDI_REVERT SR operation doesn't break important internal properties.
  • quicktests have been added to test behaviour for both Disks and CDs

Changes have been introduced in the error path, now VDIs are properly destroyed in some situation where they were meant to be destroyed, but the code failed to do so, making it more consistent.

This is preparation for the changes to make this proposal a reality: https://github.com/xapi-project/xen-api/blob/master/doc/content/design/snapshot-revert.md

I've run these tests on hosts.

psafont added 14 commits May 29, 2026 10:31
used for running dune in a build root without conflicting with the
normal _build that is used by editors or other tools

This separate directory can be used by setting an environment variable:

    DUNE_BUILD_DIR=_mock dune build ocaml/quicktest/ --profile=release -w

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
This module can help with printing API types, so move it to a new
private library so it can be used without compiling the cli server. This
is especially interesting for unit tests.

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
Makes the distinction between the absence of a value and absence of an
error.

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
The lists of operations used in the module need to be a subset of
all_ops, otherwise spurious errors can be thrown on runtime.

Ensuring these properties allows to drop the runtime check

Also add an interface file for the module

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
avoids having unused bindings

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
That's pre-2009 in xapi land

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
No change in behaviour

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
VDIs containing only CDs are immutable and are prevented from being
cloned.

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
This is preparation for using VDI.revert. No change in behaviour

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
This moves them outside of the try catch that destroys newly-cloned
disks, but this is safe since these don't change the state of the host
like the destroy vifs.

This allows to simplify the type needed to be able to clean up the new
VDIs in case of failure.

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
Previously in some parts of the revert, (rare) failures would not induce
the deletion of newly cloned VDIs.

Signed-off-by: Pau Ruiz Safont <pau.safont@vates.tech>
@psafont psafont changed the title Prepare for VDI.revert: add tests and robustify error paths Prepare for VDI.revert: add tests and robustify error paths (26.1-lcm) May 29, 2026
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.

1 participant