summaryrefslogtreecommitdiff
path: root/droplet.proto
blob: f1bba16a6f0498e4dca9b4df25002cfc9b873904 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
syntax = "proto3";
package virtpb;

import "google/protobuf/duration.proto"; // Import the well-known type for Timestamp
import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp

// global settings for autogenpb `autogenpb:mutex`

message Droplets {                                                // `autogenpb:marshal` `autogenpb:gui`
        string                      uuid                    = 1;  // `autogenpb:uuid:d5d492e2-38d4-476b-86f3-f5abf01f9d6d`
        string                      version                 = 2;  // `autogenpb:version:v0.0.1`
        repeated Droplet            droplets                = 3;
}

message Droplet {                                                 // `autogenpb:marshal`
        string                      uuid                    = 1;  // `autogenpb:unique` // should be unique across the cluster
        string                      hostname                = 2;  // `autogenpb:unique` // should be unique and work in DNS
        int64                       cpus                    = 3;  // what's the point of int64 vs int32
        int64                       memory                  = 4;  // in bytes
        Current                     current                 = 5;  // what the state and values of the droplet is
        DropletState                startState              = 6;  // what the state of the droplet is SUPPOSED TO BE ('on' or 'off')
        string                      qemuMachine             = 7;  // the qemu machine type to use "pc-q35-9.0"
        int64                       spicePort               = 8;  // preferred port to use for spice

        string                      preferredHypervisor     = 9;  // the hypervisor to prefer to run the droplet on
        string                      forceHypervisor         = 10; // use this hypervisor and this hypervisor only
        string                      preferredArch           = 11; // the cpu arch to use "x86_64" (should really get this from the disk?)
        repeated Network            networks                = 12; // really just mac addresses. should be unique across cluster
        repeated Disk               disks                   = 13; // disks to attach

        string                      localOnly               = 14; // this is only defined locally on the hypervisor
        string                      customXml               = 15; // if needed,
        Archive                     archive                 = 16; // what the state of the droplet is SUPPOSED TO BE ('on' or 'off')

        google.protobuf.Timestamp   unstable                = 39; // the last time we heard anything from this droplet
        google.protobuf.Duration    unstableTimeout         = 40; // the last time we heard anything from this droplet
}

// volatile data. the current settings and values of things.
// These are passed around while the cluster to monitor and control the systems
// but they are not saved to the config file
message Current {
        DropletState                state                   = 1;  // used to track the current state before taking any action
        string                      hypervisor              = 2;  // the current hypervisor the droplet is running on
        int64                       startAttempts           = 3;  // how many times a start has been attempted
        string                      fullXml                 = 4;  // the full libvirt xml to import
        google.protobuf.Timestamp   lastPoll                = 5;  // the last time we heard anything from this droplet
        string                      imageUrl                = 6;  // url to the image
        google.protobuf.Timestamp   offSince                = 7;  // when the droplet was turned off
        google.protobuf.Timestamp   onSince                 = 8;  // when the droplet was turned on
}

message Archive {
        DropletArchive              reason                  = 1;  // why the droplet was archived
        google.protobuf.Timestamp   when                    = 2;  // when it was archived
}

enum DropletState {
        ON              = 0;
        OFF             = 1;
        UNKNOWN         = 2; // qemu says 'Shutdown'
        PAUSED          = 3;
        CRASHED         = 4;
        INMIGRATE       = 5;
}

enum DropletArchive {
        DUP     = 0;
        USER    = 1;
}

message Network {
        string                      mac                     = 1;
        string                      name                    = 2;
}

message Disk {
        string                      filename                = 1;
        string                      filepath                = 2;
        int64                       size                    = 3;
        string                      qemuArch                = 4;  // what arch. example: "x86_64" or "riscv64"
}