From 4cdb13d89c5b932384de9f8fa542a4cbd852bca7 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 22 Oct 2024 14:40:59 -0500 Subject: [PATCH] attempt 'any' type Signed-off-by: Jeff Carr --- Makefile | 2 +- README.md | 2 ++ droplet.proto | 5 ++++- sampleData.go | 6 ++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 28de8aa..1d23b4c 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ all: make cluster.pb.go make -C configfile -vet: +vet: lint GO111MODULE=off go vet lint: diff --git a/README.md b/README.md index 06898f2..988cd43 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/droplet.proto b/droplet.proto index 7f54c63..eab564c 100644 --- a/droplet.proto +++ b/droplet.proto @@ -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; diff --git a/sampleData.go b/sampleData.go index 03af6ab..e310dec 100644 --- a/sampleData.go +++ b/sampleData.go @@ -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) }