Skip to content

feat(coalesce): Add tests for coalesce #290

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Nambrok
Copy link
Contributor

@Nambrok Nambrok commented Apr 2, 2025

The tests create a VDI, connect it to Dom0 then use the tapdev to write random data somewhere in it.
It then compare the data of the VDI to the original data we have to see if it has changed.
The test create snapshot/clone before deleting them and waiting for the coalesce to have happened by observing sm-config:vhd-parent before checking the integrity of the data.

Also add --vdi-type parameter that default to vhd to prepare to tests multiple VDI types, i.e. qcow2.

@Nambrok Nambrok requested a review from Wescoeur April 2, 2025 11:16
@Nambrok Nambrok marked this pull request as ready for review April 2, 2025 11:16
@Nambrok Nambrok force-pushed the dtt-coalesce branch 4 times, most recently from 72580ab to 8cdbea9 Compare April 2, 2025 14:44
@Nambrok Nambrok requested review from Wescoeur and AnthoineB April 2, 2025 14:44
@Nambrok
Copy link
Contributor Author

Nambrok commented Apr 2, 2025

For the failing test: waiting for #291 to be resolved.

action="append",
default=[],
help="Format of VDI to execute tests on."
"Example: vhd,qcow2"
Copy link
Member

Choose a reason for hiding this comment

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

Making this a CLI parameter means you're deporting the test job definition outside pytest. When rishi wanted to do the same for thin vs thick in the context of XOSTOR tests, we asked him to rework the tests so they actually test both formats.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's to allow to test only one type by hand, the objectives for tests is to keep the default which at the moment is vhd but will be ["vhd", "qcow2"] eventually.

Copy link
Member

Choose a reason for hiding this comment

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

pytest already has test selection mechanisms:

  • path to test files
  • -k
  • -m

Copy link
Member

@stormi stormi Apr 2, 2025

Choose a reason for hiding this comment

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

As long as the parameter is not necessary in jobs.py, fine by me. We won't have SR types that only support VHD or only support QCOW2 at some point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The parameter default to VHD when not given meaning it's not needed to change jobs.py. But I will need to add the new coalesce tests in jobs.py either way and it's the only test at the moment that will use vdi-type
I'm not sure to see how the other selection mechanisms from pytest could work in this case.

@@ -75,6 +75,13 @@ def pytest_addoption(parser):
"4KiB blocksize to be formatted and used in storage tests. "
"Set it to 'auto' to let the fixtures auto-detect available disks."
)
parser.addoption(
"--image-format",
Copy link
Member

Choose a reason for hiding this comment

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

When you work in the context of storage everyday, maybe it's a clear name, but otherwise it might be too generic a name. Both image and format can be many things.

Copy link
Member

Choose a reason for hiding this comment

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

It's why I added vdi-image-format as suggestion.
But I wonder if we should not use the naming volume-image-format instead.

No preference.

Copy link
Member

Choose a reason for hiding this comment

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

And vdi-type looked consistent with sm's terminology 🤔

Copy link
Member

Choose a reason for hiding this comment

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

# xe vdi-list params=type | sort | uniq
type ( RO)    : CBT metadata
type ( RO)    : HA statefile
type ( RO)    : Redo log
type ( RO)    : User

Not really consistent. In this example here, type is completly different.

  • On the XAPI side, we have a vdi_type stored in the sm-config attribute. Here you can have the VHD/AIO value. However there are weird situations like: sm-config (MRO) : type: raw; vdi_type: aio.
  • Regarding the new QCOW2 format we discussed internally to use a new attribute image-format. type is completely ambiguous depending on what you are talking about and the context in which it is used.
  • In the SMAPIv3, vdi type is completly removed (same for VDI, we use volume instead). And image-format is used.

@glehmann
Copy link
Contributor

glehmann commented Apr 2, 2025

For the failing test: waiting for #291 to be resolved.

I thought it would take a bit longer before it showed again!

Add a vdi-type parameter to parametrize the vdi_type fixture,
it default to vhd at the moment, will be used to run test on other vdi
type, e.g. qcow2.

The tests create a VDI, connect it to Dom0 then use the tapdev to write
random data somewhere in it.
It then compare the data of the VDI to the original data we have to see
if it has changed.
The test create snapshot/clone before deleting them and waiting for the
coalesce to have happened by observing sm-config:vhd-parent before
checking the integrity of the data.

Signed-off-by: Damien Thenot <[email protected]>
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.

5 participants