diff options
| author | Jeff Carr <[email protected]> | 2025-04-21 20:43:59 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-04-21 20:54:44 -0500 | 
| commit | 2c5701eecad39fd77010f1886d5ad4cd3ad2d34f (patch) | |
| tree | 22ea55c8bc893b61a8b2c7877ed27c1981691aae | |
| parent | a24448a9d4205dbe389b6f92fdc75a3349a0ef0e (diff) | |
droplet start workedv0.2.53
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | doAdminGui.go | 9 | ||||
| -rw-r--r-- | doDroplet.go | 3 | ||||
| -rw-r--r-- | doList.go | 3 | ||||
| -rw-r--r-- | start.go | 15 | 
5 files changed, 25 insertions, 9 deletions
@@ -10,8 +10,8 @@ all: install  	@echo build worked  	virtigo list droplets  	virtigo list droplets --on -	virtigo droplet show --name coriolis -	virtigo droplet start --name coriolis +	virtigo droplet show --name check.lab.wit.org +	virtigo droplet start --name check.lab.wit.org  build: goimports vet  	GO111MODULE=off go build \ diff --git a/doAdminGui.go b/doAdminGui.go index 6418d9b..544ee06 100644 --- a/doAdminGui.go +++ b/doAdminGui.go @@ -290,6 +290,8 @@ func (admin *adminT) makeClusterGroup(c *virtpb.Cluster) {  	if admin.cluster == nil {  		admin.cluster = new(virtpb.Cluster) +		admin.cluster.Name = c.Name +		admin.cluster.Uuid = c.Uuid  	}  	name := c.GetName() @@ -355,7 +357,7 @@ func (admin *adminT) makeClusterGroup(c *virtpb.Cluster) {  	})  	grid.NewButton("save cluster.pb", func() { -		admin.refresh() +		admin.cluster.ConfigSave()  	})  } @@ -404,6 +406,9 @@ func (admin *adminT) postEvent(e *virtpb.Event) error {  			return err  		}  	} -	log.Printf("Event type: %s\n", result.DropletUuid) +	if result.Error != "" { +		return fmt.Errorf(result.Error) +	} +	log.Printf("Event worked: %s\n", result.DropletUuid)  	return nil  } diff --git a/doDroplet.go b/doDroplet.go index 38d9903..89e88e7 100644 --- a/doDroplet.go +++ b/doDroplet.go @@ -106,6 +106,9 @@ func doEvent(e *virtpb.Event) *virtpb.Event {  		rs, err := Start(e.DropletUuid)  		log.Println("Start() returned", rs)  		log.Println("Start() returned err", err) +		if err != nil { +			result.Error = fmt.Sprintf("%v", err) +		}  	}  	return result @@ -58,6 +58,9 @@ func doList() {  		all := admin.cluster.Droplets.All()  		for all.Scan() {  			vm := all.Next() +			if vm.Current == nil { +				continue +			}  			if argv.List.On && (vm.Current.State == virtpb.DropletState_OFF) {  				continue  			} @@ -38,7 +38,7 @@ func Start(id string) (string, error) {  	}  	// lookup the droplet by name -	d := me.cluster.FindDropletByName(id) +	d := me.cluster.FindDropletByUuid(id)  	if d == nil {  		result = "can't start unknown droplet: " + id  		return result, errors.New(result) @@ -51,10 +51,15 @@ func Start(id string) (string, error) {  		return result, err  	} -	// is the droplet already on? -	if d.Current.State == virtpb.DropletState_ON { -		result = "EVENT start droplet " + d.Hostname + " is already ON" -		return result, errors.New(result) +	if d.Current == nil { +		// result = d.Hostname + " d.Current == nil" +		// return result, errors.New(result) + +		// is the droplet already on? +		if d.Current.State == virtpb.DropletState_ON { +			result = "EVENT start droplet " + d.Hostname + " is already ON" +			return result, errors.New(result) +		}  	}  	// make the list of hypervisors that are active and can start new droplets  | 
