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
|
// Calculate the total disk allocated in GB
|
||||||
for _, device := range vmObject.Vm.Config.Hardware.Device {
|
for _, device := range vmObject.Vm.Config.Hardware.Device {
|
||||||
if disk, ok := device.(*types.VirtualDisk); ok {
|
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
|
diskSize += float64(disk.CapacityInBytes / 1024 / 1024 / 1024) // Convert from bytes to GB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -68,6 +68,7 @@ type ConfigChangesReceived struct {
|
|||||||
Modified string `json:"modified"`
|
Modified string `json:"modified"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This probably needs more fields added so not in use yet
|
||||||
type ConfigSpec struct {
|
type ConfigSpec struct {
|
||||||
AlternateGuestName string `json:"AlternateGuestName"`
|
AlternateGuestName string `json:"AlternateGuestName"`
|
||||||
Annotation string `json:"Annotation"`
|
Annotation string `json:"Annotation"`
|
||||||
@@ -86,6 +87,12 @@ type ConfigSpec struct {
|
|||||||
Backing any `json:"Backing"`
|
Backing any `json:"Backing"`
|
||||||
Device struct {
|
Device struct {
|
||||||
Backing 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"`
|
BackingObjectID string `json:"BackingObjectId"`
|
||||||
ChangeID string `json:"ChangeId"`
|
ChangeID string `json:"ChangeId"`
|
||||||
ContentID string `json:"ContentId"`
|
ContentID string `json:"ContentId"`
|
||||||
@@ -108,17 +115,39 @@ type ConfigSpec struct {
|
|||||||
UUID string `json:"Uuid"`
|
UUID string `json:"Uuid"`
|
||||||
WriteThrough any `json:"WriteThrough"`
|
WriteThrough any `json:"WriteThrough"`
|
||||||
} `json:"Backing"`
|
} `json:"Backing"`
|
||||||
CapacityInBytes int `json:"CapacityInBytes"`
|
CapacityInBytes int `json:"CapacityInBytes"`
|
||||||
CapacityInKB int `json:"CapacityInKB"`
|
CapacityInKB int `json:"CapacityInKB"`
|
||||||
Connectable any `json:"Connectable"`
|
Connectable struct {
|
||||||
ControllerKey int `json:"ControllerKey"`
|
AllowGuestControl bool `json:"AllowGuestControl"`
|
||||||
DeviceInfo any `json:"DeviceInfo"`
|
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"`
|
DiskObjectID string `json:"DiskObjectId"`
|
||||||
Iofilter any `json:"Iofilter"`
|
Iofilter any `json:"Iofilter"`
|
||||||
Key int `json:"Key"`
|
Key int `json:"Key"`
|
||||||
NativeUnmanagedLinkedClone any `json:"NativeUnmanagedLinkedClone"`
|
NativeUnmanagedLinkedClone any `json:"NativeUnmanagedLinkedClone"`
|
||||||
Shares any `json:"Shares"`
|
Shares any `json:"Shares"`
|
||||||
SlotInfo any `json:"SlotInfo"`
|
|
||||||
StorageIOAllocation struct {
|
StorageIOAllocation struct {
|
||||||
Limit int `json:"Limit"`
|
Limit int `json:"Limit"`
|
||||||
Reservation any `json:"Reservation"`
|
Reservation any `json:"Reservation"`
|
||||||
@@ -127,7 +156,6 @@ type ConfigSpec struct {
|
|||||||
Shares int `json:"Shares"`
|
Shares int `json:"Shares"`
|
||||||
} `json:"Shares"`
|
} `json:"Shares"`
|
||||||
} `json:"StorageIOAllocation"`
|
} `json:"StorageIOAllocation"`
|
||||||
UnitNumber int `json:"UnitNumber"`
|
|
||||||
VDiskID any `json:"VDiskId"`
|
VDiskID any `json:"VDiskId"`
|
||||||
VFlashCacheConfigInfo any `json:"VFlashCacheConfigInfo"`
|
VFlashCacheConfigInfo any `json:"VFlashCacheConfigInfo"`
|
||||||
} `json:"Device"`
|
} `json:"Device"`
|
||||||
|
Reference in New Issue
Block a user