parent
8cab0857fd
commit
e256f02cf8
|
@ -26,7 +26,7 @@ func main() {
|
|||
log.Fatalln("Failed to parse droplet:", err)
|
||||
}
|
||||
|
||||
// log.Println(aCluster)
|
||||
log.Println(aCluster.String())
|
||||
// show the droplets to STDOUT
|
||||
for _, d := range aCluster.Droplets {
|
||||
log.Println("\tdroplet =", d.Hostname, "preffered host:", d.PreferredHypervisor)
|
||||
|
@ -34,7 +34,7 @@ func main() {
|
|||
|
||||
// show the hypervisors to STDOUT
|
||||
for _, h := range aCluster.Hypervisors {
|
||||
log.Println("\thypervisor =", h.Hostname)
|
||||
log.Println("\thypervisor =", h.Hostname, h.Memory)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package virtbuf
|
||||
|
||||
func (x *Hypervisor) SetMemory(gb int) {
|
||||
x.Memory = int64(gb * 1024 * 1024 * 1024)
|
||||
}
|
|
@ -25,7 +25,7 @@ func CreateSampleDroplet(hostname string) *Droplet {
|
|||
return d
|
||||
}
|
||||
|
||||
func CreateSampleHypervisor(hostname string) *Hypervisor {
|
||||
func CreateSampleHypervisor(hostname string, mem int) *Hypervisor {
|
||||
// Generate a new UUID
|
||||
id := uuid.New()
|
||||
h := &Hypervisor{
|
||||
|
@ -35,6 +35,7 @@ func CreateSampleHypervisor(hostname string) *Hypervisor {
|
|||
Memory: 256,
|
||||
Comment: "this is a fake hypervisor",
|
||||
}
|
||||
h.SetMemory(mem * 32)
|
||||
return h
|
||||
}
|
||||
|
||||
|
@ -53,7 +54,7 @@ func CreateSampleCluster(total int) *Cluster {
|
|||
|
||||
for i := 0; i < 3; i++ {
|
||||
hostname := fmt.Sprintf("farm%d", i)
|
||||
h := CreateSampleHypervisor(hostname)
|
||||
h := CreateSampleHypervisor(hostname, i + 1)
|
||||
h.Comment = fmt.Sprintf("Sample hypervisor %d", i)
|
||||
|
||||
c.Hypervisors = append(c.Hypervisors, h)
|
||||
|
|
Loading…
Reference in New Issue