fix: Tier2 backup status now detects drives removed from storage (not just disconnected)
Previously, removing a storage drive from the controller only marked it as disconnected if the StoragePath entry still existed with Disconnected:true. Drives removed entirely from storage_paths were invisible to the check, causing Tier2 backup UI to show green "Sikeres" and scheduler to attempt backups to a no-longer-managed destination. New IsStoragePathKnown() method covers both cases. UI shows yellow "Cél meghajtó leválasztva" and scheduler skips silently. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -100,6 +100,10 @@ func (r *CrossDriveRunner) RunAppBackup(ctx context.Context, stackName string) e
|
||||
r.logger.Printf("[WARN] [backup] Cross-drive backup skipped for %s: destination drive disconnected (%s)", stackName, cfg.DestinationPath)
|
||||
return nil
|
||||
}
|
||||
if !r.sett.IsStoragePathKnown(cfg.DestinationPath) {
|
||||
r.logger.Printf("[WARN] [backup] Cross-drive backup skipped for %s: destination not a registered storage (%s)", stackName, cfg.DestinationPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Mark as running in settings
|
||||
_ = r.sett.UpdateCrossDriveStatus(stackName, func(c *settings.CrossDriveBackup) {
|
||||
|
||||
@@ -693,6 +693,20 @@ func (s *Settings) GetConnectedPaths() []StoragePath {
|
||||
return result
|
||||
}
|
||||
|
||||
// IsStoragePathKnown returns whether a path belongs to any registered storage path
|
||||
// (connected, disconnected, or decommissioned). A path removed entirely from
|
||||
// storage_paths is NOT known.
|
||||
func (s *Settings) IsStoragePathKnown(path string) bool {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
for _, sp := range s.StoragePaths {
|
||||
if path == sp.Path || strings.HasPrefix(path, sp.Path+"/") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetStoppedStacks returns the list of stacks that were auto-stopped for a storage path.
|
||||
func (s *Settings) GetStoppedStacks(path string) []string {
|
||||
s.mu.RLock()
|
||||
|
||||
@@ -938,6 +938,13 @@ func (s *Server) buildAppBackupRows(
|
||||
}
|
||||
}
|
||||
|
||||
// Also treat as disconnected if dest was removed from storage entirely
|
||||
if cfg.DestinationPath != "" && !row.Tier2DestDisconnected {
|
||||
if !s.settings.IsStoragePathKnown(cfg.DestinationPath) {
|
||||
row.Tier2DestDisconnected = true
|
||||
}
|
||||
}
|
||||
|
||||
if row.Tier2DestDisconnected {
|
||||
// Disconnected destination — treat as paused, not failed
|
||||
row.Status = "yellow"
|
||||
|
||||
Reference in New Issue
Block a user