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

Workaround to ensure LXD is stopped before MicroCeph/MicroOVN #710

Merged
merged 2 commits into from
Feb 5, 2025

Conversation

simondeziel
Copy link
Member

No description provided.

@simondeziel
Copy link
Member Author

simondeziel commented Feb 5, 2025

This was tested locally. Installing the snap then bind mounting the altered files from this PR.

We see that the override snippet only comes into play once the daemon is actually started after being woken up by the client request (lxc ls):

root@c1:~# mount -o ro,bind daemon.start /snap/lxd/current/commands/daemon.start 
root@c1:~# mount -o ro,bind remove /snap/lxd/current/snap/hooks/remove 
root@c1:~# systemctl cat snap.lxd.daemon.service
# /etc/systemd/system/snap.lxd.daemon.service
[Unit]
# Auto-generated, DO NOT EDIT
Description=Service for snap application lxd.daemon
Requires=snap-lxd-31214.mount
Wants=network.target
After=snap-lxd-31214.mount network.target snapd.apparmor.service
X-Snappy=yes

[Service]
EnvironmentFile=-/etc/environment
ExecStart=/usr/bin/snap run lxd.daemon
SyslogIdentifier=lxd.daemon
Restart=on-failure
WorkingDirectory=/var/snap/lxd/31214
ExecStop=/usr/bin/snap run --command=stop lxd.daemon
ExecReload=/usr/bin/snap run --command=reload lxd.daemon
TimeoutStopSec=600
Type=simple
Delegate=true
root@c1:~# lxc ls
If this is your first time running LXD on this machine, you should also run: lxd init
To start your first container, try: lxc launch ubuntu:24.04
Or for a virtual machine: lxc launch ubuntu:24.04 --vm

+------+-------+------+------+------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------+-------+------+------+------+-----------+
root@c1:~# systemctl cat snap.lxd.daemon.service
# /etc/systemd/system/snap.lxd.daemon.service
[Unit]
# Auto-generated, DO NOT EDIT
Description=Service for snap application lxd.daemon
Requires=snap-lxd-31214.mount
Wants=network.target
After=snap-lxd-31214.mount network.target snapd.apparmor.service
X-Snappy=yes

[Service]
EnvironmentFile=-/etc/environment
ExecStart=/usr/bin/snap run lxd.daemon
SyslogIdentifier=lxd.daemon
Restart=on-failure
WorkingDirectory=/var/snap/lxd/31214
ExecStop=/usr/bin/snap run --command=stop lxd.daemon
ExecReload=/usr/bin/snap run --command=reload lxd.daemon
TimeoutStopSec=600
Type=simple
Delegate=true

# /run/systemd/system/snap.lxd.daemon.service.d/lxd-shutdown.conf
[Unit]
After=snap.microceph.daemon.service snap.microovn.daemon.service

Also, when removing the snap, the override snippet is cleaned up:

root@c1:~# snap remove lxd
2025-02-05T00:03:07Z INFO Waiting for "snap.lxd.daemon.service" to stop.
lxd removed
root@c1:~# ll /run/systemd/system/snap.lxd.daemon.service.d/
ls: cannot access '/run/systemd/system/snap.lxd.daemon.service.d/': No such file or directory

Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

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

Nice

@tomponline tomponline merged commit 06a8601 into canonical:latest-edge Feb 5, 2025
4 checks passed
@simondeziel simondeziel deleted the shutdown-order branch February 5, 2025 13:38
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.

2 participants