attempt 'any' type

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-22 14:40:59 -05:00
parent d52e39025e
commit 4cdb13d89c
4 changed files with 13 additions and 2 deletions

View File

@ -17,7 +17,7 @@ all:
make cluster.pb.go
make -C configfile
vet:
vet: lint
GO111MODULE=off go vet
lint:

View File

@ -4,3 +4,5 @@ They are what to use for starting droplets with virsh,
but for making a cluster or "home cloud" or something
like virtigo, I think it's going to be better to do
something simple. Anyway, this is that attmept.
Nonetheless, when possible, use the same names as libvirt

View File

@ -1,12 +1,14 @@
syntax = "proto3";
package virtbuf;
import "google/protobuf/any.proto";
message Droplet {
string uuid = 1;
string name = 2;
string hostname = 3;
int64 cpus = 4;
int64 memory = 5;
string memory = 5;
int64 disk = 6;
string base_image = 7;
@ -16,6 +18,7 @@ message Droplet {
string comment = 10;
string default_state = 11;
string preferred_hypervisor = 12;
google.protobuf.Any testany = 13;
message Network {
string mac = 1;

View File

@ -5,6 +5,7 @@ import (
"log"
"github.com/google/uuid"
// anypb "google.golang.org/protobuf/types/known/anypb"
)
//
@ -48,6 +49,11 @@ func CreateSampleCluster(total int) *Cluster {
d := CreateSampleDroplet(hostname)
d.Comment = fmt.Sprintf("Sample Droplet %d", i)
d.PreferredHypervisor = fmt.Sprintf("farm%d", i)
if d.PreferredHypervisor == "farm4" {
d.Cpus = 16
d.Memory = "256 MB"
// d.Memory = "258 MB"
}
c.Droplets = append(c.Droplets, d)
}