Files
atlas/internal/models/vtl.go
2025-12-21 16:25:17 +00:00

59 lines
2.9 KiB
Go

package models
// VTLDrive represents a virtual tape drive
type VTLDrive struct {
ID int `json:"id"` // Drive ID (e.g., 11, 12, 13, 14 for library 10)
LibraryID int `json:"library_id"` // Library ID (tens digit)
SlotID int `json:"slot_id"` // Slot ID (ones digit)
Vendor string `json:"vendor"` // Drive vendor (e.g., "IBM")
Product string `json:"product"` // Drive product (e.g., "ULT3580-TD5")
Type string `json:"type"` // Tape type (e.g., "LTO-5", "LTO-6")
Device string `json:"device"` // Device path (e.g., "/dev/st0")
Status string `json:"status"` // "online", "offline", "error"
MediaLoaded bool `json:"media_loaded"` // Whether tape is loaded
Barcode string `json:"barcode"` // Barcode of loaded tape (if any)
}
// VTLMediaChanger represents a virtual media changer
type VTLMediaChanger struct {
ID int `json:"id"` // Changer ID
LibraryID int `json:"library_id"` // Library ID
Device string `json:"device"` // Device path (e.g., "/dev/sg0")
Status string `json:"status"` // "online", "offline", "error"
Slots int `json:"slots"` // Number of slots
Drives int `json:"drives"` // Number of drives
}
// VTLTape represents a virtual tape cartridge
type VTLTape struct {
Barcode string `json:"barcode"` // Tape barcode
LibraryID int `json:"library_id"` // Library ID
SlotID int `json:"slot_id"` // Slot ID (0 = not in library)
DriveID int `json:"drive_id"` // Drive ID if loaded (-1 if not loaded)
Type string `json:"type"` // Tape type (e.g., "LTO-5")
Size uint64 `json:"size"` // Tape capacity in bytes
Used uint64 `json:"used"` // Used space in bytes
Status string `json:"status"` // "available", "in_use", "error"
}
// VTLConfig represents mhvtl configuration
type VTLConfig struct {
Enabled bool `json:"enabled"` // Whether VTL is enabled
LibraryID int `json:"library_id"` // Default library ID
Drives []VTLDrive `json:"drives"` // List of drives
Changer *VTLMediaChanger `json:"changer"` // Media changer
Tapes []VTLTape `json:"tapes"` // List of tapes
ConfigPath string `json:"config_path"` // Path to mhvtl config
StoragePath string `json:"storage_path"` // Path to tape storage
}
// VTLStatus represents overall VTL system status
type VTLStatus struct {
ServiceRunning bool `json:"service_running"` // Whether mhvtl service is running
DrivesOnline int `json:"drives_online"` // Number of online drives
DrivesTotal int `json:"drives_total"` // Total number of drives
TapesTotal int `json:"tapes_total"` // Total number of tapes
TapesAvailable int `json:"tapes_available"` // Number of available tapes
LastError string `json:"last_error"` // Last error message (if any)
}