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/build/bazel_cc_fix/ccfixspec/BUILD.bazel b/build/bazel_cc_fix/ccfixspec/BUILD.bazel
index 55844d3..ee7f11a 100644
--- a/build/bazel_cc_fix/ccfixspec/BUILD.bazel
+++ b/build/bazel_cc_fix/ccfixspec/BUILD.bazel
@@ -7,7 +7,6 @@
name = "build_bazel_cc_fix_ccfixspec_proto_lint_test",
except_rules = [
"PACKAGE_VERSION_SUFFIX",
- "ENUM_VALUE_PREFIX", # TODO: evaluate correctness
"ENUM_ZERO_VALUE_SUFFIX", # TODO: evaluate correctness
],
protos = [":build_bazel_cc_fix_ccfixspec_proto"],
diff --git a/build/bazel_cc_fix/ccfixspec/ccfixspec.proto b/build/bazel_cc_fix/ccfixspec/ccfixspec.proto
index 9f6a8c9..7ec92e3 100644
--- a/build/bazel_cc_fix/ccfixspec/ccfixspec.proto
+++ b/build/bazel_cc_fix/ccfixspec/ccfixspec.proto
@@ -35,15 +35,15 @@
message Replace {
enum Type {
- UNKNOWN = 0;
+ TYPE_UNKNOWN = 0;
// SYSTEM replaces included system headers (within < >) with the given
// workspace or inter-workspace (external/<otherworkspace>) paths. It
// matches literally as these files are generally not resolvable.
- SYSTEM = 1;
+ TYPE_SYSTEM = 1;
// WORKSPACE replaces included workspace-relative headers (after resolving)
// with the given workspace or inter-workspace paths. It matches
// pre-resolved workspace-relative paths.
- WORKSPACE = 2;
+ TYPE_WORKSPACE = 2;
}
Type type = 1;
string from = 2;
diff --git a/build/bazel_cc_fix/main.go b/build/bazel_cc_fix/main.go
index 4292b0d..a83374d 100644
--- a/build/bazel_cc_fix/main.go
+++ b/build/bazel_cc_fix/main.go
@@ -203,12 +203,12 @@
searchPath = quoteIncludes
} else if inclType == "<" {
searchPath = systemIncludes
- workspaceRelativeFilePath = applyReplaceDirectives(spec.Replace, ccfixspec.Replace_SYSTEM, inclFile, false)
+ workspaceRelativeFilePath = applyReplaceDirectives(spec.Replace, ccfixspec.Replace_TYPE_SYSTEM, inclFile, false)
}
if workspaceRelativeFilePath == "" {
workspaceRelativeFilePath = findFileInWorkspace(searchPath, inclFile, isGeneratedFile)
}
- workspaceRelativeFilePath = applyReplaceDirectives(spec.Replace, ccfixspec.Replace_WORKSPACE, workspaceRelativeFilePath, true)
+ workspaceRelativeFilePath = applyReplaceDirectives(spec.Replace, ccfixspec.Replace_TYPE_WORKSPACE, workspaceRelativeFilePath, true)
if workspaceRelativeFilePath == "" {
continue
}
diff --git a/cloud/agent/api/BUILD.bazel b/cloud/agent/api/BUILD.bazel
index 606c745..e07df2d 100644
--- a/cloud/agent/api/BUILD.bazel
+++ b/cloud/agent/api/BUILD.bazel
@@ -8,7 +8,6 @@
except_rules = [
"PACKAGE_VERSION_SUFFIX",
"MESSAGE_PASCAL_CASE",
- "ENUM_VALUE_PREFIX", # TODO: evaluate correctness
"ENUM_ZERO_VALUE_SUFFIX", # TODO: evaluate correctness
],
protos = [":api_proto"],
diff --git a/cloud/agent/api/hwreport.proto b/cloud/agent/api/hwreport.proto
index 7c5d4fd..98299d7 100644
--- a/cloud/agent/api/hwreport.proto
+++ b/cloud/agent/api/hwreport.proto
@@ -23,11 +23,11 @@
int32 physical_block_size_bytes = 8;
enum Protocol {
- UNKNOWN = 0;
- SCSI = 1;
- ATA = 2;
- NVME = 3;
- MMC = 4;
+ PROTOCOL_UNKNOWN = 0;
+ PROTOCOL_SCSI = 1;
+ PROTOCOL_ATA = 2;
+ PROTOCOL_NVME = 3;
+ PROTOCOL_MMC = 4;
}
Protocol protocol = 9;
@@ -97,23 +97,23 @@
enum EFISupport {
// EFI support was not evaluated by the report generator.
- EFI_INVALID = 0;
+ EFI_SUPPORT_INVALID = 0;
// It is not known if EFI is supported by the node. EFI runtime services are
// not available. This occurs if the report generator generally supports
// reporting EFI support, but none of its mechanisms to determine EFI support
// returned any data.
- EFI_UNKNOWN = 1;
+ EFI_SUPPORT_UNKNOWN = 1;
// The firmware indicates that EFI is not supported by the node. EFI runtime
// services are not available.
// Note that the firmware indication can be wrong.
- EFI_UNSUPPORTED = 2;
+ EFI_SUPPORT_UNSUPPORTED = 2;
// The firmware indicates that EFI is supported, but EFI runtime services
// are not available. This usually means that the hardware report was
// generated from a kernel booted in Compatibility Support Mode (CSM).
// Note that the firmware indication can be wrong.
- EFI_SUPPORTED = 3;
+ EFI_SUPPORT_SUPPORTED = 3;
// EFI and its runtime services are available and working.
- EFI_ENABLED = 4;
+ EFI_SUPPORT_ENABLED = 4;
}
message Node {
diff --git a/cloud/agent/hwreport.go b/cloud/agent/hwreport.go
index da50749..c37a640 100644
--- a/cloud/agent/hwreport.go
+++ b/cloud/agent/hwreport.go
@@ -48,9 +48,9 @@
if smbTbl.BIOSInformationRaw != nil && smbTbl.BIOSInformationRaw.StructureVersion.AtLeast(2, 2) {
uefiSupport := smbTbl.BIOSInformationRaw.BIOSCharacteristicsExtensionByte2&smbios.UEFISpecificationSupported != 0
if uefiSupport {
- c.node.EfiSupport = api.EFISupport_EFI_SUPPORTED
+ c.node.EfiSupport = api.EFISupport_EFI_SUPPORT_SUPPORTED
} else {
- c.node.EfiSupport = api.EFISupport_EFI_UNSUPPORTED
+ c.node.EfiSupport = api.EFISupport_EFI_SUPPORT_UNSUPPORTED
}
}
for _, d := range smbTbl.MemoryDevicesRaw {
@@ -192,7 +192,7 @@
var FRUUnavailable = [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
func (c *hwReportContext) gatherNVMe(bd *api.BlockDevice, bde os.DirEntry) error {
- bd.Protocol = api.BlockDevice_NVME
+ bd.Protocol = api.BlockDevice_PROTOCOL_NVME
nvmeDev, err := nvme.Open("/dev/" + bde.Name())
if err != nil {
return fmt.Errorf("unable to open NVMe device: %w", err)
@@ -218,7 +218,7 @@
}
func (c *hwReportContext) gatherSCSI(bd *api.BlockDevice, bde os.DirEntry) error {
- bd.Protocol = api.BlockDevice_SCSI
+ bd.Protocol = api.BlockDevice_PROTOCOL_SCSI
scsiDev, err := scsi.Open("/dev/" + bde.Name())
if err != nil {
return fmt.Errorf("unable to open SCSI device: %w", err)
@@ -234,7 +234,7 @@
// SAT-5 R8 Table 14
if inquiryData.Vendor == "ATA" { // ATA device behind SAT
- bd.Protocol = api.BlockDevice_ATA
+ bd.Protocol = api.BlockDevice_PROTOCOL_ATA
// TODO: ATA Vendor from WWN if available
} else { // Normal SCSI device
bd.Vendor = inquiryData.Vendor
@@ -326,7 +326,7 @@
}
if strings.HasPrefix(bde.Name(), "mmcblk") {
// TODO: MMC information
- bd.Protocol = api.BlockDevice_MMC
+ bd.Protocol = api.BlockDevice_PROTOCOL_MMC
c.node.BlockDevice = append(c.node.BlockDevice, &bd)
}
}
@@ -403,7 +403,7 @@
hwReportCtx := hwReportContext{
node: &api.Node{},
}
- hwReportCtx.node.EfiSupport = api.EFISupport_EFI_UNKNOWN
+ hwReportCtx.node.EfiSupport = api.EFISupport_EFI_SUPPORT_UNKNOWN
hwReportCtx.gatherCPU()
hwReportCtx.gatherSMBIOS()
@@ -420,7 +420,7 @@
hwReportCtx.gatherBlockDevices()
if _, err := os.Stat("/sys/firmware/efi/runtime"); err == nil {
- hwReportCtx.node.EfiSupport = api.EFISupport_EFI_ENABLED
+ hwReportCtx.node.EfiSupport = api.EFISupport_EFI_SUPPORT_ENABLED
}
return hwReportCtx.node, hwReportCtx.errors
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)
diff --git a/osbase/build/earlydev.fsspec b/osbase/build/earlydev.fsspec
index a7d2ea4..310616b 100644
--- a/osbase/build/earlydev.fsspec
+++ b/osbase/build/earlydev.fsspec
@@ -7,25 +7,25 @@
# device manager (ie. devtmpfs) is launched.
special_file <
path: "/dev/console"
- type: CHARACTER_DEV
+ type: TYPE_CHARACTER_DEV
major: 5 minor: 1
mode: 0600 uid: 0 gid: 0
>
special_file <
path: "/dev/ptmx"
- type: CHARACTER_DEV
+ type: TYPE_CHARACTER_DEV
major: 5 minor: 2
mode: 0644 uid: 0 gid: 0
>
special_file <
path: "/dev/null"
- type: CHARACTER_DEV
+ type: TYPE_CHARACTER_DEV
major: 1 minor: 3
mode: 0644 uid: 0 gid: 0
>
special_file <
path: "/dev/kmsg"
- type: CHARACTER_DEV
+ type: TYPE_CHARACTER_DEV
major: 1 minor: 11
mode: 0644 uid: 0 gid: 0
>
@@ -36,19 +36,19 @@
# log there, too.
special_file <
path: "/dev/tty0"
- type: CHARACTER_DEV
+ type: TYPE_CHARACTER_DEV
major: 4 minor: 0
mode: 0600 uid: 0 gid: 0
>
special_file <
path: "/dev/ttyS0"
- type: CHARACTER_DEV
+ type: TYPE_CHARACTER_DEV
major: 4 minor: 64
mode: 0660 uid: 0 gid: 0
>
special_file <
path: "/dev/ttyS1"
- type: CHARACTER_DEV
+ type: TYPE_CHARACTER_DEV
major: 4 minor: 65
mode: 0660 uid: 0 gid: 0
>
\ No newline at end of file
diff --git a/osbase/build/fsspec/BUILD.bazel b/osbase/build/fsspec/BUILD.bazel
index 2b17b8d..0cb2c55 100644
--- a/osbase/build/fsspec/BUILD.bazel
+++ b/osbase/build/fsspec/BUILD.bazel
@@ -7,7 +7,6 @@
name = "spec_proto_lint_test",
except_rules = [
"PACKAGE_VERSION_SUFFIX",
- "ENUM_VALUE_PREFIX", # TODO: evaluate correctness
"ENUM_ZERO_VALUE_SUFFIX", # TODO: evaluate correctness
],
protos = [":spec_proto"],
diff --git a/osbase/build/fsspec/spec.proto b/osbase/build/fsspec/spec.proto
index 25963a1..3c98fdb 100644
--- a/osbase/build/fsspec/spec.proto
+++ b/osbase/build/fsspec/spec.proto
@@ -76,9 +76,9 @@
string path = 1;
enum Type {
- CHARACTER_DEV = 0;
- BLOCK_DEV = 1;
- FIFO = 2;
+ TYPE_CHARACTER_DEV = 0;
+ TYPE_BLOCK_DEV = 1;
+ TYPE_FIFO = 2;
}
// Type of special file.
diff --git a/osbase/build/mkcpio/main.go b/osbase/build/mkcpio/main.go
index 4886c3c..000a979 100644
--- a/osbase/build/mkcpio/main.go
+++ b/osbase/build/mkcpio/main.go
@@ -196,11 +196,11 @@
case *fsspec.SpecialFile:
mode := cpio.FileMode(i.Mode)
switch i.Type {
- case fsspec.SpecialFile_CHARACTER_DEV:
+ case fsspec.SpecialFile_TYPE_CHARACTER_DEV:
mode |= cpio.TypeChar
- case fsspec.SpecialFile_BLOCK_DEV:
+ case fsspec.SpecialFile_TYPE_BLOCK_DEV:
mode |= cpio.TypeBlock
- case fsspec.SpecialFile_FIFO:
+ case fsspec.SpecialFile_TYPE_FIFO:
mode |= cpio.TypeFifo
}
diff --git a/osbase/build/mkerofs/main.go b/osbase/build/mkerofs/main.go
index edcfdb9..12cde48 100644
--- a/osbase/build/mkerofs/main.go
+++ b/osbase/build/mkerofs/main.go
@@ -97,17 +97,17 @@
GID: uint16(inode.SpecialFile.Gid),
}
switch inode.SpecialFile.Type {
- case fsspec.SpecialFile_FIFO:
+ case fsspec.SpecialFile_TYPE_FIFO:
err = w.Create(pathname, &erofs.FIFO{
Base: base,
})
- case fsspec.SpecialFile_CHARACTER_DEV:
+ case fsspec.SpecialFile_TYPE_CHARACTER_DEV:
err = w.Create(pathname, &erofs.CharacterDevice{
Base: base,
Major: inode.SpecialFile.Major,
Minor: inode.SpecialFile.Minor,
})
- case fsspec.SpecialFile_BLOCK_DEV:
+ case fsspec.SpecialFile_TYPE_BLOCK_DEV:
err = w.Create(pathname, &erofs.BlockDevice{
Base: base,
Major: inode.SpecialFile.Major,
diff --git a/osbase/kmod/meta.go b/osbase/kmod/meta.go
index c005a7c..1c96c46 100644
--- a/osbase/kmod/meta.go
+++ b/osbase/kmod/meta.go
@@ -17,7 +17,7 @@
modInfoMap := make(map[string]ModuleInfo)
var meta kmodpb.Meta
meta.ModuleDeviceMatches = &kmodpb.RadixNode{
- Type: kmodpb.RadixNode_ROOT,
+ Type: kmodpb.RadixNode_TYPE_ROOT,
}
var i uint32
for _, m := range modinfos {
diff --git a/osbase/kmod/radix.go b/osbase/kmod/radix.go
index c20b48d..1631d87 100644
--- a/osbase/kmod/radix.go
+++ b/osbase/kmod/radix.go
@@ -25,23 +25,23 @@
func lookupModulesRec(n *kmodpb.RadixNode, needle string, matches map[uint32]bool) {
for _, c := range n.Children {
switch c.Type {
- case kmodpb.RadixNode_LITERAL:
+ case kmodpb.RadixNode_TYPE_LITERAL:
if len(needle) < len(c.Literal) {
continue
}
if c.Literal == needle[:len(c.Literal)] {
lookupModulesRec(c, needle[len(c.Literal):], matches)
}
- case kmodpb.RadixNode_WILDCARD:
+ case kmodpb.RadixNode_TYPE_WILDCARD:
for i := 0; i <= len(needle); i++ {
lookupModulesRec(c, needle[i:], matches)
}
- case kmodpb.RadixNode_SINGLE_WILDCARD:
+ case kmodpb.RadixNode_TYPE_SINGLE_WILDCARD:
if len(needle) < 1 {
continue
}
lookupModulesRec(c, needle[1:], matches)
- case kmodpb.RadixNode_BYTE_RANGE:
+ case kmodpb.RadixNode_TYPE_BYTE_RANGE:
if len(needle) < 1 {
continue
}
@@ -93,7 +93,7 @@
continue
}
switch c.Type {
- case kmodpb.RadixNode_LITERAL:
+ case kmodpb.RadixNode_TYPE_LITERAL:
if c.Literal[0] == currPart.Literal[0] {
var i int
for i < len(c.Literal) && i < len(currPart.Literal) && c.Literal[i] == currPart.Literal[i] {
@@ -107,11 +107,11 @@
return addPatternRec(c, parts[1:], nil)
}
if i == len(c.Literal) {
- return addPatternRec(c, parts, &kmodpb.RadixNode{Type: kmodpb.RadixNode_LITERAL, Literal: currPart.Literal[i:], ModuleIndex: currPart.ModuleIndex})
+ return addPatternRec(c, parts, &kmodpb.RadixNode{Type: kmodpb.RadixNode_TYPE_LITERAL, Literal: currPart.Literal[i:], ModuleIndex: currPart.ModuleIndex})
}
// Split current node
splitOldPart := &kmodpb.RadixNode{
- Type: kmodpb.RadixNode_LITERAL,
+ Type: kmodpb.RadixNode_TYPE_LITERAL,
Literal: c.Literal[i:],
Children: c.Children,
ModuleIndex: c.ModuleIndex,
@@ -129,7 +129,7 @@
parts = parts[1:]
} else {
splitNewPart = &kmodpb.RadixNode{
- Type: kmodpb.RadixNode_LITERAL,
+ Type: kmodpb.RadixNode_TYPE_LITERAL,
Literal: currPart.Literal[i:],
ModuleIndex: currPart.ModuleIndex,
}
@@ -143,14 +143,14 @@
return addPatternRec(splitNewPart, parts[1:], nil)
}
- case kmodpb.RadixNode_BYTE_RANGE:
+ case kmodpb.RadixNode_TYPE_BYTE_RANGE:
if c.StartByte == currPart.StartByte && c.EndByte == currPart.EndByte {
if len(parts) == 1 {
c.ModuleIndex = append(c.ModuleIndex, parts[0].ModuleIndex...)
}
return addPatternRec(c, parts[1:], nil)
}
- case kmodpb.RadixNode_SINGLE_WILDCARD, kmodpb.RadixNode_WILDCARD:
+ case kmodpb.RadixNode_TYPE_SINGLE_WILDCARD, kmodpb.RadixNode_TYPE_WILDCARD:
if len(parts) == 1 {
c.ModuleIndex = append(c.ModuleIndex, parts[0].ModuleIndex...)
}
@@ -179,13 +179,13 @@
fmt.Printf("%v ", r.ModuleIndex)
}
switch r.Type {
- case kmodpb.RadixNode_LITERAL:
+ case kmodpb.RadixNode_TYPE_LITERAL:
fmt.Printf("%q: ", r.Literal)
- case kmodpb.RadixNode_SINGLE_WILDCARD:
+ case kmodpb.RadixNode_TYPE_SINGLE_WILDCARD:
fmt.Printf("?: ")
- case kmodpb.RadixNode_WILDCARD:
+ case kmodpb.RadixNode_TYPE_WILDCARD:
fmt.Printf("*: ")
- case kmodpb.RadixNode_BYTE_RANGE:
+ case kmodpb.RadixNode_TYPE_BYTE_RANGE:
fmt.Printf("[%c-%c]: ", rune(r.StartByte), rune(r.EndByte))
default:
log.Fatalf("Unknown tree type %T\n", r)
@@ -210,7 +210,7 @@
storeCurrentLiteral := func() {
if currentLiteral.Len() > 0 {
out = append(out, &kmodpb.RadixNode{
- Type: kmodpb.RadixNode_LITERAL,
+ Type: kmodpb.RadixNode_TYPE_LITERAL,
Literal: currentLiteral.String(),
})
currentLiteral.Reset()
@@ -221,16 +221,16 @@
case '*':
storeCurrentLiteral()
i += 1
- if len(out) > 0 && out[len(out)-1].Type == kmodpb.RadixNode_WILDCARD {
+ if len(out) > 0 && out[len(out)-1].Type == kmodpb.RadixNode_TYPE_WILDCARD {
continue
}
out = append(out, &kmodpb.RadixNode{
- Type: kmodpb.RadixNode_WILDCARD,
+ Type: kmodpb.RadixNode_TYPE_WILDCARD,
})
case '?':
storeCurrentLiteral()
out = append(out, &kmodpb.RadixNode{
- Type: kmodpb.RadixNode_SINGLE_WILDCARD,
+ Type: kmodpb.RadixNode_TYPE_SINGLE_WILDCARD,
})
i += 1
case '[':
@@ -242,7 +242,7 @@
return nil, errors.New("illegal byte range notation, incorrect dash or closing character")
}
nn := &kmodpb.RadixNode{
- Type: kmodpb.RadixNode_BYTE_RANGE,
+ Type: kmodpb.RadixNode_TYPE_BYTE_RANGE,
StartByte: uint32(pattern[i+1]),
EndByte: uint32(pattern[i+3]),
}
diff --git a/osbase/kmod/radix_test.go b/osbase/kmod/radix_test.go
index 62e9d95..e89a514 100644
--- a/osbase/kmod/radix_test.go
+++ b/osbase/kmod/radix_test.go
@@ -20,18 +20,18 @@
expectedNodes []*kmodpb.RadixNode
}{
{"Empty", "", nil},
- {"SingleLiteral", "asdf", []*kmodpb.RadixNode{{Type: kmodpb.RadixNode_LITERAL, Literal: "asdf"}}},
+ {"SingleLiteral", "asdf", []*kmodpb.RadixNode{{Type: kmodpb.RadixNode_TYPE_LITERAL, Literal: "asdf"}}},
{"SingleWildcard", "as*df", []*kmodpb.RadixNode{
- {Type: kmodpb.RadixNode_LITERAL, Literal: "as"},
- {Type: kmodpb.RadixNode_WILDCARD},
- {Type: kmodpb.RadixNode_LITERAL, Literal: "df"},
+ {Type: kmodpb.RadixNode_TYPE_LITERAL, Literal: "as"},
+ {Type: kmodpb.RadixNode_TYPE_WILDCARD},
+ {Type: kmodpb.RadixNode_TYPE_LITERAL, Literal: "df"},
}},
- {"EscapedWildcard", "a\\*", []*kmodpb.RadixNode{{Type: kmodpb.RadixNode_LITERAL, Literal: "a*"}}},
- {"SingleRange", "[y-z]", []*kmodpb.RadixNode{{Type: kmodpb.RadixNode_BYTE_RANGE, StartByte: 121, EndByte: 122}}},
+ {"EscapedWildcard", "a\\*", []*kmodpb.RadixNode{{Type: kmodpb.RadixNode_TYPE_LITERAL, Literal: "a*"}}},
+ {"SingleRange", "[y-z]", []*kmodpb.RadixNode{{Type: kmodpb.RadixNode_TYPE_BYTE_RANGE, StartByte: 121, EndByte: 122}}},
{"SingleWildcardChar", "a?c", []*kmodpb.RadixNode{
- {Type: kmodpb.RadixNode_LITERAL, Literal: "a"},
- {Type: kmodpb.RadixNode_SINGLE_WILDCARD},
- {Type: kmodpb.RadixNode_LITERAL, Literal: "c"},
+ {Type: kmodpb.RadixNode_TYPE_LITERAL, Literal: "a"},
+ {Type: kmodpb.RadixNode_TYPE_SINGLE_WILDCARD},
+ {Type: kmodpb.RadixNode_TYPE_LITERAL, Literal: "c"},
}},
}
for _, c := range cases {
@@ -50,7 +50,7 @@
func TestLookupComplex(t *testing.T) {
root := &kmodpb.RadixNode{
- Type: kmodpb.RadixNode_LITERAL,
+ Type: kmodpb.RadixNode_TYPE_LITERAL,
}
if err := AddPattern(root, "usb:v0B95p1790d*dc*dsc*dp*icFFiscFFip00in*", 2); err != nil {
t.Error(err)
@@ -84,7 +84,7 @@
values := strings.Split(b, "\x00")
var patternsRegexp []regexp.Regexp
root := &kmodpb.RadixNode{
- Type: kmodpb.RadixNode_LITERAL,
+ Type: kmodpb.RadixNode_TYPE_LITERAL,
}
for i, p := range patternsRaw {
if !isASCII(p) {
@@ -103,13 +103,13 @@
regexb.WriteString("(?s)^")
for _, part := range pp {
switch part.Type {
- case kmodpb.RadixNode_LITERAL:
+ case kmodpb.RadixNode_TYPE_LITERAL:
regexb.WriteString(regexp.QuoteMeta(part.Literal))
- case kmodpb.RadixNode_SINGLE_WILDCARD:
+ case kmodpb.RadixNode_TYPE_SINGLE_WILDCARD:
regexb.WriteString(".")
- case kmodpb.RadixNode_WILDCARD:
+ case kmodpb.RadixNode_TYPE_WILDCARD:
regexb.WriteString(".*")
- case kmodpb.RadixNode_BYTE_RANGE:
+ case kmodpb.RadixNode_TYPE_BYTE_RANGE:
regexb.WriteString(fmt.Sprintf("[%s-%s]", regexp.QuoteMeta(string([]rune{rune(part.StartByte)})), regexp.QuoteMeta(string([]rune{rune(part.EndByte)}))))
default:
t.Errorf("Unknown node type %v", part.Type)
diff --git a/osbase/kmod/spec/BUILD.bazel b/osbase/kmod/spec/BUILD.bazel
index 5ff430e..8994546 100644
--- a/osbase/kmod/spec/BUILD.bazel
+++ b/osbase/kmod/spec/BUILD.bazel
@@ -7,7 +7,6 @@
name = "spec_proto_lint_test",
except_rules = [
"PACKAGE_VERSION_SUFFIX",
- "ENUM_VALUE_PREFIX", # TODO: evaluate correctness
"ENUM_ZERO_VALUE_SUFFIX", # TODO: evaluate correctness
],
protos = [":spec_proto"],
diff --git a/osbase/kmod/spec/meta.proto b/osbase/kmod/spec/meta.proto
index 2eb5c7a..634b2ad 100644
--- a/osbase/kmod/spec/meta.proto
+++ b/osbase/kmod/spec/meta.proto
@@ -18,16 +18,16 @@
message RadixNode {
enum Type {
// Matches one or more characters literally.
- LITERAL = 0;
+ TYPE_LITERAL = 0;
// Matches zero or more arbitrary characters.
- WILDCARD = 1;
+ TYPE_WILDCARD = 1;
// Matches exactly one arbitrary character.
- SINGLE_WILDCARD = 2;
+ TYPE_SINGLE_WILDCARD = 2;
// Matches exactly one character between start_byte and end_byte.
- BYTE_RANGE = 3;
+ TYPE_BYTE_RANGE = 3;
// Root matches nothing, but serves a the root node for a radix
// tree.
- ROOT = 4;
+ TYPE_ROOT = 4;
}
Type type = 1;
diff --git a/osbase/logtree/leveled.go b/osbase/logtree/leveled.go
index 701d8d0..0ca6e48 100644
--- a/osbase/logtree/leveled.go
+++ b/osbase/logtree/leveled.go
@@ -25,13 +25,13 @@
func SeverityFromProto(s lpb.LeveledLogSeverity) (logging.Severity, error) {
switch s {
- case lpb.LeveledLogSeverity_INFO:
+ case lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_INFO:
return logging.INFO, nil
- case lpb.LeveledLogSeverity_WARNING:
+ case lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_WARNING:
return logging.WARNING, nil
- case lpb.LeveledLogSeverity_ERROR:
+ case lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_ERROR:
return logging.ERROR, nil
- case lpb.LeveledLogSeverity_FATAL:
+ case lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_FATAL:
return logging.FATAL, nil
default:
return "", fmt.Errorf("unknown severity value %d", s)
@@ -41,14 +41,14 @@
func SeverityToProto(s logging.Severity) lpb.LeveledLogSeverity {
switch s {
case logging.INFO:
- return lpb.LeveledLogSeverity_INFO
+ return lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_INFO
case logging.WARNING:
- return lpb.LeveledLogSeverity_WARNING
+ return lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_WARNING
case logging.ERROR:
- return lpb.LeveledLogSeverity_ERROR
+ return lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_ERROR
case logging.FATAL:
- return lpb.LeveledLogSeverity_FATAL
+ return lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_FATAL
default:
- return lpb.LeveledLogSeverity_INVALID
+ return lpb.LeveledLogSeverity_LEVELED_LOG_SEVERITY_INVALID
}
}
diff --git a/osbase/logtree/proto/BUILD.bazel b/osbase/logtree/proto/BUILD.bazel
index b7b76d4..9a87f5c 100644
--- a/osbase/logtree/proto/BUILD.bazel
+++ b/osbase/logtree/proto/BUILD.bazel
@@ -7,7 +7,6 @@
name = "proto_proto_lint_test",
except_rules = [
"PACKAGE_VERSION_SUFFIX",
- "ENUM_VALUE_PREFIX", # TODO: evaluate correctness
"ENUM_ZERO_VALUE_SUFFIX", # TODO: evaluate correctness
],
protos = [":proto_proto"],
diff --git a/osbase/logtree/proto/logtree.proto b/osbase/logtree/proto/logtree.proto
index fb80a71..ce905cc 100644
--- a/osbase/logtree/proto/logtree.proto
+++ b/osbase/logtree/proto/logtree.proto
@@ -22,11 +22,11 @@
// Severity level corresponding to //osbase/logtree.Severity.
enum LeveledLogSeverity {
- INVALID = 0;
- INFO = 1;
- WARNING = 2;
- ERROR = 3;
- FATAL = 4;
+ LEVELED_LOG_SEVERITY_INVALID = 0;
+ LEVELED_LOG_SEVERITY_INFO = 1;
+ LEVELED_LOG_SEVERITY_WARNING = 2;
+ LEVELED_LOG_SEVERITY_ERROR = 3;
+ LEVELED_LOG_SEVERITY_FATAL = 4;
}
// LogEntry corresponding to logtree.LogEntry in //osbase/logtree.
diff --git a/osbase/net/dump/netdump.go b/osbase/net/dump/netdump.go
index 7ea9ae2..d9586ed 100644
--- a/osbase/net/dump/netdump.go
+++ b/osbase/net/dump/netdump.go
@@ -18,8 +18,8 @@
)
var vlanProtoMap = map[netlink.VlanProtocol]netapi.VLAN_Protocol{
- netlink.VLAN_PROTOCOL_8021Q: netapi.VLAN_CVLAN,
- netlink.VLAN_PROTOCOL_8021AD: netapi.VLAN_SVLAN,
+ netlink.VLAN_PROTOCOL_8021Q: netapi.VLAN_PROTOCOL_CVLAN,
+ netlink.VLAN_PROTOCOL_8021AD: netapi.VLAN_PROTOCOL_SVLAN,
}
// From iproute2's rt_protos
@@ -265,19 +265,19 @@
func getIPv6IfaceAutoconfigPrivacy(name string) (netapi.IPv6Autoconfig_Privacy, error) {
useTempaddrRaw, err := os.ReadFile(fmt.Sprintf("/proc/sys/net/ipv6/conf/%s/use_tempaddr", name))
if err != nil {
- return netapi.IPv6Autoconfig_DISABLE, fmt.Errorf("failed to read use_tempaddr sysctl for interface %q: %w", name, err)
+ return netapi.IPv6Autoconfig_PRIVACY_DISABLE, fmt.Errorf("failed to read use_tempaddr sysctl for interface %q: %w", name, err)
}
useTempaddr, err := strconv.ParseInt(strings.TrimSpace(string(useTempaddrRaw)), 10, 64)
if err != nil {
- return netapi.IPv6Autoconfig_DISABLE, fmt.Errorf("failed to parse use_tempaddr sysctl for interface %q: %w", name, err)
+ return netapi.IPv6Autoconfig_PRIVACY_DISABLE, fmt.Errorf("failed to parse use_tempaddr sysctl for interface %q: %w", name, err)
}
switch {
case useTempaddr <= 0:
- return netapi.IPv6Autoconfig_DISABLE, nil
+ return netapi.IPv6Autoconfig_PRIVACY_DISABLE, nil
case useTempaddr == 1:
- return netapi.IPv6Autoconfig_AVOID, nil
+ return netapi.IPv6Autoconfig_PRIVACY_AVOID, nil
case useTempaddr > 1:
- return netapi.IPv6Autoconfig_PREFER, nil
+ return netapi.IPv6Autoconfig_PRIVACY_PREFER, nil
default:
panic("switch is complete but hit default case")
}
diff --git a/osbase/net/proto/BUILD.bazel b/osbase/net/proto/BUILD.bazel
index f7a6ab2..bd69b94 100644
--- a/osbase/net/proto/BUILD.bazel
+++ b/osbase/net/proto/BUILD.bazel
@@ -7,7 +7,6 @@
name = "proto_proto_lint_test",
except_rules = [
"PACKAGE_VERSION_SUFFIX",
- "ENUM_VALUE_PREFIX", # TODO: evaluate correctness
"ENUM_ZERO_VALUE_SUFFIX", # TODO: evaluate correctness
],
protos = [":proto_proto"],
diff --git a/osbase/net/proto/net.proto b/osbase/net/proto/net.proto
index 1fd46aa..02e4160 100644
--- a/osbase/net/proto/net.proto
+++ b/osbase/net/proto/net.proto
@@ -57,17 +57,17 @@
}
enum TransmitHashPolicy {
// Layer 2 MAC address
- LAYER2 = 0;
+ TRANSMIT_HASH_POLICY_LAYER2 = 0;
// IP address, protocol and port
- LAYER3_4 = 1;
+ TRANSMIT_HASH_POLICY_LAYER3_4 = 1;
// MAC address and IP address
- LAYER2_3 = 2;
+ TRANSMIT_HASH_POLICY_LAYER2_3 = 2;
// Encapsulated MAC address and IP address
- ENCAP_LAYER2_3 = 3;
+ TRANSMIT_HASH_POLICY_ENCAP_LAYER2_3 = 3;
// Encapsulated IP address, protocol and port
- ENCAP_LAYER3_4 = 4;
+ TRANSMIT_HASH_POLICY_ENCAP_LAYER3_4 = 4;
// VLAN ID and source MAC
- VLAN_SRCMAC = 5;
+ TRANSMIT_HASH_POLICY_VLAN_SRCMAC = 5;
}
TransmitHashPolicy transmit_hash_policy = 4;
// Use the Link Aggregation Control Protocol to automatically use the
@@ -75,15 +75,15 @@
message LACP {
enum Rate {
// LACP slow rate, one packet every 30s
- SLOW = 0;
+ RATE_SLOW = 0;
// LACP fast rate, one packet every 1s
- FAST = 1;
+ RATE_FAST = 1;
}
Rate rate = 1;
enum SelectionLogic {
- STABLE = 0;
- BANDWIDTH = 1;
- COUNT = 2;
+ SELECTION_LOGIC_STABLE = 0;
+ SELECTION_LOGIC_BANDWIDTH = 1;
+ SELECTION_LOGIC_COUNT = 2;
}
SelectionLogic selection_logic = 2;
int32 actor_system_priority = 3;
@@ -109,12 +109,12 @@
enum Protocol {
// C-VLAN, also known as "standard" VLAN inserts a header with the
// VLAN ID (VID) right before the EtherType.
- CVLAN = 0;
+ PROTOCOL_CVLAN = 0;
// S-VLAN, also known as QinQ or 802.1ad (obsolete) inserts a second VLAN ID
// before the C-VLAN header. This allows stacking two VLANs. The ID
// specified here is just for the outer VLAN, the inner one can be set by
// creating another VLAN interface and setting this one to be its parent.
- SVLAN = 1;
+ PROTOCOL_SVLAN = 1;
}
Protocol protocol = 3;
}
@@ -130,12 +130,12 @@
message IPv6Autoconfig {
enum Privacy {
// Do not generate privacy addresses.
- DISABLE = 0;
+ PRIVACY_DISABLE = 0;
// Generate privacy addresses, but prefer non-privacy addresses.
- AVOID = 1;
+ PRIVACY_AVOID = 1;
// Generate privacy addresses and use them over other non-privacy
// addresses.
- PREFER = 2;
+ PRIVACY_PREFER = 2;
}
// privacy controls if and how privacy addresses (see RFC 4941) are used if
// DHCPv6 is not used for addressing. If DHCPv6 is used for addressing