don't do experiements anymore in droplets.proto

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-24 17:12:05 -05:00
parent 87b7bc17b3
commit 19a8dfe13d
4 changed files with 32 additions and 19 deletions

View File

@ -23,13 +23,10 @@ message Droplet {
int64 spice_port = 11; // preferred port to use for spice
repeated Network networks = 12; // really just mac addresses. should be unique across cluster
repeated Disk disks = 13; // disks to attach
repeated Disk disks = 13; // disks to attach
DropletState state = 14; // if the droplet is on, off, etc
// trying to figure out how this stuff should work
google.protobuf.Any testany = 15;
StorageInfo humantest = 16;
DropletState state = 14; // if the droplet is on, off, etc
string image_url = 15; // url to the image
}
enum DropletState {
@ -48,7 +45,3 @@ message Disk {
string filename = 1;
int64 size = 2;
}
message StorageInfo {
int64 capacity = 1; // Stores the storage capacity in bytes.
}

View File

@ -9,6 +9,9 @@ message Events {
string version = 2; // maybe can be used for protobuf schema change violations
int64 event_size = 3; // max events to store in a single
repeated Event events = 4; // all the events
// is it possible to have custom formatting in JSON and TEXT marshal/unmarshal ?
StorageInfo humantest = 5;
}
@ -40,3 +43,7 @@ enum EventType {
CRASH = 11; // droplet hard crashed
CHANGE = 12; // droplet or hypervisor config change
}
message StorageInfo {
int64 capacity = 1; // Stores the storage capacity in bytes.
}

View File

@ -107,13 +107,6 @@ func (c *Cluster) AddDroplet(uuid string, hostname string, cpus int, mem int) *D
d.Cpus = 1
}
d.Memory = SetGB(mem * 32)
if d.Humantest == nil {
var newInfo StorageInfo
newInfo = StorageInfo{Capacity: 64}
d.Humantest = &newInfo
} else {
d.Humantest.Capacity = SetGB(mem * 32)
}
c.Droplets = append(c.Droplets, d)
return d
}

View File

@ -40,6 +40,28 @@ func CreateSampleHypervisor(hostname string, mem int) *Hypervisor {
return h
}
func CreateSampleEvents(total int) *Events {
var e *Events
e = new(Events)
// info := StorageInfo{Capacity: 64}
// e.Humantest = &info
if e.Humantest == nil {
var newInfo StorageInfo
newInfo = StorageInfo{Capacity: 64}
e.Humantest = &newInfo
} else {
e.Humantest.Capacity = SetGB(total * 32)
}
for i := 0; i < total; i++ {
var newe *Event
newe = new(Event)
e.Events = append(e.Events, newe)
}
return e
}
func CreateSampleCluster(total int) *Cluster {
var c *Cluster
c = new(Cluster)
@ -53,8 +75,6 @@ func CreateSampleCluster(total int) *Cluster {
d.Cpus = 16
d.Memory = SetGB(256)
}
info := StorageInfo{Capacity: 64}
d.Humantest = &info
c.Droplets = append(c.Droplets, d)
}