Skip to content

Instantly share code, notes, and snippets.

@codegold79
Created October 2, 2020 02:48
Show Gist options
  • Select an option

  • Save codegold79/e9426fa69832252c55e5342ba0733fc7 to your computer and use it in GitHub Desktop.

Select an option

Save codegold79/e9426fa69832252c55e5342ba0733fc7 to your computer and use it in GitHub Desktop.
func currentConfigs(ctx context.Context, moVM mo.VirtualMachine) []vmConfig {
configs := make([]vmConfig, 6)
configs[0] = vmConfig{name: "numCPU", valInt: int(moVM.Config.Hardware.NumCPU)}
configs[1] = vmConfig{name: "memoryMB", valInt: int(moVM.Config.Hardware.MemoryMB)}
configs[2] = vmConfig{name: "numCoresPerSocket", valInt: int(moVM.Config.Hardware.NumCoresPerSocket)}
if moVM.Config.MemoryHotAddEnabled != nil {
configs[3] = vmConfig{name: "memoryHotAddEnabled", valBool: *moVM.Config.MemoryHotAddEnabled}
}
if moVM.Config.CpuHotRemoveEnabled != nil {
configs[4] = vmConfig{name: "cpuHotRemoveEnabled", valBool: *moVM.Config.CpuHotRemoveEnabled}
}
if moVM.Config.CpuHotAddEnabled != nil {
configs[5] = vmConfig{name: "cpuHotRemoveEnabled", valBool: *moVM.Config.CpuHotAddEnabled}
}
if debug {
log.Println("Current VM configurations:", configs)
}
return configs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment