Skip to content

Conversation

@Millefeuille42
Copy link
Contributor

Tests DRBD's corruption recovery using drbdadm verify and invalidate-remote commands as well as basic VM operations (startup, snapshot, shutdown)

Copy link
Contributor

@klmp200 klmp200 left a comment

Choose a reason for hiding this comment

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

Otherwise, lgtm


@pytest.fixture(scope='function')
def host_and_corrupted_vdi_on_linstor_sr(host, linstor_sr, vm_ref):
vm: VM = host.import_vm(vm_ref, sr_uuid=linstor_sr.uuid)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be created in a fixture
That would avoid the big try/catch at the end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need the VM lifetime to be directly tied to the fixture's lifetime and since we already have a vm_on_linstor_sr fixture with the "innapropriate" scope we would have double the fixture with different scopes.

Copy link

Choose a reason for hiding this comment

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

Maybe worth a comment ?

Copy link
Member

Choose a reason for hiding this comment

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

This will break when vm_ref is a UUID referring to an existing VM. This also totally bypasses local cache for imported VMs.

If it's best to import a VM and you don't care which VM, that there's no advantage in , then you should import one of the mini VMs without depending on vm_ref, as we already do in some storage tests:

vm = host.import_vm(vm_image('mini-linux-x86_64-bios'), sr_uuid=sr.uuid)

On the contrary, if you want the test to run with any VM we can test (as part of a "multi" job), then maybe you should still rely on the imported_vm fixture, but then copy it to the SR where you need it.

And if what you want is actually an empty VM with just a disk that you can break, then maybe it's time we implemented creating a VM from scratch, without relying on an XVA.

Worth a discussion.

@Millefeuille42 Millefeuille42 force-pushed the mlr/629-xostor-drbdadm-verify branch from e65c96c to 5af35f6 Compare November 5, 2025 14:13
Copy link

@rzr rzr left a comment

Choose a reason for hiding this comment

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

few remarks but not my expertise (yet)

@Millefeuille42 Millefeuille42 force-pushed the mlr/629-xostor-drbdadm-verify branch from 5af35f6 to 76186f2 Compare November 28, 2025 09:36
@Millefeuille42 Millefeuille42 requested a review from a team as a code owner November 28, 2025 09:36
@Millefeuille42 Millefeuille42 force-pushed the mlr/629-xostor-drbdadm-verify branch from 70925ed to d1fafa5 Compare December 8, 2025 12:59
Tests DRBD's corruption recovery
using drbdadm verify and invalidate-remote commands as well as
basic VM operations (startup, snapshot, shutdown)

Signed-off-by: Mathieu Labourier <mathieu.labourier@vates.tech>
@Millefeuille42 Millefeuille42 force-pushed the mlr/629-xostor-drbdadm-verify branch from 6ebf72d to d6b53e9 Compare December 10, 2025 10:06
pool: Pool = host.pool
master: Host = pool.master

def get_vdi_volume_name_from_linstor() -> str:
Copy link
Member

Choose a reason for hiding this comment

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

Why are the helper functions local to the fixture definition. There's no chance we could reuse them in other tests? This makes the fixture definition rather big.

vm.destroy(verify=True)

@pytest.fixture(scope='function')
def host_and_corrupted_vdi_on_linstor_sr(host: Host, linstor_sr: SR, vm_ref: str):
Copy link
Member

Choose a reason for hiding this comment

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

May this function-scope fixture be reused in future tests? If yes, I think conftest.py is the right location for it. If not, it would be better defined close to the only function that currently requires it.


@pytest.fixture(scope='function')
def host_and_corrupted_vdi_on_linstor_sr(host, linstor_sr, vm_ref):
vm: VM = host.import_vm(vm_ref, sr_uuid=linstor_sr.uuid)
Copy link
Member

Choose a reason for hiding this comment

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

This will break when vm_ref is a UUID referring to an existing VM. This also totally bypasses local cache for imported VMs.

If it's best to import a VM and you don't care which VM, that there's no advantage in , then you should import one of the mini VMs without depending on vm_ref, as we already do in some storage tests:

vm = host.import_vm(vm_image('mini-linux-x86_64-bios'), sr_uuid=sr.uuid)

On the contrary, if you want the test to run with any VM we can test (as part of a "multi" job), then maybe you should still rely on the imported_vm fixture, but then copy it to the SR where you need it.

And if what you want is actually an empty VM with just a disk that you can break, then maybe it's time we implemented creating a VM from scratch, without relying on an XVA.

Worth a discussion.

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.

8 participants