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

Use controller mount point for extension cgroup path #1899

Merged
merged 3 commits into from
Jun 3, 2020

Conversation

narrieta
Copy link
Member

@narrieta narrieta commented Jun 1, 2020

A small change in how we create the path for extensions cgroups. Instead of a hardcoded path now we use the mount point for the controllers.

Also, some test updates.

@codecov
Copy link

codecov bot commented Jun 1, 2020

Codecov Report

Merging #1899 into develop will decrease coverage by 0.05%.
The diff coverage is 73.46%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1899      +/-   ##
===========================================
- Coverage    69.42%   69.37%   -0.06%     
===========================================
  Files           85       85              
  Lines        11789    11811      +22     
  Branches      1653     1658       +5     
===========================================
+ Hits          8185     8194       +9     
- Misses        3239     3249      +10     
- Partials       365      368       +3     
Impacted Files Coverage Δ
azurelinuxagent/common/cgroupapi.py 79.06% <71.11%> (-2.36%) ⬇️
azurelinuxagent/common/cgroupconfigurator.py 74.80% <100.00%> (+0.19%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d68dd3b...541b7fa. Read the comment docs.

larohra
larohra previously approved these changes Jun 1, 2020
Copy link
Contributor

@larohra larohra left a comment

Choose a reason for hiding this comment

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

Some minor comments, else LGTM

if cpu_cgroup_mountpoint is None:
logger.info("The CPU controller is not mounted; will not track resource usage")
else:
cpu_cgroup_path = os.path.join(cpu_cgroup_mountpoint, cgroup_relative_path)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, would this path and the path from get_process_cgroup_paths be same?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. I was planning on using that function, but then I realize I do not have the process of the extension (I do have the process id of systemd-run, which the agent calls, but not of the extension itself.)

The documentation of systemd-run specifies that the cgroup is created under the system slice (unless changed by the --slice argument) so this should be safe.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh ok makes sense.
I have another question (possibly outside the scope of this PR), why dont we create a new slice for each extension when invoking them? Using the --slice argument that you mentioned? Or were we actually doing that at some point but reverted to the system slice for some unknown issues?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we already have the code that creates the slices and starts extensions in them, but it is not enabled because some versions of systemd simply ignore the --slice argument. As I start working on extensions I will add code to use those features when they are available.

tests/common/test_cgroupconfigurator.py Outdated Show resolved Hide resolved
tests/common/test_cgroupconfigurator.py Outdated Show resolved Hide resolved
Copy link
Contributor

@pgombar pgombar left a comment

Choose a reason for hiding this comment

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

Minor comment, otherwise LGTM

stdout=stdout,
stderr=stderr,
error_code=error_code)
process_output = self._cgroups_api.start_extension_command(extension_name,
Copy link
Contributor

Choose a reason for hiding this comment

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

You should change the return signature of azurelinuxagent.common.cgroupapi.FileSystemCgroupsApi.start_extension_command too since it still returns extension_cgroups, process_output.

Copy link
Member Author

@narrieta narrieta Jun 3, 2020

Choose a reason for hiding this comment

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

FileSystemCgroupsApi is at this point dead code. I am keeping it there because I will use some of that code when I get to distros without systemd

@@ -64,13 +64,14 @@
'''
Running scope as unit: TEST_UNIT.scope
Thu 28 May 2020 07:25:55 AM PDT
''')
'''),
Copy link
Contributor

Choose a reason for hiding this comment

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

Intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, makes adding more items a little simple

Copy link
Contributor

@larohra larohra left a comment

Choose a reason for hiding this comment

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

LGTM

@narrieta narrieta merged commit 78c6600 into Azure:develop Jun 3, 2020
@narrieta narrieta deleted the cgroup-extensions branch June 3, 2020 18:22
rbgithuub pushed a commit to rbgithuub/WALinuxAgent that referenced this pull request Jun 14, 2020
* Use controller mount point for extension cgroup path

* Fixed typos

Co-authored-by: narrieta <narrieta>
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.

None yet

3 participants