Skip to content
Merged
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
25 changes: 23 additions & 2 deletions archinstall/lib/disk/device_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,18 @@ def _lvm_info_with_retry(
cmd: str,
info_type: Literal['lv', 'vg', 'pvseg'],
) -> LvmVolumeInfo | LvmGroupInfo | LvmPVInfo | None:
while True:
# Retry for up to 5 mins
max_retries = 100
for attempt in range(max_retries):
try:
return self._lvm_info(cmd, info_type)
except ValueError:
time.sleep(3)
if attempt < max_retries - 1:
debug(f'LVM info query failed (attempt {attempt + 1}/{max_retries}), retrying in 3 seconds...')
time.sleep(3)

debug(f'LVM info query failed after {max_retries} attempts')
return None

def lvm_vol_info(self, lv_name: str) -> LvmVolumeInfo | None:
cmd = f'lvs --reportformat json --unit B -S lv_name={lv_name}'
Expand Down Expand Up @@ -477,6 +484,13 @@ def lvm_pv_create(self, pvs: Iterable[Path]) -> None:
worker.poll()
worker.write(b'y\n', line_ending=False)

# Wait for the command to complete
while worker.is_alive():
worker.poll()

# Sync with udev to ensure the PVs are visible
self.udev_sync()

def lvm_vg_create(self, pvs: Iterable[Path], vg_name: str) -> None:
pvs_str = ' '.join([str(pv) for pv in pvs])
cmd = f'vgcreate --yes {vg_name} {pvs_str}'
Expand All @@ -487,6 +501,13 @@ def lvm_vg_create(self, pvs: Iterable[Path], vg_name: str) -> None:
worker.poll()
worker.write(b'y\n', line_ending=False)

# Wait for the command to complete
while worker.is_alive():
worker.poll()

# Sync with udev to ensure the VG is visible
self.udev_sync()

def lvm_vol_create(self, vg_name: str, volume: LvmVolume, offset: Size | None = None) -> None:
if offset is not None:
length = volume.length - offset
Expand Down