various improvements
This commit is contained in:
@@ -23,6 +23,7 @@ func (c *CronTask) RunVmCheck(ctx context.Context, logger *slog.Logger) error {
|
||||
poweredOn string
|
||||
folderPath string
|
||||
rpName string
|
||||
vmUuid string
|
||||
)
|
||||
|
||||
dateCmp := time.Now().AddDate(0, 0, -1).Unix()
|
||||
@@ -60,6 +61,7 @@ func (c *CronTask) RunVmCheck(ctx context.Context, logger *slog.Logger) error {
|
||||
totalDiskGB = 0
|
||||
isTemplate = "FALSE"
|
||||
folderPath = ""
|
||||
vmUuid = ""
|
||||
} else {
|
||||
c.Logger.Debug("found VM")
|
||||
srmPlaceholder = "FALSE" // Default assumption
|
||||
@@ -69,6 +71,8 @@ func (c *CronTask) RunVmCheck(ctx context.Context, logger *slog.Logger) error {
|
||||
if vmObject.Config != nil {
|
||||
numRam = vmObject.Config.Hardware.MemoryMB
|
||||
numVcpus = vmObject.Config.Hardware.NumCPU
|
||||
vmUuid = vmObject.Config.Uuid
|
||||
|
||||
var totalDiskBytes int64
|
||||
|
||||
// Calculate the total disk allocated in GB
|
||||
@@ -148,6 +152,7 @@ func (c *CronTask) RunVmCheck(ctx context.Context, logger *slog.Logger) error {
|
||||
ProvisionedDisk: sql.NullFloat64{Float64: totalDiskGB, Valid: totalDiskGB > 0},
|
||||
Folder: sql.NullString{String: folderPath, Valid: folderPath != ""},
|
||||
ResourcePool: sql.NullString{String: rpName, Valid: rpName != ""},
|
||||
VmUuid: sql.NullString{String: vmUuid, Valid: vmUuid != ""},
|
||||
SrmPlaceholder: srmPlaceholder,
|
||||
IsTemplate: isTemplate,
|
||||
PoweredOn: poweredOn,
|
||||
|
Reference in New Issue
Block a user