add mhvtl detect vendor
This commit is contained in:
@@ -33,6 +33,7 @@ type VirtualTapeLibrary struct {
|
||||
Description string `json:"description"`
|
||||
MHVTLibraryID int `json:"mhvtl_library_id"`
|
||||
BackingStorePath string `json:"backing_store_path"`
|
||||
Vendor string `json:"vendor,omitempty"`
|
||||
SlotCount int `json:"slot_count"`
|
||||
DriveCount int `json:"drive_count"`
|
||||
IsActive bool `json:"is_active"`
|
||||
@@ -223,6 +224,7 @@ func (s *Service) createTape(ctx context.Context, tape *VirtualTape) error {
|
||||
func (s *Service) ListLibraries(ctx context.Context) ([]VirtualTapeLibrary, error) {
|
||||
query := `
|
||||
SELECT id, name, description, mhvtl_library_id, backing_store_path,
|
||||
COALESCE(vendor, '') as vendor,
|
||||
slot_count, drive_count, is_active, created_at, updated_at, created_by
|
||||
FROM virtual_tape_libraries
|
||||
ORDER BY name
|
||||
@@ -247,6 +249,7 @@ func (s *Service) ListLibraries(ctx context.Context) ([]VirtualTapeLibrary, erro
|
||||
var createdBy sql.NullString
|
||||
err := rows.Scan(
|
||||
&lib.ID, &lib.Name, &description, &lib.MHVTLibraryID, &lib.BackingStorePath,
|
||||
&lib.Vendor,
|
||||
&lib.SlotCount, &lib.DriveCount, &lib.IsActive,
|
||||
&lib.CreatedAt, &lib.UpdatedAt, &createdBy,
|
||||
)
|
||||
@@ -284,6 +287,7 @@ func (s *Service) ListLibraries(ctx context.Context) ([]VirtualTapeLibrary, erro
|
||||
func (s *Service) GetLibrary(ctx context.Context, id string) (*VirtualTapeLibrary, error) {
|
||||
query := `
|
||||
SELECT id, name, description, mhvtl_library_id, backing_store_path,
|
||||
COALESCE(vendor, '') as vendor,
|
||||
slot_count, drive_count, is_active, created_at, updated_at, created_by
|
||||
FROM virtual_tape_libraries
|
||||
WHERE id = $1
|
||||
@@ -294,6 +298,7 @@ func (s *Service) GetLibrary(ctx context.Context, id string) (*VirtualTapeLibrar
|
||||
var createdBy sql.NullString
|
||||
err := s.db.QueryRowContext(ctx, query, id).Scan(
|
||||
&lib.ID, &lib.Name, &description, &lib.MHVTLibraryID, &lib.BackingStorePath,
|
||||
&lib.Vendor,
|
||||
&lib.SlotCount, &lib.DriveCount, &lib.IsActive,
|
||||
&lib.CreatedAt, &lib.UpdatedAt, &createdBy,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user