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

CP-49775 convert SMGC to systemd service #692

Merged

Conversation

TimSmithCtx
Copy link
Contributor

Add a templated oneshot service and use systemctl to start it. The systemctl command is invoked with "--no-wait" so that it returns immediately because the "oneshot" nature of the service would otherwise wait until the command completes.

Note that because the service is a oneshot with RemainAfterExit=no (so we can multiply start it), it will go from "activating" to "dead" without ever appearing to be "running".

@TimSmithCtx TimSmithCtx marked this pull request as draft June 13, 2024 10:19
systemd/[email protected] Outdated Show resolved Hide resolved
@TimSmithCtx TimSmithCtx force-pushed the private/timsmi/CP-49775 branch from 578b389 to 0134203 Compare June 13, 2024 11:39
drivers/LVHDSR.py Outdated Show resolved Hide resolved
@TimSmithCtx TimSmithCtx force-pushed the private/timsmi/CP-49775 branch 2 times, most recently from 2f4c150 to 1b905ac Compare June 14, 2024 12:43
drivers/LVHDSR.py Outdated Show resolved Hide resolved
Add a templated oneshot service and use systemctl to start it. The
systemctl command is invoked with "--no-wait" so that it returns
immediately because the "oneshot" nature of the service would otherwise
wait until the command completes.

Note that because the service is a oneshot with RemainAfterExit=no (so
we can multiply start it), it will go from "activating" to "dead"
without ever appearing to be "running".

Signed-off-by: Tim Smith <[email protected]>
@TimSmithCtx TimSmithCtx force-pushed the private/timsmi/CP-49775 branch from 1b905ac to ba43133 Compare June 14, 2024 14:25
state = result.stdout.decode('utf-8').rstrip()
if state == "activating" or state == "running":
return True
return False
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good, do we need to consider the case where systemd is not being used? I'm inclined to say not as I think all consumers of this code are now using systemd

@TimSmithCtx TimSmithCtx marked this pull request as ready for review June 17, 2024 12:42
@@ -3206,6 +3206,10 @@ def gc(session, srUuid, inBackground, dryRun=False):


def start_gc(session, sr_uuid):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this code being retained? I don't see any callers, and the implementation of get_state implies that we only expect the systemd version to be called?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mainly to make it easy for someone who wants to revert to a non-systemd method of doing things to do so
(yes, they'd have to reimplement get-state but the original method of doing so has lock-ordering issues, so leaving it would not have been a service)

@TimSmithCtx TimSmithCtx merged commit 618ecc4 into xapi-project:master Jun 19, 2024
2 checks passed
@TimSmithCtx TimSmithCtx deleted the private/timsmi/CP-49775 branch June 19, 2024 08:26
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