Skip to content

Commit

Permalink
fix: use same COS_* partition sizes regardless of separate data disk
Browse files Browse the repository at this point in the history
When Harvester is installed with a single disk shared between OS and
data, we set the COS_STATE parittion size to 15G. When using a separate
data disk, we just use the Elemental default partition layout, which
only gives COS_STATE of 8G. This causes problems with upgrades due to
lack of space.

This commit ensures we set a 15G COS_STATE parition in both of the above
cases.

Related issue: harvester/harvester#7457
Related issue: harvester/harvester#7493

Signed-off-by: Tim Serong <[email protected]>
(cherry picked from commit e12e251)
  • Loading branch information
tserong authored and bk201 committed Feb 13, 2025
1 parent a8451e8 commit 1d9f83e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 27 additions & 1 deletion pkg/config/cos.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,33 @@ func calcCosPersistentPartSize(diskSizeGiB uint64, partSize string) (uint64, err
return util.ByteToMi(size), nil
}

func CreateRootPartitioningLayout(elementalConfig *ElementalConfig, hvstConfig *HarvesterConfig) (*ElementalConfig, error) {
func CreateRootPartitioningLayoutSeparateDataDisk(elementalConfig *ElementalConfig) *ElementalConfig {
elementalConfig.Install.Partitions = &ElementalDefaultPartition{
OEM: &ElementalPartition{
FilesystemLabel: "COS_OEM",
Size: DefaultCosOemSizeMiB,
FS: "ext4",
},
State: &ElementalPartition{
FilesystemLabel: "COS_STATE",
Size: DefaultCosStateSizeMiB,
FS: "ext4",
},
Recovery: &ElementalPartition{
FilesystemLabel: "COS_RECOVERY",
Size: DefaultCosRecoverySizeMiB,
FS: "ext4",
},
Persistent: &ElementalPartition{
FilesystemLabel: "COS_PERSISTENT",
Size: 0,
FS: "ext4",
},
}
return elementalConfig
}

func CreateRootPartitioningLayoutSharedDataDisk(elementalConfig *ElementalConfig, hvstConfig *HarvesterConfig) (*ElementalConfig, error) {
diskSizeBytes, err := util.GetDiskSizeBytes(hvstConfig.Install.Device)
if err != nil {
return nil, err
Expand Down
4 changes: 3 additions & 1 deletion pkg/console/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,12 @@ func doInstall(g *gocui.Gui, hvstConfig *config.HarvesterConfig, webhooks Render

if hvstConfig.ShouldCreateDataPartitionOnOsDisk() {
// Use custom layout (which also creates Longhorn partition) when needed
elementalConfig, err = config.CreateRootPartitioningLayout(elementalConfig, hvstConfig)
elementalConfig, err = config.CreateRootPartitioningLayoutSharedDataDisk(elementalConfig, hvstConfig)
if err != nil {
return err
}
} else {
elementalConfig = config.CreateRootPartitioningLayoutSeparateDataDisk(elementalConfig)
}

if hvstConfig.DataDisk != "" {
Expand Down

0 comments on commit 1d9f83e

Please sign in to comment.