From 1bfdd0043ff263b34be3572891b1c6b422d1f504 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Mon, 9 May 2022 18:14:43 -0700 Subject: [PATCH] added a way to retrieve raw udev data. Can be used to retrieve disk label, UUID and "disk/by-id/*" device info. Storing it in the database during device registration. --- .../migrations/m20220509170100/device.go | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 webapp/backend/pkg/database/migrations/m20220509170100/device.go diff --git a/webapp/backend/pkg/database/migrations/m20220509170100/device.go b/webapp/backend/pkg/database/migrations/m20220509170100/device.go new file mode 100644 index 0000000..1134fff --- /dev/null +++ b/webapp/backend/pkg/database/migrations/m20220509170100/device.go @@ -0,0 +1,41 @@ +package m20220509170100 + +import ( + "github.com/analogj/scrutiny/webapp/backend/pkg" + "time" +) + +type Device struct { + //GORM attributes, see: http://gorm.io/docs/conventions.html + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt *time.Time + + WWN string `json:"wwn" gorm:"primary_key"` + + DeviceName string `json:"device_name"` + DeviceUUID string `json:"device_uuid"` + DeviceSerialID string `json:"device_serial_id"` + DeviceLabel string `json:"device_label"` + + Manufacturer string `json:"manufacturer"` + ModelName string `json:"model_name"` + InterfaceType string `json:"interface_type"` + InterfaceSpeed string `json:"interface_speed"` + SerialNumber string `json:"serial_number"` + Firmware string `json:"firmware"` + RotationSpeed int `json:"rotational_speed"` + Capacity int64 `json:"capacity"` + FormFactor string `json:"form_factor"` + SmartSupport bool `json:"smart_support"` + DeviceProtocol string `json:"device_protocol"` //protocol determines which smart attribute types are available (ATA, NVMe, SCSI) + DeviceType string `json:"device_type"` //device type is used for querying with -d/t flag, should only be used by collector. + + // User provided metadata + Label string `json:"label"` + HostId string `json:"host_id"` + + // Data set by Scrutiny + DeviceStatus pkg.DeviceStatus `json:"device_status"` +} +