In previous PR we moved setup_azure_slice before checking which slice the agent is in. This resulted in cgroup usage being disabled on first agent update. We should check the agent unit 'Slice' property before setting up azure.slice because the agent's Slice unit property will be 'azure.slice' if the slice drop-in file exists, even though systemd has not moved the agent to azure.slice yet. Systemd will only move the agent to azure.slice after a service restart.
On first agent update (for machines where daemon version did not already create azure.slice), the agent creates azure.slice and the agent unit Slice drop-in file, but systemd does not move the agent unit to azure.slice until service restart. It is ok to enable cgroup usage in this case if agent is running in system.slice.
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
Description
In previous PR we moved setup_azure_slice before checking which slice the agent is in. This resulted in cgroup usage being disabled on first agent update. We should check the agent unit 'Slice' property before setting up azure.slice because the agent's Slice unit property will be 'azure.slice' if the slice drop-in file exists, even though systemd has not moved the agent to azure.slice yet. Systemd will only move the agent to azure.slice after a service restart.
On first agent update (for machines where daemon version did not already create azure.slice), the agent creates azure.slice and the agent unit Slice drop-in file, but systemd does not move the agent unit to azure.slice until service restart. It is ok to enable cgroup usage in this case if agent is running in system.slice.
Issue #
PR information
Quality of Code and Contribution Guidelines