|
2 | 2 |
|
3 | 3 | import pytest |
4 | 4 |
|
| 5 | +import logging |
| 6 | + |
| 7 | +from lib.commands import SSHCommandFailed |
5 | 8 | from lib.common import vm_image, wait_for |
| 9 | +from lib.fistpoint import FistPoint |
| 10 | +from lib.vdi import VDI |
6 | 11 | from tests.storage import try_to_create_sr_with_missing_device, vdi_is_open |
7 | 12 |
|
8 | 13 | from typing import TYPE_CHECKING |
@@ -61,6 +66,58 @@ def test_snapshot(self, vm_on_lvm_sr): |
61 | 66 | finally: |
62 | 67 | vm.shutdown(verify=True) |
63 | 68 |
|
| 69 | + @pytest.mark.small_vm |
| 70 | + @pytest.mark.big_vm |
| 71 | + def test_failing_resize_on_inflate_after_setSize(self, host, lvm_sr, vm_on_lvm_sr, exit_on_fistpoint): |
| 72 | + vm = vm_on_lvm_sr |
| 73 | + lvinflate = "" |
| 74 | + vdi = VDI(vm.vdi_uuids()[0], host=vm.host) |
| 75 | + new_size = vdi.get_virtual_size() + (1 * 1024 * 1024 * 1024) # Adding a 1GiB to size |
| 76 | + |
| 77 | + with FistPoint(vm.host, "LVHDRT_inflate_after_setSize"), pytest.raises(SSHCommandFailed) as exc_info: |
| 78 | + vdi.resize(new_size) |
| 79 | + logging.info(exc_info) |
| 80 | + |
| 81 | + lvlist = host.lvs(f"VG_XenStorage-{lvm_sr.uuid}") |
| 82 | + for lv in lvlist: |
| 83 | + if lv.startswith("inflate_"): |
| 84 | + logging.info(f"Found inflate journal following error: {lv}") |
| 85 | + lvinflate = lv |
| 86 | + |
| 87 | + logging.info(f"Launching SR scan for {lvm_sr.uuid} to resolve failure") |
| 88 | + try: |
| 89 | + host.xe("sr-scan", {"uuid": lvm_sr.uuid}) |
| 90 | + except SSHCommandFailed as e: |
| 91 | + assert False, f"Failing to scan following a inflate error {e}" |
| 92 | + assert lvinflate not in host.lvs(f"VG_XenStorage-{lvm_sr.uuid}"), \ |
| 93 | + "Inflate journal still exist following the scan" |
| 94 | + |
| 95 | + @pytest.mark.small_vm |
| 96 | + @pytest.mark.big_vm |
| 97 | + def test_failing_resize_on_inflate_after_setSizePhys(self, host, lvm_sr, vm_on_lvm_sr, exit_on_fistpoint): |
| 98 | + vm = vm_on_lvm_sr |
| 99 | + lvinflate = "" |
| 100 | + vdi = VDI(vm.vdi_uuids()[0], host=vm.host) |
| 101 | + new_size = vdi.get_virtual_size() + (1 * 1024 * 1024 * 1024) # Adding a 1GiB to size |
| 102 | + |
| 103 | + with FistPoint(vm.host, "LVHDRT_inflate_after_setSizePhys"), pytest.raises(SSHCommandFailed) as exc_info: |
| 104 | + vdi.resize(new_size) |
| 105 | + logging.info(exc_info) |
| 106 | + |
| 107 | + lvlist = host.lvs(f"VG_XenStorage-{lvm_sr.uuid}") |
| 108 | + for lv in lvlist: |
| 109 | + if lv.startswith("inflate_"): |
| 110 | + logging.info(f"Found inflate journal following error: {lv}") |
| 111 | + lvinflate = lv |
| 112 | + |
| 113 | + logging.info(f"Launching SR scan for {lvm_sr.uuid} to resolve failure") |
| 114 | + try: |
| 115 | + host.xe("sr-scan", {"uuid": lvm_sr.uuid}) |
| 116 | + except SSHCommandFailed as e: |
| 117 | + assert False, f"Failing to scan following a inflate error {e}" |
| 118 | + assert lvinflate not in host.lvs(f"VG_XenStorage-{lvm_sr.uuid}"), \ |
| 119 | + "Inflate journal still exist following the scan" |
| 120 | + |
64 | 121 | # *** tests with reboots (longer tests). |
65 | 122 |
|
66 | 123 | @pytest.mark.reboot |
|
0 commit comments