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