Skip to content

Commit 9d9c208

Browse files
authored
Updating installer (#642)
Fixing opensearch memory assign bug
1 parent cc39996 commit 9d9c208

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

installer/compose.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,9 @@ func (c *Compose) Populate(conf *Config, stack *StackConfig) *Compose {
460460
},
461461
}
462462

463-
opensearchMem := stack.ServiceResources["opensearch"].AssignedMemory
463+
// Calculating the less closed odd value to assign the final memory, because if an even value is returned
464+
// opensearch raises an error
465+
opensearchMem := utils.GetOddValue(stack.ServiceResources["opensearch"].AssignedMemory)
464466
// temporary create node1 always
465467
if true {
466468
c.Services["node1"] = Service{

installer/utils/memory_utils.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,10 @@ func BalanceMemory(services []ServiceConfig, totalMemory int) (map[string]*Servi
136136

137137
return serviceMap, nil
138138
}
139+
140+
func GetOddValue(value int) int {
141+
if value%2 == 0 {
142+
return value
143+
}
144+
return value - 1
145+
}

0 commit comments

Comments
 (0)