diff options
| author | Jeff Carr <[email protected]> | 2025-02-22 17:45:50 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-22 17:45:50 -0600 |
| commit | 32e27530075a09f5c3b82ca6cbb83a01e34cb24c (patch) | |
| tree | bf1ad3f04ef77b2425385a4261e36d95909b6988 /validate.go | |
| parent | 9f9a52312e6e9538e7ec4c0eefbe46aace352fd3 (diff) | |
switch virtbuf to virtpbv0.2.36
Diffstat (limited to 'validate.go')
| -rw-r--r-- | validate.go | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/validate.go b/validate.go index 284bde3..e648813 100644 --- a/validate.go +++ b/validate.go @@ -22,7 +22,7 @@ import ( "github.com/google/uuid" - pb "go.wit.com/lib/protobuf/virtbuf" + "go.wit.com/lib/protobuf/virtpb" "go.wit.com/log" ) @@ -42,9 +42,9 @@ func ValidateUniqueMac(mac string) bool { } // records all the known paths. this should go in the protobuf -func addClusterFilepath(dir string) *pb.Event { +func addClusterFilepath(dir string) *virtpb.Event { var found bool = false - var e *pb.Event + var e *virtpb.Event for _, d := range me.cluster.Dirs { if d == dir { // found dir @@ -55,7 +55,7 @@ func addClusterFilepath(dir string) *pb.Event { if !found { if dir != "." { // make a new Add Event - e = pb.NewAddEvent(nil, "Add Cluster Directory", dir) + e = virtpb.NewAddEvent(nil, "Add Cluster Directory", dir) me.cluster.Dirs = append(me.cluster.Dirs, dir) } } @@ -63,7 +63,7 @@ func addClusterFilepath(dir string) *pb.Event { } // returns the droplet using a filename -func lookupFilename(filename string) *pb.Droplet { +func lookupFilename(filename string) *virtpb.Droplet { filebase := filepath.Base(filename) loop := me.cluster.DropletsAll() // get the list of droplets @@ -110,8 +110,8 @@ func ValidateUniqueFilenames() bool { return ok } -func ValidateDiskFilenames() ([]*pb.Event, error) { - var alle []*pb.Event +func ValidateDiskFilenames() ([]*virtpb.Event, error) { + var alle []*virtpb.Event loop := me.cluster.DropletsAll() // get the list of droplets for loop.Scan() { @@ -225,11 +225,11 @@ func ValidateDroplets() (map[string]string, map[string]string, error) { log.Info("duplicate UUID", d.Uuid, umap[d.Uuid]) log.Info("duplicate UUID", d.Uuid, d.Hostname) if d.Archive == nil { - d.Archive = new(pb.Archive) + d.Archive = new(virtpb.Archive) log.Info("d.Archive was nil for", d.Hostname) // os.Exit(-1) } - d.Archive.Reason = pb.DropletArchive_DUP + d.Archive.Reason = virtpb.DropletArchive_DUP continue // return umap, macs, errors.New("duplicate UUID: " + d.Uuid) } @@ -259,7 +259,7 @@ func searchForDuplicateUUIDs() { /* // remove from the slice func deleteDroplet(bad int) { - var all *pb.Droplets + var all *virtpb.Droplets all = me.cluster.DeleteDroplet(b *db.Droplet) fmt.Println("deleting", bad, all.Droplets[bad].Hostname) @@ -278,7 +278,7 @@ func deleteDroplet(bad int) { // check qemu domain id // check spice and vnc ports // check filenames -func ValidateDroplet(check *pb.Droplet) error { +func ValidateDroplet(check *virtpb.Droplet) error { // check for duplicate uuid's loop := me.cluster.DropletsAll() // get the list of droplets for loop.Scan() { @@ -290,12 +290,12 @@ func ValidateDroplet(check *pb.Droplet) error { // UUID already exists log.Info("duplicate UUID", d.Uuid, d.Hostname) log.Info("duplicate UUID", d.Uuid, check.Hostname) - // d.Archive = new(pb.DropletArchive) + // d.Archive = new(virtpb.DropletArchive) if d.Archive == nil { log.Info("d.Archive == nil") os.Exit(-1) } - d.Archive.Reason = pb.DropletArchive_DUP + d.Archive.Reason = virtpb.DropletArchive_DUP // return errors.New("duplicate UUID: " + d.Uuid) } } @@ -333,9 +333,9 @@ func ValidateDroplet(check *pb.Droplet) error { return nil } -func setUniqueSpicePort(check *pb.Droplet) error { - var ports map[int64]*pb.Droplet - ports = make(map[int64]*pb.Droplet) +func setUniqueSpicePort(check *virtpb.Droplet) error { + var ports map[int64]*virtpb.Droplet + ports = make(map[int64]*virtpb.Droplet) // check spice ports // checkn.SpicePort = getUniqueSpicePort() @@ -348,13 +348,13 @@ func setUniqueSpicePort(check *pb.Droplet) error { if dup, ok := ports[d.SpicePort]; ok { // dup := ports[d.SpicePort] log.Warn("duplicate ports", d.SpicePort, d.Hostname, d.Current.State) - if d.Current.State != pb.DropletState_ON { + if d.Current.State != virtpb.DropletState_ON { // hack for now. should be safe to erase this d.SpicePort = 0 log.Warn("erasing port for non-ON droplet", d.SpicePort, d.Hostname, d.Current.State) } log.Warn("duplicate ports", dup.SpicePort, dup.Hostname, dup.Current.State) - if dup.Current.State != pb.DropletState_ON { + if dup.Current.State != virtpb.DropletState_ON { // hack for now. should be safe to erase this dup.SpicePort = 0 log.Warn("erasing port for non-ON droplet", dup.SpicePort, dup.Hostname, dup.Current.State) |
