worker_counts=0 disables Landscape services instead of maximizes resource usage like the charm config says
Bug #2092054 reported by
Ryan Stewart
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Landscape Charm |
New
|
Undecided
|
Unassigned |
Bug Description
When you set worker_counts=0, it disables key Landscape services by setting them to 0 in /etc/default/
As per the description: "If set to 0, the charm will automatically pick a value, trying to maximize the use of the computer/memory resources available on the unit."
Either the charm needs to reflect the documentation, or the documentation needs to reflect what actually happens.
To post a comment you must log in.
There doesn't appear to be any check for a zero value when the charm starts up and ingests its config:
# charm.py services( self) -> bool:
self.unit. status = MaintenanceStat us("Starting services") is_leader( )
deployment_ mode = self.model. config. get("deployment _mode")
is_standalone = deployment_mode == "standalone"
def _start_
"""
Starts all Landscape Server systemd services. Returns True if
successful, False otherwise.
"""
is_leader = self.unit.
{
),
}
)
Nor in the method that writes out the defaults file, which just writes k=v for each line:
# settings_files.py default_ settings( updates: dict) -> None:
def update_
"""
Updates the Landscape Server default settings file.
This file is mainly used to determine which services should be SETTINGS, "r") as settings_fp:
running for this installation.
"""
with open(DEFAULT_
new_lines = []
for line in settings_fp:
new_line = f'{key} ="{updates[ key]}"\ n'
new_line = line
if "=" in line and line.split("=")[0] in updates:
key = line.split("=")[0]
else:
with open(DEFAULT_ SETTINGS, "w") as settings_file:
settings_ file.write( "".join( new_lines) )
Documentation should be updated as this functionality doesn't appear to be implemented anywhere. As an interim fix, zero could just be turned into 1 or yes, but actual autoscaling/ resource maximization would require a new charm feature.