replace tape library body layout

This commit is contained in:
Warp Agent
2025-12-26 16:36:47 +00:00
parent 419fcb7625
commit 5e63ebc9fe
11 changed files with 1523 additions and 180 deletions

View File

@@ -137,8 +137,8 @@ func cacheControlMiddleware() gin.HandlerFunc {
case path == "/api/v1/system/services":
// Service list can be cached briefly
c.Header("Cache-Control", "public, max-age=60")
case strings.HasPrefix(path, "/api/v1/storage/zfs/pools/") && strings.HasSuffix(path, "/datasets"):
// ZFS datasets should not be cached - they change frequently
case strings.HasPrefix(path, "/api/v1/storage/zfs/pools"):
// ZFS pools and datasets should not be cached - they change frequently
c.Header("Cache-Control", "no-cache, no-store, must-revalidate")
default:
// Default: no cache for other endpoints

View File

@@ -164,6 +164,15 @@ func NewRouter(cfg *config.Config, db *database.DB, log *logger.Logger) *gin.Eng
if responseCache != nil {
storageHandler.SetCache(responseCache)
}
// Start disk monitor service in background (syncs disks every 5 minutes)
diskMonitor := storage.NewDiskMonitor(db, log, 5*time.Minute)
go diskMonitor.Start(context.Background())
// Start ZFS pool monitor service in background (syncs pools every 2 minutes)
zfsPoolMonitor := storage.NewZFSPoolMonitor(db, log, 2*time.Minute)
go zfsPoolMonitor.Start(context.Background())
storageGroup := protected.Group("/storage")
storageGroup.Use(requirePermission("storage", "read"))
{
@@ -217,6 +226,11 @@ func NewRouter(cfg *config.Config, db *database.DB, log *logger.Logger) *gin.Eng
// Virtual Tape Libraries
vtlHandler := tape_vtl.NewHandler(db, log)
// Start MHVTL monitor service in background (syncs every 5 minutes)
mhvtlMonitor := tape_vtl.NewMHVTLMonitor(db, log, "/etc/mhvtl", 5*time.Minute)
go mhvtlMonitor.Start(context.Background())
vtlGroup := protected.Group("/tape/vtl")
vtlGroup.Use(requirePermission("tape", "read"))
{