Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/storage/linstor/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,16 @@ def vm_on_linstor_sr(host: Host, linstor_sr: SR, vm_ref: str) -> Generator[VM, N
def vm_on_linstor_sr_function(host: Host, linstor_sr: SR, vm_ref: str) -> Generator[VM]:
with _vm_on_linstor_sr(host, linstor_sr, vm_ref) as vm:
yield vm

@pytest.fixture(scope='function')
def linstor_no_monitor(linstor_sr: SR):
"""
Disable linstor monitor on the linstor SR for
the current test to avoid unwanted scans.
"""
hosts = linstor_sr.main_host().pool.hosts
for host in hosts:
host.ssh("systemctl stop linstor-monitor.service")
yield
for host in hosts:
host.ssh("systemctl start linstor-monitor.service")
28 changes: 27 additions & 1 deletion tests/storage/linstor/test_linstor_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import time

from lib.commands import SSHCommandFailed
from lib.common import safe_split, vm_image, wait_for
from lib.common import Defer, safe_split, vm_image, wait_for
from lib.host import Host
from lib.pool import Pool
from lib.sr import SR
from lib.vdi import VDI
from lib.vm import VM
from tests.storage import vdi_is_open
from tests.storage.storage import check_critical_journal_revert, check_vdi_revert, check_vdi_revert_journal

from .conftest import GROUP_NAME, LINSTOR_PACKAGE

Expand Down Expand Up @@ -189,6 +190,31 @@ def test_resynchronization(
finally:
vm.shutdown(verify=True)

@pytest.mark.small_vm
@pytest.mark.big_vm
def test_revert(self, vm_on_linstor_sr: VM, defer: Defer) -> None:
check_vdi_revert(defer, vm_on_linstor_sr)

@pytest.mark.small_vm
@pytest.mark.big_vm
@pytest.mark.parametrize(
"fistpoint",
[
"LinstorSR_revert_create_insert",
"LinstorSR_revert_create_src",
"LinstorSR_revert_create_dest",
]
)
def test_revert_journal(self, vm_on_linstor_sr: VM, defer: Defer, exit_on_fistpoint: None, fistpoint: str):
check_vdi_revert_journal(defer, vm_on_linstor_sr, fistpoint, vm_on_linstor_sr.host.pool.master)

@pytest.mark.small_vm
@pytest.mark.big_vm
def test_critical_journal_revert(
self, vm_on_linstor_sr: VM, defer: Defer, exit_on_fistpoint: None, hostA2: Host, linstor_no_monitor: None
) -> None:
check_critical_journal_revert(defer, vm_on_linstor_sr, hostA2, "LinstorSR_revert_create_src")

# *** tests with reboots (longer tests).

@pytest.mark.reboot
Expand Down
Loading