treewide: Fix ENUM_VALUE_PREFIX rule exception
Change-Id: Ibc2fd66711f6aa347e88e2379c12db1898373700
Reviewed-on: https://review.monogon.dev/c/monogon/+/3804
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/metropolis/cli/dbg/main.go b/metropolis/cli/dbg/main.go
index 3bb762e..e9e43be 100644
--- a/metropolis/cli/dbg/main.go
+++ b/metropolis/cli/dbg/main.go
@@ -92,22 +92,22 @@
dn := logsCmd.Arg(0)
req := &apb.GetLogsRequest{
Dn: dn,
- BacklogMode: apb.GetLogsRequest_BACKLOG_DISABLE,
- StreamMode: apb.GetLogsRequest_STREAM_DISABLE,
+ BacklogMode: apb.GetLogsRequest_BACKLOG_MODE_DISABLE,
+ StreamMode: apb.GetLogsRequest_STREAM_MODE_DISABLE,
Filters: nil,
}
switch *logsTailN {
case 0:
case -1:
- req.BacklogMode = apb.GetLogsRequest_BACKLOG_ALL
+ req.BacklogMode = apb.GetLogsRequest_BACKLOG_MODE_ALL
default:
- req.BacklogMode = apb.GetLogsRequest_BACKLOG_COUNT
+ req.BacklogMode = apb.GetLogsRequest_BACKLOG_MODE_COUNT
req.BacklogCount = int64(*logsTailN)
}
if *logsStream {
- req.StreamMode = apb.GetLogsRequest_STREAM_UNBUFFERED
+ req.StreamMode = apb.GetLogsRequest_STREAM_MODE_UNBUFFERED
}
if *logsRecursive {
diff --git a/metropolis/cli/metroctl/cmd_node.go b/metropolis/cli/metroctl/cmd_node.go
index 941d6f6..a875725 100644
--- a/metropolis/cli/metroctl/cmd_node.go
+++ b/metropolis/cli/metroctl/cmd_node.go
@@ -102,11 +102,11 @@
var am apb.ActivationMode
switch strings.ToLower(activationMode) {
case "none":
- am = apb.ActivationMode_ACTIVATION_NONE
+ am = apb.ActivationMode_ACTIVATION_MODE_NONE
case "reboot":
- am = apb.ActivationMode_ACTIVATION_REBOOT
+ am = apb.ActivationMode_ACTIVATION_MODE_REBOOT
case "kexec":
- am = apb.ActivationMode_ACTIVATION_KEXEC
+ am = apb.ActivationMode_ACTIVATION_MODE_KEXEC
default:
return fmt.Errorf("invalid value for flag activation-mode")
}
@@ -214,7 +214,7 @@
continue
}
s := nodes[0]
- if s.Health == apb.Node_HEALTHY {
+ if s.Health == apb.Node_HEALTH_HEALTHY {
if s.Status != nil && s.Status.Version != nil {
log.Printf("node %s updated in %v to version %s", s.Id, time.Since(start), version.Semver(s.Status.Version))
} else {
@@ -378,15 +378,15 @@
}
var req apb.RebootRequest
if kexecFlag {
- req.Type = apb.RebootRequest_KEXEC
+ req.Type = apb.RebootRequest_TYPE_KEXEC
} else {
- req.Type = apb.RebootRequest_FIRMWARE
+ req.Type = apb.RebootRequest_TYPE_FIRMWARE
}
if firmwareFlag {
- req.NextBoot = apb.RebootRequest_START_FIRMWARE_UI
+ req.NextBoot = apb.RebootRequest_NEXT_BOOT_START_FIRMWARE_UI
}
if rollbackFlag {
- req.NextBoot = apb.RebootRequest_START_ROLLBACK
+ req.NextBoot = apb.RebootRequest_NEXT_BOOT_START_ROLLBACK
}
nmgmt, err := dialNode(ctx, args[0])
@@ -417,7 +417,7 @@
}
if _, err := nmgmt.Reboot(ctx, &apb.RebootRequest{
- Type: apb.RebootRequest_POWER_OFF,
+ Type: apb.RebootRequest_TYPE_POWER_OFF,
}); err != nil {
return fmt.Errorf("reboot RPC failed: %w", err)
}
diff --git a/metropolis/cli/metroctl/cmd_node_logs.go b/metropolis/cli/metroctl/cmd_node_logs.go
index 0b732de..b06a9f7 100644
--- a/metropolis/cli/metroctl/cmd_node_logs.go
+++ b/metropolis/cli/metroctl/cmd_node_logs.go
@@ -94,9 +94,9 @@
}
nmgmt := api.NewNodeManagementClient(cl)
- streamMode := api.GetLogsRequest_STREAM_DISABLE
+ streamMode := api.GetLogsRequest_STREAM_MODE_DISABLE
if logFlags.follow {
- streamMode = api.GetLogsRequest_STREAM_UNBUFFERED
+ streamMode = api.GetLogsRequest_STREAM_MODE_UNBUFFERED
}
var filters []*cpb.LogFilter
if !logFlags.exact {
@@ -106,14 +106,14 @@
},
})
}
- backlogMode := api.GetLogsRequest_BACKLOG_ALL
+ backlogMode := api.GetLogsRequest_BACKLOG_MODE_ALL
var backlogCount int64
switch {
case logFlags.backlog > 0:
- backlogMode = api.GetLogsRequest_BACKLOG_COUNT
+ backlogMode = api.GetLogsRequest_BACKLOG_MODE_COUNT
backlogCount = int64(logFlags.backlog)
case logFlags.backlog == 0:
- backlogMode = api.GetLogsRequest_BACKLOG_DISABLE
+ backlogMode = api.GetLogsRequest_BACKLOG_MODE_DISABLE
}
srv, err := nmgmt.Logs(ctx, &api.GetLogsRequest{
diff --git a/metropolis/cli/metroctl/table_node.go b/metropolis/cli/metroctl/table_node.go
index 2f8317d..0ef23d8 100644
--- a/metropolis/cli/metroctl/table_node.go
+++ b/metropolis/cli/metroctl/table_node.go
@@ -23,7 +23,10 @@
address = n.Status.ExternalAddress
}
res.Add("address", address)
- res.Add("health", n.Health.String())
+
+ health := n.Health.String()
+ health = strings.ReplaceAll(health, "HEALTH_", "")
+ res.Add("health", health)
var roles []string
if n.Roles.ConsensusMember != nil {
@@ -40,11 +43,11 @@
tpm := "unk"
switch n.TpmUsage {
- case cpb.NodeTPMUsage_NODE_TPM_PRESENT_AND_USED:
+ case cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_AND_USED:
tpm = "yes"
- case cpb.NodeTPMUsage_NODE_TPM_PRESENT_BUT_UNUSED:
+ case cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_BUT_UNUSED:
tpm = "unused"
- case cpb.NodeTPMUsage_NODE_TPM_NOT_PRESENT:
+ case cpb.NodeTPMUsage_NODE_TPM_USAGE_NOT_PRESENT:
tpm = "no"
}
res.Add("tpm", tpm)
diff --git a/metropolis/node/core/abloader/spec/BUILD.bazel b/metropolis/node/core/abloader/spec/BUILD.bazel
index 035dc4d..53d30a1 100644
--- a/metropolis/node/core/abloader/spec/BUILD.bazel
+++ b/metropolis/node/core/abloader/spec/BUILD.bazel
@@ -8,7 +8,6 @@
name = "abloader_proto_lint_test",
except_rules = [
"PACKAGE_VERSION_SUFFIX",
- "ENUM_VALUE_PREFIX", # TODO: evaluate correctness
"ENUM_ZERO_VALUE_SUFFIX", # TODO: evaluate correctness
],
protos = [":abloader_proto"],
diff --git a/metropolis/node/core/abloader/spec/abloader.proto b/metropolis/node/core/abloader/spec/abloader.proto
index d38b558..a86cb90 100644
--- a/metropolis/node/core/abloader/spec/abloader.proto
+++ b/metropolis/node/core/abloader/spec/abloader.proto
@@ -3,9 +3,9 @@
package metropolis.node.core.abloader.spec;
enum Slot {
- NONE = 0;
- A = 1;
- B = 2;
+ SLOT_NONE = 0;
+ SLOT_A = 1;
+ SLOT_B = 2;
}
// ABLoaderData contains data the A/B loader needs to chose which slot to boot
diff --git a/metropolis/node/core/cluster/cluster.go b/metropolis/node/core/cluster/cluster.go
index 1d3135c..e320bb0 100644
--- a/metropolis/node/core/cluster/cluster.go
+++ b/metropolis/node/core/cluster/cluster.go
@@ -76,7 +76,7 @@
close(m.oneway)
// Try sealed configuration first.
- configuration, err := m.storageRoot.ESP.Metropolis.SealedConfiguration.Unseal(cpb.NodeTPMUsage_NODE_TPM_PRESENT_AND_USED)
+ configuration, err := m.storageRoot.ESP.Metropolis.SealedConfiguration.Unseal(cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_AND_USED)
if err == nil {
supervisor.Logger(ctx).Info("Sealed configuration present. attempting to join cluster")
@@ -94,7 +94,7 @@
return fmt.Errorf("unexpected sealed config error: %w", err)
}
- configuration, err = m.storageRoot.ESP.Metropolis.SealedConfiguration.Unseal(cpb.NodeTPMUsage_NODE_TPM_NOT_PRESENT)
+ configuration, err = m.storageRoot.ESP.Metropolis.SealedConfiguration.Unseal(cpb.NodeTPMUsage_NODE_TPM_USAGE_NOT_PRESENT)
if err == nil {
supervisor.Logger(ctx).Info("Non-sealed configuration present. attempting to join cluster")
diff --git a/metropolis/node/core/curator/impl_leader_curator.go b/metropolis/node/core/curator/impl_leader_curator.go
index d4e8d1a..0246498 100644
--- a/metropolis/node/core/curator/impl_leader_curator.go
+++ b/metropolis/node/core/curator/impl_leader_curator.go
@@ -563,10 +563,10 @@
}
}
- if node.tpmUsage == cpb.NodeTPMUsage_NODE_TPM_PRESENT_AND_USED && !req.UsingSealedConfiguration {
+ if node.tpmUsage == cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_AND_USED && !req.UsingSealedConfiguration {
return nil, status.Errorf(codes.PermissionDenied, "node registered with TPM, cannot join without one")
}
- if node.tpmUsage != cpb.NodeTPMUsage_NODE_TPM_PRESENT_AND_USED && req.UsingSealedConfiguration {
+ if node.tpmUsage != cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_AND_USED && req.UsingSealedConfiguration {
return nil, status.Errorf(codes.PermissionDenied, "node registered without TPM, cannot join with one")
}
diff --git a/metropolis/node/core/curator/impl_leader_management.go b/metropolis/node/core/curator/impl_leader_management.go
index 0666e9d..f6fe159 100644
--- a/metropolis/node/core/curator/impl_leader_management.go
+++ b/metropolis/node/core/curator/impl_leader_management.go
@@ -161,19 +161,19 @@
// If no heartbeats were received, but the leadership has only just
// started, the node's health is unknown.
case nts.IsZero() && (now.Sub(l.ls.startTs) < HeartbeatTimeout):
- nh = apb.Node_UNKNOWN
+ nh = apb.Node_HEALTH_UNKNOWN
// If the leader had received heartbeats from the node, but the last
// heartbeat is stale, the node is timing out.
case lhb > HeartbeatTimeout:
- nh = apb.Node_HEARTBEAT_TIMEOUT
+ nh = apb.Node_HEALTH_HEARTBEAT_TIMEOUT
// Otherwise, the node can be declared healthy.
default:
- nh = apb.Node_HEALTHY
+ nh = apb.Node_HEALTH_HEALTHY
}
} else {
// Since node isn't UP, its health is unknown. Non-UP nodes can't access
// the heartbeat RPC.
- nh = apb.Node_UNKNOWN
+ nh = apb.Node_HEALTH_UNKNOWN
}
return nh, lhb
}
diff --git a/metropolis/node/core/curator/impl_leader_test.go b/metropolis/node/core/curator/impl_leader_test.go
index 94fcd0c..36b0c53 100644
--- a/metropolis/node/core/curator/impl_leader_test.go
+++ b/metropolis/node/core/curator/impl_leader_test.go
@@ -117,7 +117,7 @@
ID: nodeID,
Pubkey: nodePub,
JPub: nodeJoinPub,
- TPMUsage: cpb.NodeTPMUsage_NODE_TPM_PRESENT_AND_USED,
+ TPMUsage: cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_AND_USED,
})
// Here we would enable the leader node's roles. But for tests, we don't enable
@@ -840,7 +840,7 @@
pubkey: npub,
jkey: jpub,
state: cpb.NodeState_NODE_STATE_UP,
- tpmUsage: cpb.NodeTPMUsage_NODE_TPM_PRESENT_AND_USED,
+ tpmUsage: cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_AND_USED,
}
if err := nodeSave(ctx, cl.l, &node); err != nil {
t.Fatalf("nodeSave failed: %v", err)
@@ -983,13 +983,13 @@
// with no recorded node heartbeats. In this case the node's health is
// UNKNOWN, since it wasn't given enough time to submit a single heartbeat.
cl.l.ls.startTs = time.Now()
- expectNode(cl.localNodeID, apb.Node_UNKNOWN)
+ expectNode(cl.localNodeID, apb.Node_HEALTH_UNKNOWN)
// Let's turn the clock forward a bit. In this case the node is still UP,
// but the current leadership has been assumed more than HeartbeatTimeout
// ago. If no heartbeats arrived during this period, the node is timing out.
cl.l.ls.startTs = cl.l.ls.startTs.Add(-HeartbeatTimeout)
- expectNode(cl.localNodeID, apb.Node_HEARTBEAT_TIMEOUT)
+ expectNode(cl.localNodeID, apb.Node_HEALTH_HEARTBEAT_TIMEOUT)
// Now we'll simulate the node sending a couple of heartbeats. The node is
// expected to be HEALTHY after the first of them arrives.
@@ -1007,7 +1007,7 @@
t.Fatalf("While receiving a heartbeat reply: %v", err)
}
- expectNode(cl.localNodeID, apb.Node_HEALTHY)
+ expectNode(cl.localNodeID, apb.Node_HEALTH_HEALTHY)
}
// This case tests timing out from a healthy state. The passage of time is
@@ -1017,7 +1017,7 @@
lts := smv.(time.Time)
lts = lts.Add(-HeartbeatTimeout)
cl.l.ls.heartbeatTimestamps.Store(cl.localNodeID, lts)
- expectNode(cl.localNodeID, apb.Node_HEARTBEAT_TIMEOUT)
+ expectNode(cl.localNodeID, apb.Node_HEALTH_HEARTBEAT_TIMEOUT)
// This case verifies that health of non-UP nodes is assessed to be UNKNOWN,
// regardless of leadership tenure, since only UP nodes are capable of
@@ -1042,7 +1042,7 @@
if err := nodeSave(ctx, cl.l, &node); err != nil {
t.Fatalf("nodeSave failed: %v", err)
}
- expectNode(nodeID, apb.Node_UNKNOWN)
+ expectNode(nodeID, apb.Node_HEALTH_UNKNOWN)
}
// TestManagementClusterInfo exercises GetClusterInfo after setting a status.
@@ -1800,7 +1800,7 @@
})
var useTPM bool
- if resR.TpmUsage == cpb.NodeTPMUsage_NODE_TPM_PRESENT_AND_USED {
+ if resR.TpmUsage == cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_AND_USED {
useTPM = true
}
diff --git a/metropolis/node/core/curator/state_cluster.go b/metropolis/node/core/curator/state_cluster.go
index c645acf..6c3f39c 100644
--- a/metropolis/node/core/curator/state_cluster.go
+++ b/metropolis/node/core/curator/state_cluster.go
@@ -83,11 +83,11 @@
}
switch {
case have && use:
- usage = cpb.NodeTPMUsage_NODE_TPM_PRESENT_AND_USED
+ usage = cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_AND_USED
case have && !use:
- usage = cpb.NodeTPMUsage_NODE_TPM_PRESENT_BUT_UNUSED
+ usage = cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_BUT_UNUSED
case !have:
- usage = cpb.NodeTPMUsage_NODE_TPM_NOT_PRESENT
+ usage = cpb.NodeTPMUsage_NODE_TPM_USAGE_NOT_PRESENT
}
return
}
diff --git a/metropolis/node/core/localstorage/storage_esp.go b/metropolis/node/core/localstorage/storage_esp.go
index b449734..f2cf41f 100644
--- a/metropolis/node/core/localstorage/storage_esp.go
+++ b/metropolis/node/core/localstorage/storage_esp.go
@@ -176,7 +176,7 @@
}
switch tpmUsage {
- case cpb.NodeTPMUsage_NODE_TPM_PRESENT_AND_USED:
+ case cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_AND_USED:
// Use Secure Boot PCRs to seal the configuration.
// See: TCG PC Client Platform Firmware Profile Specification v1.05,
// table 3.3.4.1
@@ -186,8 +186,8 @@
if err != nil {
return fmt.Errorf("while using tpm: %w", err)
}
- case cpb.NodeTPMUsage_NODE_TPM_PRESENT_BUT_UNUSED:
- case cpb.NodeTPMUsage_NODE_TPM_NOT_PRESENT:
+ case cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_BUT_UNUSED:
+ case cpb.NodeTPMUsage_NODE_TPM_USAGE_NOT_PRESENT:
default:
return fmt.Errorf("unknown tpmUsage %d", tpmUsage)
}
@@ -208,13 +208,13 @@
}
switch tpmUsage {
- case cpb.NodeTPMUsage_NODE_TPM_PRESENT_AND_USED:
+ case cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_AND_USED:
bytes, err = tpm.Unseal(bytes)
if err != nil {
return nil, fmt.Errorf("%w: when unsealing: %w", ErrSealedCorrupted, err)
}
- case cpb.NodeTPMUsage_NODE_TPM_PRESENT_BUT_UNUSED:
- case cpb.NodeTPMUsage_NODE_TPM_NOT_PRESENT:
+ case cpb.NodeTPMUsage_NODE_TPM_USAGE_PRESENT_BUT_UNUSED:
+ case cpb.NodeTPMUsage_NODE_TPM_USAGE_NOT_PRESENT:
default:
return nil, fmt.Errorf("unknown tpmUsage %d", tpmUsage)
}
diff --git a/metropolis/node/core/mgmt/power.go b/metropolis/node/core/mgmt/power.go
index 05a5649..9273ab3 100644
--- a/metropolis/node/core/mgmt/power.go
+++ b/metropolis/node/core/mgmt/power.go
@@ -19,23 +19,23 @@
// Do not yet perform any system-wide actions here as the request might
// still get rejected. There is another switch statement for that below.
switch req.Type {
- case apb.RebootRequest_KEXEC:
+ case apb.RebootRequest_TYPE_KEXEC:
method = unix.LINUX_REBOOT_CMD_KEXEC
- case apb.RebootRequest_FIRMWARE:
+ case apb.RebootRequest_TYPE_FIRMWARE:
method = unix.LINUX_REBOOT_CMD_RESTART
- case apb.RebootRequest_POWER_OFF:
+ case apb.RebootRequest_TYPE_POWER_OFF:
method = unix.LINUX_REBOOT_CMD_POWER_OFF
default:
return nil, status.Error(codes.Unimplemented, "unimplemented type value")
}
switch req.NextBoot {
- case apb.RebootRequest_START_NORMAL:
- case apb.RebootRequest_START_ROLLBACK:
+ case apb.RebootRequest_NEXT_BOOT_START_NORMAL:
+ case apb.RebootRequest_NEXT_BOOT_START_ROLLBACK:
if err := s.UpdateService.Rollback(); err != nil {
return nil, status.Errorf(codes.Unavailable, "performing rollback failed: %v", err)
}
- case apb.RebootRequest_START_FIRMWARE_UI:
- if req.Type == apb.RebootRequest_KEXEC {
+ case apb.RebootRequest_NEXT_BOOT_START_FIRMWARE_UI:
+ if req.Type == apb.RebootRequest_TYPE_KEXEC {
return nil, status.Error(codes.InvalidArgument, "START_FIRMWARE_UI cannot be used with KEXEC type")
}
supp, err := efivarfs.OSIndicationsSupported()
@@ -50,11 +50,11 @@
}
switch req.Type {
- case apb.RebootRequest_KEXEC:
+ case apb.RebootRequest_TYPE_KEXEC:
if err := s.UpdateService.KexecLoadNext(); err != nil {
return nil, status.Errorf(codes.Unavailable, "failed to stage kexec kernel: %v", err)
}
- case apb.RebootRequest_FIRMWARE:
+ case apb.RebootRequest_TYPE_FIRMWARE:
// Best-effort, if it fails this will still be a firmware reboot.
os.WriteFile("/sys/kernel/reboot/mode", []byte("cold"), 0644)
}
diff --git a/metropolis/node/core/mgmt/svc_logs.go b/metropolis/node/core/mgmt/svc_logs.go
index ef5c1d7..6e27bf8 100644
--- a/metropolis/node/core/mgmt/svc_logs.go
+++ b/metropolis/node/core/mgmt/svc_logs.go
@@ -77,10 +77,10 @@
// Turn backlog mode into logtree option(s).
switch req.BacklogMode {
- case api.GetLogsRequest_BACKLOG_DISABLE:
- case api.GetLogsRequest_BACKLOG_ALL:
+ case api.GetLogsRequest_BACKLOG_MODE_DISABLE:
+ case api.GetLogsRequest_BACKLOG_MODE_ALL:
options = append(options, logtree.WithBacklog(logtree.BacklogAllAvailable))
- case api.GetLogsRequest_BACKLOG_COUNT:
+ case api.GetLogsRequest_BACKLOG_MODE_COUNT:
count := int(req.BacklogCount)
if count <= 0 {
return status.Errorf(codes.InvalidArgument, "backlog_count must be > 0 if backlog_mode is BACKLOG_COUNT")
@@ -93,8 +93,8 @@
// Turn stream mode into logtree option(s).
streamEnable := false
switch req.StreamMode {
- case api.GetLogsRequest_STREAM_DISABLE:
- case api.GetLogsRequest_STREAM_UNBUFFERED:
+ case api.GetLogsRequest_STREAM_MODE_DISABLE:
+ case api.GetLogsRequest_STREAM_MODE_UNBUFFERED:
streamEnable = true
options = append(options, logtree.WithStream())
}
diff --git a/metropolis/node/core/mgmt/svc_logs_test.go b/metropolis/node/core/mgmt/svc_logs_test.go
index dec1459..e91d2a3 100644
--- a/metropolis/node/core/mgmt/svc_logs_test.go
+++ b/metropolis/node/core/mgmt/svc_logs_test.go
@@ -75,11 +75,11 @@
var sev lpb.LeveledLogSeverity
switch severity {
case "i":
- sev = lpb.LeveledLogSeverity_INFO
+ sev = lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_INFO
case "w":
- sev = lpb.LeveledLogSeverity_WARNING
+ sev = lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_WARNING
case "e":
- sev = lpb.LeveledLogSeverity_ERROR
+ sev = lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_ERROR
}
return &lpb.LogEntry{
Dn: dn, Kind: &lpb.LogEntry_Leveled_{
@@ -130,18 +130,18 @@
var backlogCount int64
switch {
case backlog < 0:
- backlogMode = api.GetLogsRequest_BACKLOG_ALL
+ backlogMode = api.GetLogsRequest_BACKLOG_MODE_ALL
case backlog > 0:
- backlogMode = api.GetLogsRequest_BACKLOG_COUNT
+ backlogMode = api.GetLogsRequest_BACKLOG_MODE_COUNT
backlogCount = backlog
case backlog == 0:
- backlogMode = api.GetLogsRequest_BACKLOG_DISABLE
+ backlogMode = api.GetLogsRequest_BACKLOG_MODE_DISABLE
}
return &api.GetLogsRequest{
Dn: dn,
BacklogMode: backlogMode,
BacklogCount: backlogCount,
- StreamMode: api.GetLogsRequest_STREAM_DISABLE,
+ StreamMode: api.GetLogsRequest_STREAM_MODE_DISABLE,
}
}
mkRecursive := func(in *api.GetLogsRequest) *api.GetLogsRequest {
@@ -220,8 +220,8 @@
mgmt := api.NewNodeManagementClient(cl)
srv, err := mgmt.Logs(ctx, &api.GetLogsRequest{
Dn: "",
- BacklogMode: api.GetLogsRequest_BACKLOG_ALL,
- StreamMode: api.GetLogsRequest_STREAM_UNBUFFERED,
+ BacklogMode: api.GetLogsRequest_BACKLOG_MODE_ALL,
+ StreamMode: api.GetLogsRequest_STREAM_MODE_UNBUFFERED,
Filters: []*cpb.LogFilter{
{
Filter: &cpb.LogFilter_WithChildren_{
@@ -299,13 +299,13 @@
{
req: &api.GetLogsRequest{
Dn: "main",
- BacklogMode: api.GetLogsRequest_BACKLOG_ALL,
- StreamMode: api.GetLogsRequest_STREAM_DISABLE,
+ BacklogMode: api.GetLogsRequest_BACKLOG_MODE_ALL,
+ StreamMode: api.GetLogsRequest_STREAM_MODE_DISABLE,
Filters: []*cpb.LogFilter{
{
Filter: &cpb.LogFilter_LeveledWithMinimumSeverity_{
LeveledWithMinimumSeverity: &cpb.LogFilter_LeveledWithMinimumSeverity{
- Minimum: lpb.LeveledLogSeverity_WARNING,
+ Minimum: lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_WARNING,
},
},
},
@@ -320,8 +320,8 @@
{
req: &api.GetLogsRequest{
Dn: "main",
- BacklogMode: api.GetLogsRequest_BACKLOG_ALL,
- StreamMode: api.GetLogsRequest_STREAM_DISABLE,
+ BacklogMode: api.GetLogsRequest_BACKLOG_MODE_ALL,
+ StreamMode: api.GetLogsRequest_STREAM_MODE_DISABLE,
Filters: []*cpb.LogFilter{
{
Filter: &cpb.LogFilter_OnlyRaw_{
@@ -338,8 +338,8 @@
{
req: &api.GetLogsRequest{
Dn: "main",
- BacklogMode: api.GetLogsRequest_BACKLOG_ALL,
- StreamMode: api.GetLogsRequest_STREAM_DISABLE,
+ BacklogMode: api.GetLogsRequest_BACKLOG_MODE_ALL,
+ StreamMode: api.GetLogsRequest_STREAM_MODE_DISABLE,
Filters: []*cpb.LogFilter{
{
Filter: &cpb.LogFilter_OnlyLeveled_{
diff --git a/metropolis/node/core/mgmt/update.go b/metropolis/node/core/mgmt/update.go
index eb838dd..6a7e13e 100644
--- a/metropolis/node/core/mgmt/update.go
+++ b/metropolis/node/core/mgmt/update.go
@@ -17,16 +17,16 @@
} else {
return nil, status.Error(codes.Aborted, "another UpdateNode RPC is in progress on this node")
}
- if req.ActivationMode == apb.ActivationMode_ACTIVATION_INVALID {
+ if req.ActivationMode == apb.ActivationMode_ACTIVATION_MODE_INVALID {
return nil, status.Errorf(codes.InvalidArgument, "activation_mode needs to be explicitly specified")
}
- if err := s.UpdateService.InstallBundle(ctx, req.BundleUrl, req.ActivationMode == apb.ActivationMode_ACTIVATION_KEXEC); err != nil {
+ if err := s.UpdateService.InstallBundle(ctx, req.BundleUrl, req.ActivationMode == apb.ActivationMode_ACTIVATION_MODE_KEXEC); err != nil {
return nil, status.Errorf(codes.Unavailable, "error installing update: %v", err)
}
- if req.ActivationMode != apb.ActivationMode_ACTIVATION_NONE {
+ if req.ActivationMode != apb.ActivationMode_ACTIVATION_MODE_NONE {
methodString, method := "reboot", unix.LINUX_REBOOT_CMD_RESTART
- if req.ActivationMode == apb.ActivationMode_ACTIVATION_KEXEC {
+ if req.ActivationMode == apb.ActivationMode_ACTIVATION_MODE_KEXEC {
methodString = "kexec"
method = unix.LINUX_REBOOT_CMD_KEXEC
}
diff --git a/metropolis/node/core/network/static.go b/metropolis/node/core/network/static.go
index cdf72b0..260b5a6 100644
--- a/metropolis/node/core/network/static.go
+++ b/metropolis/node/core/network/static.go
@@ -26,8 +26,8 @@
)
var vlanProtoMap = map[netpb.VLAN_Protocol]netlink.VlanProtocol{
- netpb.VLAN_CVLAN: netlink.VLAN_PROTOCOL_8021Q,
- netpb.VLAN_SVLAN: netlink.VLAN_PROTOCOL_8021AD,
+ netpb.VLAN_PROTOCOL_CVLAN: netlink.VLAN_PROTOCOL_8021Q,
+ netpb.VLAN_PROTOCOL_SVLAN: netlink.VLAN_PROTOCOL_8021AD,
}
func (s *Service) runStaticConfig(ctx context.Context) error {
@@ -322,24 +322,24 @@
}
var lacpRateMap = map[netpb.Bond_LACP_Rate]netlink.BondLacpRate{
- netpb.Bond_LACP_SLOW: netlink.BOND_LACP_RATE_SLOW,
- netpb.Bond_LACP_FAST: netlink.BOND_LACP_RATE_FAST,
+ netpb.Bond_LACP_RATE_SLOW: netlink.BOND_LACP_RATE_SLOW,
+ netpb.Bond_LACP_RATE_FAST: netlink.BOND_LACP_RATE_FAST,
}
var lacpAdSelectMap = map[netpb.Bond_LACP_SelectionLogic]netlink.BondAdSelect{
- netpb.Bond_LACP_STABLE: netlink.BOND_AD_SELECT_STABLE,
- netpb.Bond_LACP_BANDWIDTH: netlink.BOND_AD_SELECT_BANDWIDTH,
- netpb.Bond_LACP_COUNT: netlink.BOND_AD_SELECT_COUNT,
+ netpb.Bond_LACP_SELECTION_LOGIC_STABLE: netlink.BOND_AD_SELECT_STABLE,
+ netpb.Bond_LACP_SELECTION_LOGIC_BANDWIDTH: netlink.BOND_AD_SELECT_BANDWIDTH,
+ netpb.Bond_LACP_SELECTION_LOGIC_COUNT: netlink.BOND_AD_SELECT_COUNT,
}
var xmitHashPolicyMap = map[netpb.Bond_TransmitHashPolicy]netlink.BondXmitHashPolicy{
- netpb.Bond_LAYER2: netlink.BOND_XMIT_HASH_POLICY_LAYER2,
- netpb.Bond_LAYER2_3: netlink.BOND_XMIT_HASH_POLICY_LAYER2_3,
- netpb.Bond_LAYER3_4: netlink.BOND_XMIT_HASH_POLICY_LAYER3_4,
- netpb.Bond_ENCAP_LAYER2_3: netlink.BOND_XMIT_HASH_POLICY_ENCAP2_3,
- netpb.Bond_ENCAP_LAYER3_4: netlink.BOND_XMIT_HASH_POLICY_ENCAP3_4,
+ netpb.Bond_TRANSMIT_HASH_POLICY_LAYER2: netlink.BOND_XMIT_HASH_POLICY_LAYER2,
+ netpb.Bond_TRANSMIT_HASH_POLICY_LAYER2_3: netlink.BOND_XMIT_HASH_POLICY_LAYER2_3,
+ netpb.Bond_TRANSMIT_HASH_POLICY_LAYER3_4: netlink.BOND_XMIT_HASH_POLICY_LAYER3_4,
+ netpb.Bond_TRANSMIT_HASH_POLICY_ENCAP_LAYER2_3: netlink.BOND_XMIT_HASH_POLICY_ENCAP2_3,
+ netpb.Bond_TRANSMIT_HASH_POLICY_ENCAP_LAYER3_4: netlink.BOND_XMIT_HASH_POLICY_ENCAP3_4,
// TODO(vishvananda/netlink#860): constant not in netlink yet
- netpb.Bond_VLAN_SRCMAC: 5,
+ netpb.Bond_TRANSMIT_HASH_POLICY_VLAN_SRCMAC: 5,
}
func bondIfaceFromSpec(it *netpb.Interface_Bond, i *netpb.Interface) (*netlink.Bond, error) {
diff --git a/metropolis/node/core/update/update.go b/metropolis/node/core/update/update.go
index b4183ad..ef302d1 100644
--- a/metropolis/node/core/update/update.go
+++ b/metropolis/node/core/update/update.go
@@ -199,9 +199,9 @@
return fmt.Errorf("bad A/B state: %w", err)
}
slotToLoad := Slot(state.ActiveSlot)
- if state.NextSlot != abloaderpb.Slot_NONE {
+ if state.NextSlot != abloaderpb.Slot_SLOT_NONE {
slotToLoad = Slot(state.NextSlot)
- state.NextSlot = abloaderpb.Slot_NONE
+ state.NextSlot = abloaderpb.Slot_SLOT_NONE
err = s.setABState(state)
if err != nil {
return fmt.Errorf("while updating A/B state: %w", err)
diff --git a/metropolis/proto/api/BUILD.bazel b/metropolis/proto/api/BUILD.bazel
index 8665c6d..bb39de8 100644
--- a/metropolis/proto/api/BUILD.bazel
+++ b/metropolis/proto/api/BUILD.bazel
@@ -8,7 +8,6 @@
except_rules = [
"PACKAGE_VERSION_SUFFIX",
"RPC_REQUEST_RESPONSE_UNIQUE", # TODO: evaluate correctness
- "ENUM_VALUE_PREFIX", # TODO: evaluate correctness
"ENUM_ZERO_VALUE_SUFFIX", # TODO: evaluate correctness
"RPC_REQUEST_STANDARD_NAME", # TODO: evaluate correctness
"RPC_RESPONSE_STANDARD_NAME", # TODO: evaluate correctness
diff --git a/metropolis/proto/api/management.proto b/metropolis/proto/api/management.proto
index 8653c29..59fd038 100644
--- a/metropolis/proto/api/management.proto
+++ b/metropolis/proto/api/management.proto
@@ -184,18 +184,18 @@
// Health describes node's health as seen from the cluster perspective.
enum Health {
- INVALID = 0;
+ HEALTH_INVALID = 0;
// UNKNOWN is used whenever there were no heartbeats received from a
// given node AND too little time has passed since last Curator leader
// election to know whether the node is actually timing out. UNKNOWN
// is also returned for nodes which NodeState does not equal
// NODE_STATE_UP.
- UNKNOWN = 1;
+ HEALTH_UNKNOWN = 1;
// HEALTHY describes nodes that have sent a heartbeat recently.
- HEALTHY = 2;
+ HEALTH_HEALTHY = 2;
// HEARTBEAT_TIMEOUT describes nodes that have not sent a heartbeat in
// the interval specified by curator.HeartbeatTimeout.
- HEARTBEAT_TIMEOUT = 3;
+ HEALTH_HEARTBEAT_TIMEOUT = 3;
}
Health health = 5;
// time_since_heartbeat is the duration since the last of the node's
@@ -342,27 +342,27 @@
// signals the firmware to perform a thorough reset if possible. This
// maximizes chances to clear hardware-related issues. The exact
// implementation is up to firmware.
- FIRMWARE = 1;
+ TYPE_FIRMWARE = 1;
// KEXEC performs a KEXEC reboot without going through firmware at all.
// This is the fastest reboot option, but does not fully reset most
// hardware and has compatibility issues on certain hardware.
- KEXEC = 2;
+ TYPE_KEXEC = 2;
// POWER_OFF fully powers off the system. It can only be started again by
// a physical power button, Wake On LAN if set supported by the NIC or
// an out-of-band management controller if available.
- POWER_OFF = 3;
+ TYPE_POWER_OFF = 3;
}
Type type = 1;
enum NextBoot {
// START_NORMAL starts the system normally, respecting standard A/B slot
// booting rules. Any staged but not activated updates will be activated
// as with a normal reboot.
- START_NORMAL = 0;
+ NEXT_BOOT_START_NORMAL = 0;
// START_ROLLBACK tries to boot into the currently inactive slot on reboot.
- START_ROLLBACK = 1;
+ NEXT_BOOT_START_ROLLBACK = 1;
// START_FIRMWARE_UI tries to boot into the EFI firmware UI. Cannot be used
// together with KEXEC as firmare is not involved there.
- START_FIRMWARE_UI = 2;
+ NEXT_BOOT_START_FIRMWARE_UI = 2;
}
// NextBoot can be used to select the boot slot to reboot into. This works
// even for POWER_OFF, but there the next boot will need to be triggered
@@ -426,25 +426,25 @@
repeated metropolis.proto.common.LogFilter filters = 2;
enum BacklogMode {
- BACKLOG_INVALID = 0;
+ BACKLOG_MODE_INVALID = 0;
// No historic data will be returned.
- BACKLOG_DISABLE = 1;
+ BACKLOG_MODE_DISABLE = 1;
// All available historic data will be returned.
- BACKLOG_ALL = 2;
+ BACKLOG_MODE_ALL = 2;
// At most backlog_count entries will be returned, if available.
- BACKLOG_COUNT = 3;
+ BACKLOG_MODE_COUNT = 3;
}
BacklogMode backlog_mode = 3;
int64 backlog_count = 4;
enum StreamMode {
- STREAM_INVALID = 0;
+ STREAM_MODE_INVALID = 0;
// No streaming entries, gRPC stream will be closed as soon as all backlog
// data is served.
- STREAM_DISABLE = 1;
+ STREAM_MODE_DISABLE = 1;
// Entries will be streamed as early as available right after all backlog
// data is served.
- STREAM_UNBUFFERED = 2;
+ STREAM_MODE_UNBUFFERED = 2;
}
StreamMode stream_mode = 5;
}
@@ -460,15 +460,15 @@
}
enum ActivationMode {
- ACTIVATION_INVALID = 0;
+ ACTIVATION_MODE_INVALID = 0;
// The new bundle is not activated immediately. It gets activated on the next
// reboot/reset.
- ACTIVATION_NONE = 1;
+ ACTIVATION_MODE_NONE = 1;
// The node is rebooted immediately to activate the new image.
- ACTIVATION_REBOOT = 2;
+ ACTIVATION_MODE_REBOOT = 2;
// The node uses kexec to activate the new image immediately without fully
// rebooting.
- ACTIVATION_KEXEC = 3;
+ ACTIVATION_MODE_KEXEC = 3;
}
message UpdateNodeRequest {
diff --git a/metropolis/proto/common/BUILD.bazel b/metropolis/proto/common/BUILD.bazel
index ec3fa68..f0219fe 100644
--- a/metropolis/proto/common/BUILD.bazel
+++ b/metropolis/proto/common/BUILD.bazel
@@ -7,7 +7,6 @@
name = "common_proto_lint_test",
except_rules = [
"PACKAGE_VERSION_SUFFIX",
- "ENUM_VALUE_PREFIX", # TODO: evaluate correctness
"ENUM_ZERO_VALUE_SUFFIX", # TODO: evaluate correctness
],
protos = [":common_proto"],
diff --git a/metropolis/proto/common/common.proto b/metropolis/proto/common/common.proto
index e7b1b96..9d6b0c4 100644
--- a/metropolis/proto/common/common.proto
+++ b/metropolis/proto/common/common.proto
@@ -371,14 +371,14 @@
// NodeTPMUsage describes whether a node has a TPM2.0 and if it is/should be
// actively used to seal secrets before saving them to its EFI system partition.
enum NodeTPMUsage {
- NODE_TPM_INVALID = 0;
+ NODE_TPM_USAGE_INVALID = 0;
// This node has no TPM 2.0.
- NODE_TPM_NOT_PRESENT = 1;
+ NODE_TPM_USAGE_NOT_PRESENT = 1;
// This node has a TPM 2.0 but the cluster configuration mandates not using
// it.
- NODE_TPM_PRESENT_BUT_UNUSED = 2;
+ NODE_TPM_USAGE_PRESENT_BUT_UNUSED = 2;
// This node has a TPM 2.0 and it is being actively used.
- NODE_TPM_PRESENT_AND_USED = 3;
+ NODE_TPM_USAGE_PRESENT_AND_USED = 3;
}
// NodeStorageSecurity describes how a node encrypts and/or authenticates its
diff --git a/metropolis/test/launch/cluster.go b/metropolis/test/launch/cluster.go
index 882f422..f1545c9 100644
--- a/metropolis/test/launch/cluster.go
+++ b/metropolis/test/launch/cluster.go
@@ -1166,7 +1166,7 @@
launch.Log("Cluster: node health: %+v", cs.Health)
lhb := time.Now().Add(-cs.TimeSinceHeartbeat.AsDuration())
- if lhb.After(start) && cs.Health == apb.Node_HEALTHY {
+ if lhb.After(start) && cs.Health == apb.Node_HEALTH_HEALTHY {
break
}
time.Sleep(time.Second)
@@ -1353,7 +1353,7 @@
var unhealthy []string
for _, node := range nodes {
- if node.Health == apb.Node_HEALTHY {
+ if node.Health == apb.Node_HEALTH_HEALTHY {
continue
}
unhealthy = append(unhealthy, node.Id)