Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update log collector unit file to remove memorylimit #2757

Merged
merged 10 commits into from
Feb 10, 2023

Conversation

maddieford
Copy link
Contributor

@maddieford maddieford commented Feb 9, 2023

Description

This previous PR (#2637) removed memory limit from the log collector slice unit file, but cgroupconfigurator currently only updates the unit file if it does not already exist. This memory limit change is included in 2.9.0.4. For VMs which upgrade to 2.9.0.4 from earlier versions, the unit file is created with a memorylimit and never updated.

This PR updates cgroupconfigurator to always update the log collector slice unit file to remove memorylimit.

Issue #


PR information

  • The title of the PR is clear and informative.
  • There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
  • If applicable, the PR references the bug/issue that it fixes in the description.
  • New Unit tests were added for the changes made

Quality of Code and Contribution Guidelines

@@ -119,7 +119,7 @@ def _set_resource_usage_cgroups(cpu_cgroup_path, memory_cgroup_path):
@staticmethod
def _initialize_telemetry():
protocol = get_protocol_util().get_protocol(init_goal_state=False)
protocol.client.reset_goal_state(goalstate_properties=GoalStateProperties.RoleConfig | GoalStateProperties.HostingEnv)
protocol.client.reset_goal_state(goal_state_properties=GoalStateProperties.RoleConfig | GoalStateProperties.HostingEnv)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this issue from a previous PR because collect-logs was failing to run

@codecov
Copy link

codecov bot commented Feb 9, 2023

Codecov Report

Merging #2757 (18f2c24) into develop (36a5ec1) will decrease coverage by 0.01%.
The diff coverage is 66.66%.

@@             Coverage Diff             @@
##           develop    #2757      +/-   ##
===========================================
- Coverage    72.04%   72.03%   -0.01%     
===========================================
  Files          104      104              
  Lines        15832    15831       -1     
  Branches      2265     2264       -1     
===========================================
- Hits         11406    11404       -2     
+ Misses        3912     3909       -3     
- Partials       514      518       +4     
Impacted Files Coverage Δ
azurelinuxagent/common/logcollector.py 88.35% <0.00%> (ø)
azurelinuxagent/common/cgroupconfigurator.py 72.19% <100.00%> (-0.20%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

slice_contents = _LOGCOLLECTOR_SLICE_CONTENTS_FMT.format(cpu_quota=_LOGCOLLECTOR_CPU_QUOTA)

files_to_create.append((logcollector_slice, slice_contents))
## Log collector slice should be updated to remove MemoryLimit quota from previous GA versions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rephrase this comment a little. In this specific instance we want to remove the limit set by 2.8, but in general what we want is to update the settings with the values used by the current version (which is what this code is doing)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the comment

# The mock creates the slice unit file with memory limit
configurator.mocks.add_data_file(os.path.join(data_dir, 'init', "azure-walinuxagent-logcollector.slice"),
UnitFilePaths.logcollector)
self.assertTrue(os.path.exists(log_collector_unit_file),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setup errors should be reported with exceptions, rather than asserts, to distinguish them from actual test verifications (such as line 208 below)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this check & the next check that memory limit exists to raise exceptions instead

@maddieford maddieford merged commit dd4e72d into Azure:develop Feb 10, 2023
@maddieford maddieford deleted the logcollector_memlimit branch April 7, 2023 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants