metropolis: align EFI partition layout
This moves non-EFI-related data inside the ESP from under the EFI
subdirectory to the root. The data moved is never accessed from EFI and
thus shouldn't be under the EFI folder. This also aligns localstorage
with the new layout as previously it and osimage didn't agree on a
specific layout, indirectly breaking the installer.
Change-Id: I36bdc9782e181dafab40aaa85cc0b4eaf2448f6e
Reviewed-on: https://review.monogon.dev/c/monogon/+/483
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
diff --git a/metropolis/cli/metroctl/core/install.go b/metropolis/cli/metroctl/core/install.go
index e894079..c20e38d 100644
--- a/metropolis/cli/metroctl/core/install.go
+++ b/metropolis/cli/metroctl/core/install.go
@@ -130,7 +130,7 @@
}
// Create EFI partition structure.
- for _, dir := range []string{"/EFI", "/EFI/BOOT", "/EFI/metropolis-installer"} {
+ for _, dir := range []string{"/EFI", "/EFI/BOOT", "/metropolis-installer"} {
if err := fs.Mkdir(dir); err != nil {
panic(err)
}
@@ -146,7 +146,7 @@
return fmt.Errorf("failed to copy installer file: %w", err)
}
if args.NodeParams != nil {
- nodeParamsFile, err := fs.OpenFile("/EFI/metropolis-installer/nodeparams.pb", os.O_CREATE|os.O_RDWR)
+ nodeParamsFile, err := fs.OpenFile("/metropolis-installer/nodeparams.pb", os.O_CREATE|os.O_RDWR)
if err != nil {
panic(err)
}
@@ -156,7 +156,7 @@
}
}
if args.Bundle != nil {
- bundleFile, err := fs.OpenFile("/EFI/metropolis-installer/bundle.bin", os.O_CREATE|os.O_RDWR)
+ bundleFile, err := fs.OpenFile("/metropolis-installer/bundle.bin", os.O_CREATE|os.O_RDWR)
if err != nil {
panic(err)
}
diff --git a/metropolis/node/build/mkimage/osimage/osimage.go b/metropolis/node/build/mkimage/osimage/osimage.go
index 5aeeccd..d730e68 100644
--- a/metropolis/node/build/mkimage/osimage/osimage.go
+++ b/metropolis/node/build/mkimage/osimage/osimage.go
@@ -42,7 +42,7 @@
ESPVolumeLabel = "ESP"
EFIPayloadPath = "/EFI/BOOT/BOOTx64.EFI"
- nodeParamsPath = "/EFI/metropolis/parameters.pb"
+ nodeParamsPath = "/metropolis/parameters.pb"
mib = 1024 * 1024
)
@@ -87,7 +87,7 @@
}
// Create the EFI partition structure.
- for _, dir := range []string{"/EFI", "/EFI/BOOT", "/EFI/metropolis"} {
+ for _, dir := range []string{"/EFI", "/EFI/BOOT", "/metropolis"} {
if err := fs.Mkdir(dir); err != nil {
return fmt.Errorf("while creating %q: %w", dir, err)
}
diff --git a/metropolis/node/core/cluster/cluster.go b/metropolis/node/core/cluster/cluster.go
index 144a47b..fe29abd 100644
--- a/metropolis/node/core/cluster/cluster.go
+++ b/metropolis/node/core/cluster/cluster.go
@@ -101,7 +101,7 @@
state.oneway = true
unlock()
- configuration, err := m.storageRoot.ESP.SealedConfiguration.Unseal()
+ configuration, err := m.storageRoot.ESP.Metropolis.SealedConfiguration.Unseal()
if err == nil {
supervisor.Logger(ctx).Info("Sealed configuration present. attempting to join cluster")
return m.join(ctx, configuration)
@@ -213,7 +213,7 @@
} else {
supervisor.Logger(ctx).Infof("Retrieved node parameters from qemu fwcfg")
}
- paramsESP, err := m.storageRoot.ESP.NodeParameters.Unmarshal()
+ paramsESP, err := m.storageRoot.ESP.Metropolis.NodeParameters.Unmarshal()
if err != nil {
supervisor.Logger(ctx).Warningf("Could not retrieve node parameters from ESP: %v", err)
paramsESP = nil
diff --git a/metropolis/node/core/localstorage/storage_esp.go b/metropolis/node/core/localstorage/storage_esp.go
index 03f43c7..329b357 100644
--- a/metropolis/node/core/localstorage/storage_esp.go
+++ b/metropolis/node/core/localstorage/storage_esp.go
@@ -34,6 +34,14 @@
// for the system to bootstrap, register into, or join a cluster.
type ESPDirectory struct {
declarative.Directory
+ Metropolis ESPMetropolisDirectory `dir:"metropolis"`
+}
+
+// ESPMetropolisDirectory is the directory inside the EFI System Partition where
+// Metropolis-related data is stored that's not read by EFI itself like
+// bootstrap-related data.
+type ESPMetropolisDirectory struct {
+ declarative.Directory
SealedConfiguration ESPSealedConfiguration `file:"sealed_configuration.pb"`
NodeParameters ESPNodeParameters `file:"parameters.pb"`
}
diff --git a/metropolis/node/installer/main.go b/metropolis/node/installer/main.go
index dc72e07..075dbb5 100644
--- a/metropolis/node/installer/main.go
+++ b/metropolis/node/installer/main.go
@@ -197,13 +197,13 @@
log.Fatalf("while mounting the installer ESP: %v", err)
}
- nodeParameters, err := os.Open("/installer/EFI/metropolis-installer/nodeparams.pb")
+ nodeParameters, err := os.Open("/installer/metropolis-installer/nodeparams.pb")
if err != nil {
log.Fatalf("failed to open node parameters from ESP: %v", err)
}
// TODO(lorenz): Replace with proper bundles
- bundle, err := zip.OpenReader("/installer/EFI/metropolis-installer/bundle.bin")
+ bundle, err := zip.OpenReader("/installer/metropolis-installer/bundle.bin")
if err != nil {
log.Fatalf("failed to open node bundle from ESP: %v", err)
}