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

add and remove extension slice #2315

Merged
merged 4 commits into from
Jul 29, 2021
Merged

Conversation

nagworld9
Copy link
Contributor

Description

Issue # TASK 10370976


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

@codecov
Copy link

codecov bot commented Jul 23, 2021

Codecov Report

Merging #2315 (671a366) into develop (05eef39) will increase coverage by 0.02%.
The diff coverage is 86.66%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2315      +/-   ##
===========================================
+ Coverage    70.66%   70.69%   +0.02%     
===========================================
  Files           97       97              
  Lines        13988    14017      +29     
  Branches      2006     2010       +4     
===========================================
+ Hits          9885     9909      +24     
- Misses        3656     3660       +4     
- Partials       447      448       +1     
Impacted Files Coverage Δ
azurelinuxagent/common/cgroupconfigurator.py 70.78% <78.57%> (+0.27%) ⬆️
azurelinuxagent/common/cgroupapi.py 80.60% <100.00%> (+0.23%) ⬆️
azurelinuxagent/ga/exthandlers.py 86.19% <100.00%> (+0.03%) ⬆️
azurelinuxagent/common/cgroupstelemetry.py 100.00% <0.00%> (+1.88%) ⬆️

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 05eef39...671a366. Read the comment docs.

# Since '-' is used as a separator in systemd unit names, we replace it with '_' to prevent side-effects.
return extension_name.replace('-', '_')
return "azure-vmextensions-" + extension_name.replace('-', '_')
Copy link
Member

Choose a reason for hiding this comment

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

let's use CGroupConfigurator._VMEXTENSIONS_SLICE instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It has .slice suffix which we don't want.

Copy link
Member

Choose a reason for hiding this comment

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

let's declare another constant in the same place (minus ".slice") or remove ".slice" here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is creating cycling dependency issue.. I have created constant in the cgroupapi Module.

@@ -67,9 +67,9 @@ def track_cgroups(extension_cgroups):
"Error: {1}".format(cgroup.path, ustr(exception)))

@staticmethod
def _get_extension_cgroup_name(extension_name):
def get_extension_cgroup_name(extension_name):
Copy link
Member

Choose a reason for hiding this comment

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

the slice names are particular to systemd, so let's make this change in SystemdCgroupsApi instead of CGroupsApi

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.

@@ -48,6 +48,14 @@
[Slice]
CPUAccounting=yes
"""
_EXTENSION_SLICE_CONTENTS = """
[Unit]
Description=Slice for Azure VM Publisher Extension
Copy link
Member

Choose a reason for hiding this comment

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

Let's remove "Publishers" and add the name of the extension

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed

@@ -1503,6 +1506,8 @@ def uninstall(self, extension=None):
uninstall_cmd = man.get_uninstall_command()
self.logger.info("Uninstall extension [{0}]".format(uninstall_cmd))
self.launch_command(uninstall_cmd, extension=extension)
CGroupConfigurator.get_instance().remove_extension_slice(
Copy link
Member

Choose a reason for hiding this comment

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

the cleanup of extensions files is done in remove_ext_handler below, we should move this call there

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.

@nagworld9 nagworld9 force-pushed the cgroup-ext branch 4 times, most recently from 8f682de to 19c09ea Compare July 27, 2021 19:15
@@ -36,7 +36,7 @@

CGROUPS_FILE_SYSTEM_ROOT = '/sys/fs/cgroup'
CGROUP_CONTROLLERS = ["cpu", "memory"]

_EXTENSION_SLICE_PREFIX = "azure-vmextensions-"
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for adding this constant. The idea of using CGroupConfigurator._VMEXTENSIONS_SLICE was that if we ever need to update the name, the change should be done in 1 single place. Could you define CGroupConfigurator._VMEXTENSIONS_SLICE in terms of _EXTENSION_SLICE_PREFIX?

narrieta
narrieta previously approved these changes Jul 27, 2021
Copy link
Member

@narrieta narrieta left a comment

Choose a reason for hiding this comment

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

Approved with a minor comment

@nagworld9 nagworld9 merged commit 127defa into Azure:develop Jul 29, 2021
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