experiements

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-22 04:26:29 -05:00
parent e256f02cf8
commit ca0d4f423a
3 changed files with 13 additions and 6 deletions

View File

@ -34,7 +34,7 @@ func main() {
// show the hypervisors to STDOUT // show the hypervisors to STDOUT
for _, h := range aCluster.Hypervisors { for _, h := range aCluster.Hypervisors {
log.Println("\thypervisor =", h.Hostname, h.Memory) log.Println("\thypervisor =", h.Hostname, h.GetMemoryPrintable())
} }
} }

View File

@ -1,5 +1,12 @@
package virtbuf package virtbuf
func (x *Hypervisor) SetMemory(gb int) { import "fmt"
func (x *Hypervisor) SetMemoryGB(gb int) {
x.Memory = int64(gb * 1024 * 1024 * 1024) x.Memory = int64(gb * 1024 * 1024 * 1024)
} }
func (x *Hypervisor) GetMemoryPrintable() string {
i := x.Memory / (1024 * 1024 * 1024)
return fmt.Sprintf("%d GB", i)
}

View File

@ -35,7 +35,7 @@ func CreateSampleHypervisor(hostname string, mem int) *Hypervisor {
Memory: 256, Memory: 256,
Comment: "this is a fake hypervisor", Comment: "this is a fake hypervisor",
} }
h.SetMemory(mem * 32) h.SetMemoryGB(mem * 32)
return h return h
} }