1414# You should have received a copy of the GNU General Public License
1515# along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
17- from sm_typing import Any , Optional , override
17+ from sm_typing import Any , Optional , override , Literal
1818
1919from constants import CBTLOG_TAG
2020
@@ -819,17 +819,19 @@ def is_master(self):
819819
820820 @override
821821 def check_sr (self , sr_uuid ) -> None :
822- # Only applied on the Linstor Controller, for various reasons.
822+ # Note: check_sr is called on all hosts by the health check mechanism
823+ # not by regular xapi calls such as scans.
824+ # Applied only on the Linstor Controller, for reasons -> listed below.
823825 if not LinstorVolumeManager .is_controller ():
824826 return
825827 # Start database invalidation.
826- # Needs access to backup files, available only on the Controller.
828+ # -> Needs access to backup files, available only on the Controller.
827829 LinstorVolumeManager .database_invalidation ()
828830 # check_sr is launched on *all* hosts, but it turns out that
829831 # we do not want all of them to blindly generate concurrencing backups.
830832 # Hence we must choose one, either one is good, but there must be only one.
831833 # Apply throttling: only backup if last one is >1h old.
832- # Needs access to backup files, available only on the Controller.
834+ # -> Needs access to backup files, available only on the Controller.
833835 if LinstorVolumeManager .database_backup_age () > 3600 :
834836 self .database_backup ("auto" )
835837
@@ -1586,7 +1588,7 @@ def _kick_gc(self):
15861588 util .SMlog ('Kicking GC' )
15871589 cleanup .start_gc_service (self .uuid )
15881590
1589- def database_backup (self , name = "" ):
1591+ def database_backup (self , name : Literal [ "auto" , "create" , "delete" , "snapshot" ] ):
15901592 """
15911593 Generate a new database backup file.
15921594 This operation should not prevent the underlying action to be successful.
@@ -1595,7 +1597,7 @@ def database_backup(self, name=""):
15951597 if not self ._linstor :
15961598 self ._reconnect ()
15971599 try :
1598- self ._linstor .database_backup (name )
1600+ self ._linstor and self . _linstor .database_backup (name )
15991601 except Exception as e :
16001602 util .SMlog (
16011603 f"[database_backup] Error during creation: { e } " ,
0 commit comments