always call sg_read_attr to try and read tape info
Continuous Integration / backend-tests (push) Successful in 36s
Continuous Integration / frontend-check (push) Successful in 15s
Continuous Integration / e2e-tests (push) Successful in 5m8s

This commit is contained in:
2026-05-05 20:59:34 -04:00
parent f40a76aa14
commit 32fc9e4506
+10 -5
View File
@@ -70,7 +70,8 @@ class LTOProvider(AbstractStorageProvider):
"drive": {}, "drive": {},
"mam": {}, "mam": {},
"online": False, "online": False,
"last_check": 0.0, "last_online_check": 0.0,
"last_mam_check": 0.0,
} }
def _log_command(self, cmd: List[str]): def _log_command(self, cmd: List[str]):
@@ -116,7 +117,8 @@ class LTOProvider(AbstractStorageProvider):
# Throttle MAM reads to once every 2 seconds unless forced # Throttle MAM reads to once every 2 seconds unless forced
now = time.time() now = time.time()
if not force and ( if not force and (
now - LTOProvider._lkg_state[self.device_path].get("last_check", 0) < 2.0 now - LTOProvider._lkg_state[self.device_path].get("last_mam_check", 0)
< 2.0
): ):
return LTOProvider._lkg_state[self.device_path]["mam"] return LTOProvider._lkg_state[self.device_path]["mam"]
@@ -233,7 +235,9 @@ class LTOProvider(AbstractStorageProvider):
# SUCCESS! Update LKG MAM state # SUCCESS! Update LKG MAM state
LTOProvider._lkg_state[self.device_path]["mam"] = mam LTOProvider._lkg_state[self.device_path]["mam"] = mam
LTOProvider._lkg_state[self.device_path]["last_check"] = time.time() LTOProvider._lkg_state[self.device_path]["last_mam_check"] = (
time.time()
)
return mam return mam
# Log failure so we can diagnose why sg_read_attr isn't working # Log failure so we can diagnose why sg_read_attr isn't working
@@ -305,7 +309,8 @@ class LTOProvider(AbstractStorageProvider):
now = time.time() now = time.time()
if ( if (
not force not force
and now - LTOProvider._lkg_state[self.device_path].get("last_check", 0) and now
- LTOProvider._lkg_state[self.device_path].get("last_online_check", 0)
< 2.0 < 2.0
): ):
return LTOProvider._lkg_state[self.device_path]["online"] return LTOProvider._lkg_state[self.device_path]["online"]
@@ -354,7 +359,7 @@ class LTOProvider(AbstractStorageProvider):
LTOProvider._lkg_state[self.device_path]["mam"] = {} LTOProvider._lkg_state[self.device_path]["mam"] = {}
LTOProvider._lkg_state[self.device_path]["online"] = is_online LTOProvider._lkg_state[self.device_path]["online"] = is_online
LTOProvider._lkg_state[self.device_path]["last_check"] = now LTOProvider._lkg_state[self.device_path]["last_online_check"] = now
return is_online return is_online
def is_write_protected(self) -> bool: def is_write_protected(self) -> bool: