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

Delete LXD instance if LXD failed to remove ephemeral instance #57

Merged
merged 4 commits into from
May 12, 2023

Conversation

yhaliaw
Copy link
Collaborator

@yhaliaw yhaliaw commented May 12, 2023

Fix a resource leak problem when LXD failed to remove an ephemeral instance on stop.

This PR includes:

  • Delete LXD ephemeral instance that LXD failed to remove.
  • Installs pylxd from source on GitHub to fix a bug in version on PyPI. See this comment.

@github-actions
Copy link
Contributor

Test coverage for e25f299

Name                    Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------
src/charm.py              252     39     50      9    83%   238, 254-256, 265-266, 273, 284, 295->312, 300-305, 322-323, 327-328, 333-336, 352-353, 387-395, 425-427, 430->exit, 434-436, 459-464, 496
src/errors.py              18      0      0      0   100%
src/event_timer.py         42      8      4      0    74%   96-99, 119-122
src/github_type.py         36      0      0      0   100%
src/lxd_type.py            24      0      0      0   100%
src/runner.py             184     31     46     14    80%   135-155, 223, 260-262, 269, 283, 293, 312, 346-351, 361, 408, 441, 467, 472-484, 498, 516
src/runner_manager.py     189     20     80      8    88%   189-190, 204-210, 214-216, 226-227, 278, 302-306, 325, 343, 456, 476
src/runner_type.py         43      0     10      0   100%
src/utilities.py           55      2     12      4    91%   74->76, 78->84, 89-91
-------------------------------------------------------------------
TOTAL                     843    100    202     35    86%

Static code analysis report

Run started:2023-05-12 03:04:12.387503

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 1822
  Total lines skipped (#nosec): 0
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 9

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@yhaliaw yhaliaw marked this pull request as ready for review May 12, 2023 06:25
@yhaliaw yhaliaw requested a review from a team as a code owner May 12, 2023 06:25
@yhaliaw yhaliaw merged commit 654764c into main May 12, 2023
@yhaliaw yhaliaw deleted the force-runner-removal branch May 12, 2023 07:56
@sirkadirov
Copy link

@yhaliaw Glad that my comment helped you 😊! And yeah, sometimes LXD fails to delete ephemeral instances... I admit, I didn't think that an additional call to the container removal function could improve the situation. Thanks for the idea, I'll try it out in my project.

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.

4 participants