From 02876f65f0547e4b0d99f80ecb166fc385f6239b Mon Sep 17 00:00:00 2001
From: Paul Gaiduk <paulg@zededa.com>
Date: Fri, 10 Jan 2025 18:58:25 +0100
Subject: [PATCH] global params: rename LogRemainToSendMBytes

Since not all logs in persist are to be sent, we rename
LogRemainToSendMBytes to MaxGzipLogMBytesInPersist. This
parameter represents the maxinum size of all gzipped logs
in persist.

Signed-off-by: Paul Gaiduk <paulg@zededa.com>
---
 pkg/pillar/cmd/volumemgr/sizemgmt.go | 2 +-
 pkg/pillar/diskmetrics/usage.go      | 2 +-
 pkg/pillar/types/global.go           | 8 ++++----
 pkg/pillar/types/global_test.go      | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/pkg/pillar/cmd/volumemgr/sizemgmt.go b/pkg/pillar/cmd/volumemgr/sizemgmt.go
index a882c898729..008e2c57d4d 100644
--- a/pkg/pillar/cmd/volumemgr/sizemgmt.go
+++ b/pkg/pillar/cmd/volumemgr/sizemgmt.go
@@ -85,7 +85,7 @@ func getRemainingDiskSpace(ctxPtr *volumemgrContext) (uint64, error) {
 // Everything in /persist except these directories/datasets counts
 // as EVE overhead.
 // Note that we also exclude /persist/newlog here since it maintains its own
-// size limit (GlobalValueInt(types.LogRemainToSendMBytes)) the caller
+// size limit (GlobalValueInt(types.MaxGzipLogMBytesInPersist)) the caller
 // needs to consider as EVE overhead.
 var excludeDirs = append(types.AppPersistPaths, types.NewlogDir)
 
diff --git a/pkg/pillar/diskmetrics/usage.go b/pkg/pillar/diskmetrics/usage.go
index 69951a6e4c0..2cbaf185d6d 100644
--- a/pkg/pillar/diskmetrics/usage.go
+++ b/pkg/pillar/diskmetrics/usage.go
@@ -204,7 +204,7 @@ func Dom0DiskReservedSize(log *base.LogObject, globalConfig *types.ConfigItemVal
 		(float64(dom0MinDiskUsagePercent) * 0.01))
 	staticMaxDom0DiskSize := uint64(globalConfig.GlobalValueInt(
 		types.Dom0DiskUsageMaxBytes))
-	newlogReserved := uint64(globalConfig.GlobalValueInt(types.LogRemainToSendMBytes))
+	newlogReserved := uint64(globalConfig.GlobalValueInt(types.MaxGzipLogMBytesInPersist))
 	// Always leave space for /persist/newlogd
 	maxDom0DiskSize := newlogReserved
 	// Select the larger of the current overhead usage and the configured
diff --git a/pkg/pillar/types/global.go b/pkg/pillar/types/global.go
index 92db699b361..816441a0e5e 100644
--- a/pkg/pillar/types/global.go
+++ b/pkg/pillar/types/global.go
@@ -209,8 +209,8 @@ const (
 	AppContainerStatsInterval GlobalSettingKey = "timer.appcontainer.stats.interval"
 	// VaultReadyCutOffTime global setting key
 	VaultReadyCutOffTime GlobalSettingKey = "timer.vault.ready.cutoff"
-	// LogRemainToSendMBytes Max gzip log files remain on device to be sent in Mbytes
-	LogRemainToSendMBytes GlobalSettingKey = "newlog.gzipfiles.ondisk.maxmegabytes"
+	// MaxGzipLogMBytesInPersist Max size of gzip log files in persist in Mbytes
+	MaxGzipLogMBytesInPersist GlobalSettingKey = "newlog.gzipfiles.ondisk.maxmegabytes"
 
 	// ForceFallbackCounter global setting key
 	ForceFallbackCounter = "force.fallback.counter"
@@ -960,8 +960,8 @@ func NewConfigItemSpecMap() ConfigItemSpecMap {
 		eveMemoryLimitInMiB, 0xFFFFFFFF)
 	// Limit manual vmm overhead override to 1 PiB
 	configItemSpecMap.AddIntItem(VmmMemoryLimitInMiB, 0, 0, uint32(1024*1024*1024))
-	// LogRemainToSendMBytes - Default is 2 Gbytes, minimum is 10 Mbytes
-	configItemSpecMap.AddIntItem(LogRemainToSendMBytes, 2048, 10, 0xFFFFFFFF)
+	// MaxGzipLogMBytesInPersist - Default is 2 Gbytes, minimum is 10 Mbytes
+	configItemSpecMap.AddIntItem(MaxGzipLogMBytesInPersist, 2048, 10, 0xFFFFFFFF)
 	configItemSpecMap.AddIntItem(DownloadMaxPortCost, 0, 0, 255)
 	configItemSpecMap.AddIntItem(BlobDownloadMaxRetries, 5, 1, 10)
 
diff --git a/pkg/pillar/types/global_test.go b/pkg/pillar/types/global_test.go
index 21c45b91d5d..3324fab9cd7 100644
--- a/pkg/pillar/types/global_test.go
+++ b/pkg/pillar/types/global_test.go
@@ -175,7 +175,7 @@ func TestNewConfigItemSpecMap(t *testing.T) {
 		Dom0DiskUsageMaxBytes,
 		StorageZfsReserved,
 		ForceFallbackCounter,
-		LogRemainToSendMBytes,
+		MaxGzipLogMBytesInPersist,
 		DownloadMaxPortCost,
 		BlobDownloadMaxRetries,
 		// Bool Items