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 cluster.pb.go
make -C configfile make -C configfile
vet: vet: lint
GO111MODULE=off go vet GO111MODULE=off go vet
lint: 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 but for making a cluster or "home cloud" or something
like virtigo, I think it's going to be better to do like virtigo, I think it's going to be better to do
something simple. Anyway, this is that attmept. something simple. Anyway, this is that attmept.
Nonetheless, when possible, use the same names as libvirt

View File

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

View File

@ -5,6 +5,7 @@ import (
"log" "log"
"github.com/google/uuid" "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 := CreateSampleDroplet(hostname)
d.Comment = fmt.Sprintf("Sample Droplet %d", i) d.Comment = fmt.Sprintf("Sample Droplet %d", i)
d.PreferredHypervisor = fmt.Sprintf("farm%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) c.Droplets = append(c.Droplets, d)
} }