Skip to content

Commit d341622

Browse files
committed
Better name for backup invalidation and mypy handling of a (im)possible None self._linstor
Signed-off-by: Arnaud Garcia-Fernandez <arnaud.garcia-fernandez@vates.tech>
1 parent ad99004 commit d341622

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/LinstorSR.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ def check_sr(self, sr_uuid) -> None:
826826
return
827827
# Validate and clean previous backups if necessary.
828828
# -> Needs access to backup files, available only on the Controller.
829-
LinstorVolumeManager.database_invalidation()
829+
LinstorVolumeManager.database_backup_validate_and_prune()
830830
# check_sr is launched on *all* hosts, but it turns out that
831831
# we do not want all of them to blindly generate concurrencing backups.
832832
# Hence we must choose one, either one is good, but there must be only one.
@@ -1597,7 +1597,8 @@ def database_backup(self, name: Literal["auto", "create", "delete", "snapshot"])
15971597
if not self._linstor:
15981598
self._reconnect()
15991599
try:
1600-
self._linstor.database_backup(name) # type: ignore
1600+
assert self._linstor
1601+
self._linstor.database_backup(name)
16011602
except Exception as e:
16021603
util.SMlog(
16031604
f"[database_backup] Error during creation: {e}",

drivers/linstorvolumemanager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,7 @@ def database_backup(self, name=""):
18141814
util.SMlog(f"[database_backup] Created: {filename}", priority=util.LOG_INFO)
18151815

18161816
@classmethod
1817-
def database_invalidation(cls):
1817+
def database_backup_validate_and_prune(cls):
18181818
"""
18191819
Removes old backup based on two criterias:
18201820
- Validity of the zipfile done by self._check_database_backup.

0 commit comments

Comments
 (0)