log more info about disk additions
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
@@ -68,6 +68,7 @@ type ConfigChangesReceived struct {
|
||||
Modified string `json:"modified"`
|
||||
}
|
||||
|
||||
// This probably needs more fields added so not in use yet
|
||||
type ConfigSpec struct {
|
||||
AlternateGuestName string `json:"AlternateGuestName"`
|
||||
Annotation string `json:"Annotation"`
|
||||
@@ -86,6 +87,12 @@ type ConfigSpec struct {
|
||||
Backing any `json:"Backing"`
|
||||
Device struct {
|
||||
Backing struct {
|
||||
Port struct {
|
||||
ConnectionCookie int `json:"ConnectionCookie"`
|
||||
PortKey string `json:"PortKey"`
|
||||
PortgroupKey string `json:"PortgroupKey"`
|
||||
SwitchUUID string `json:"SwitchUuid"`
|
||||
} `json:"Port"`
|
||||
BackingObjectID string `json:"BackingObjectId"`
|
||||
ChangeID string `json:"ChangeId"`
|
||||
ContentID string `json:"ContentId"`
|
||||
@@ -108,17 +115,39 @@ type ConfigSpec struct {
|
||||
UUID string `json:"Uuid"`
|
||||
WriteThrough any `json:"WriteThrough"`
|
||||
} `json:"Backing"`
|
||||
CapacityInBytes int `json:"CapacityInBytes"`
|
||||
CapacityInKB int `json:"CapacityInKB"`
|
||||
Connectable any `json:"Connectable"`
|
||||
ControllerKey int `json:"ControllerKey"`
|
||||
DeviceInfo any `json:"DeviceInfo"`
|
||||
CapacityInBytes int `json:"CapacityInBytes"`
|
||||
CapacityInKB int `json:"CapacityInKB"`
|
||||
Connectable struct {
|
||||
AllowGuestControl bool `json:"AllowGuestControl"`
|
||||
Connected bool `json:"Connected"`
|
||||
MigrateConnect string `json:"MigrateConnect"`
|
||||
StartConnected bool `json:"StartConnected"`
|
||||
Status string `json:"Status"`
|
||||
} `json:"Connectable"`
|
||||
ControllerKey int `json:"ControllerKey"`
|
||||
DeviceInfo struct {
|
||||
Label string `json:"Label"`
|
||||
Summary string `json:"Summary"`
|
||||
} `json:"DeviceInfo"`
|
||||
ExternalID string `json:"ExternalId"`
|
||||
MacAddress string `json:"MacAddress"`
|
||||
ResourceAllocation struct {
|
||||
Limit int `json:"Limit"`
|
||||
Reservation int `json:"Reservation"`
|
||||
Share struct {
|
||||
Level string `json:"Level"`
|
||||
Shares int `json:"Shares"`
|
||||
} `json:"Share"`
|
||||
} `json:"ResourceAllocation"`
|
||||
SlotInfo any `json:"SlotInfo"`
|
||||
UnitNumber int `json:"UnitNumber"`
|
||||
UptCompatibilityEnabled bool `json:"UptCompatibilityEnabled"`
|
||||
WakeOnLanEnabled bool `json:"WakeOnLanEnabled"`
|
||||
DiskObjectID string `json:"DiskObjectId"`
|
||||
Iofilter any `json:"Iofilter"`
|
||||
Key int `json:"Key"`
|
||||
NativeUnmanagedLinkedClone any `json:"NativeUnmanagedLinkedClone"`
|
||||
Shares any `json:"Shares"`
|
||||
SlotInfo any `json:"SlotInfo"`
|
||||
StorageIOAllocation struct {
|
||||
Limit int `json:"Limit"`
|
||||
Reservation any `json:"Reservation"`
|
||||
@@ -127,7 +156,6 @@ type ConfigSpec struct {
|
||||
Shares int `json:"Shares"`
|
||||
} `json:"Shares"`
|
||||
} `json:"StorageIOAllocation"`
|
||||
UnitNumber int `json:"UnitNumber"`
|
||||
VDiskID any `json:"VDiskId"`
|
||||
VFlashCacheConfigInfo any `json:"VFlashCacheConfigInfo"`
|
||||
} `json:"Device"`
|
||||
|
Reference in New Issue
Block a user