Compare commits
No commits in common. "master" and "v0.2.36" have entirely different histories.
16
add.go
16
add.go
|
@ -62,15 +62,13 @@ func (c *OldCluster) FindDropletByName(name string) *Droplet {
|
|||
}
|
||||
|
||||
func (c *OldCluster) FindDropletByUuid(id string) *Droplet {
|
||||
/*
|
||||
log.Info("START FIND", id)
|
||||
loop := c.d.All() // get the list of droplets
|
||||
for loop.Scan() {
|
||||
d := loop.Next()
|
||||
log.Info("droplet:", d.Hostname, d.Uuid)
|
||||
}
|
||||
log.Info("END FIND", id)
|
||||
*/
|
||||
log.Info("START FIND", id)
|
||||
loop := c.d.All() // get the list of droplets
|
||||
for loop.Scan() {
|
||||
d := loop.Next()
|
||||
log.Info("droplet:", d.Hostname, d.Uuid)
|
||||
}
|
||||
log.Info("END FIND", id)
|
||||
return c.d.FindByUuid(id)
|
||||
}
|
||||
|
||||
|
|
12
change.go
12
change.go
|
@ -73,7 +73,7 @@ func (d *Droplet) NewChangeEvent(fname string, origval any, newval any) *Event {
|
|||
var e *Event
|
||||
e = new(Event)
|
||||
|
||||
e.DropletName = d.Hostname
|
||||
e.Droplet = d.Hostname
|
||||
e.OrigVal = convertToString(origval)
|
||||
e.NewVal = convertToString(newval)
|
||||
e.FieldName = fname
|
||||
|
@ -99,12 +99,12 @@ func NewAddEvent(a any, fname string, newval any) *Event {
|
|||
case *Droplet:
|
||||
var d *Droplet
|
||||
d = a.(*Droplet)
|
||||
e.DropletName = d.Hostname
|
||||
e.Droplet = d.Hostname
|
||||
case nil:
|
||||
e.DropletName = "<nil>"
|
||||
e.Droplet = "<nil>"
|
||||
default:
|
||||
log.Info("newAddEvent() unknown type", v)
|
||||
e.DropletName = "on something somewhere"
|
||||
e.Droplet = "on something somewhere"
|
||||
}
|
||||
|
||||
e.NewVal = convertToString(newval)
|
||||
|
@ -177,7 +177,7 @@ func (c *OldCluster) ChangeDropletState(d *Droplet, newState DropletState) error
|
|||
var e *Event
|
||||
e = new(Event)
|
||||
|
||||
e.DropletName = d.Hostname
|
||||
e.Droplet = d.Hostname
|
||||
e.OrigVal = convertToString(d.Current.State)
|
||||
e.NewVal = convertToString(newState)
|
||||
e.FieldName = "status"
|
||||
|
@ -209,7 +209,7 @@ func (c *OldCluster) DropletMoved(d *Droplet, newh *Hypervisor) error {
|
|||
var e *Event
|
||||
e = new(Event)
|
||||
|
||||
e.DropletName = d.Hostname
|
||||
e.Droplet = d.Hostname
|
||||
e.OrigVal = d.Current.Hypervisor
|
||||
e.NewVal = newh.Hostname
|
||||
e.FieldName = "droplet migrate"
|
||||
|
|
|
@ -99,7 +99,7 @@ func (c *OldCluster) ConfigLoad() error {
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
log.Warn("ERROR HERE IN Hypervisors")
|
||||
fmt.Println("ERROR HERE IN Hypervisors")
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -108,11 +108,8 @@ func (c *OldCluster) ConfigLoad() error {
|
|||
// does it not stay allocated after this function ends?
|
||||
c.e = new(Events)
|
||||
}
|
||||
|
||||
if err := c.e.loadEvents(); err != nil {
|
||||
// ignore events.pb since these should be sent elsewhere
|
||||
log.Warn("Events failed to load, ignoring:", err)
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package virtpb;
|
|||
|
||||
import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
|
||||
import "google/protobuf/any.proto"; // Import the well-known type for Timestamp
|
||||
import "droplet.proto";
|
||||
|
||||
// global settings for autogenpb `autogenpb:no-sort` `autogenpb:mutex`
|
||||
|
||||
|
@ -27,7 +26,7 @@ message Event { // `autogenpb:marsh
|
|||
}
|
||||
int32 id = 1; // `autogenpb:unique` // should be unique across the cluster
|
||||
EventType etype = 2;
|
||||
string dropletName = 3; // name of the droplet
|
||||
string droplet = 3; // name of the droplet
|
||||
string dropletUuid = 4; // uuid of the droplet
|
||||
string hypervisor = 5; // name of the hypervisor
|
||||
string hypervisorUuid = 6; // uuid of the hypervisor
|
||||
|
@ -40,7 +39,6 @@ message Event { // `autogenpb:marsh
|
|||
google.protobuf.Any newAny = 13; // anypb format
|
||||
string error = 14; // what went wrong
|
||||
status state = 15; // state of the event
|
||||
Droplet droplet = 16; // droplet
|
||||
}
|
||||
enum EventType {
|
||||
ADD = 0;
|
||||
|
@ -56,5 +54,4 @@ enum EventType {
|
|||
FAIL = 10; // everything failed
|
||||
CRASH = 11; // droplet hard crashed
|
||||
CHANGE = 12; // droplet or hypervisor config change
|
||||
EDIT = 13; // edit droplet settings
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue