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