From 1a72fdceef64e6cba22db71e3383e85a112862dc Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 1 Nov 2024 08:45:52 -0500 Subject: [PATCH] set preferred hypervisor Signed-off-by: Jeff Carr --- add.go | 4 ++++ human.go | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/add.go b/add.go index a7f9b7a..21e9142 100644 --- a/add.go +++ b/add.go @@ -125,6 +125,10 @@ func (c *NewCluster) AddDropletLocal(name string, hypername string) *Droplet { Hostname: name, } d.LocalOnly = "yes on: " + hypername + + // by default, on locally imported domains, set the preferred hypervisor! + d.PreferredHypervisor = hypername + d.Current = new(Current) d.Current.Hypervisor = hypername d.StartState = DropletState_OFF diff --git a/human.go b/human.go index f9c5af4..1f7cdcf 100644 --- a/human.go +++ b/human.go @@ -110,11 +110,10 @@ func FormatDuration(d time.Duration) string { } func (d *Droplet) SprintHeader() string { - header := fmt.Sprintf("%-3.3s %-9.9s %-20.20s", d.Current.State, d.Current.Hypervisor, d.Hostname) - if d.Current == nil { d.Current = new(Current) } + header := fmt.Sprintf("%-3.3s %-9.9s %-20.20s", d.Current.State, d.Current.Hypervisor, d.Hostname) switch d.Current.State { case DropletState_ON: