log more info about disk additions
Some checks failed
continuous-integration/drone/push Build is passing
CI / Lint (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / End-to-End (push) Has been cancelled
CI / Publish Docker (push) Has been cancelled

This commit is contained in:
2024-09-16 16:54:59 +10:00
parent c122e775a3
commit 08568e3600
2 changed files with 43 additions and 7 deletions

View File

@@ -204,6 +204,14 @@ func (h *Handler) calculateNewDiskSize(event models.CloudEventReceived) float64
// Calculate the total disk allocated in GB
for _, device := range vmObject.Vm.Config.Hardware.Device {
if disk, ok := device.(*types.VirtualDisk); ok {
// Print the filename of the backing device
if backing, ok := disk.Backing.(*types.VirtualDiskFlatVer2BackingInfo); ok {
h.Logger.Debug("Adding disk", "size_bytes", disk.CapacityInBytes, "backing_file", backing.FileName)
} else {
h.Logger.Debug("Adding disk, unknown backing type", "size_bytes", disk.CapacityInBytes)
}
diskSize += float64(disk.CapacityInBytes / 1024 / 1024 / 1024) // Convert from bytes to GB
}
}