-
Notifications
You must be signed in to change notification settings - Fork 927
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
Support local unix socket in lxd-migrate - from Incus #13599
Conversation
Signed-off-by: Stéphane Graber <stgraber@stgraber.org> (cherry picked from commit fd5f83b0bf804c97e970898b91a5366168315742) Signed-off-by: Din Music <din.music@canonical.com> License: Apache-2.0
Signed-off-by: Din Music <din.music@canonical.com>
client/connection.go
Outdated
} else { | ||
path = "/var/lib/lxd/unix.socket" | ||
if !shared.PathIsWritable(shared.HostPath(path)) { | ||
path = "/var/snap/lxd/common/lxd/unix.socket" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change required? How is the lxc
command working inside the snap, does it set LXD_DIR env?
Are you adding this for lxd-migrate's benefit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should re-arrange it so that if /var/snap/lxd/common/lxd/unix.socket is writable we use it, otherwise fallback to /var/lib/lxd/unix.socket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the lxc command working inside the snap, does it set LXD_DIR env?
Yes.
https://github.com/canonical/lxd-pkg-snap/blob/latest-edge/snapcraft/commands/lxc#L32-L38
Is this change required? Are you adding this for lxd-migrate's benefit?
The lxd-migrate
is not snapped, so it will not have LXD_DIR
set. Therefore, we can avoid this change and make lxd-migrate
check for the snapped LXD socket explicitly.
So, it will benefit lxd-migrate
, but I wanted to take this opportunity to change this, as it will also benefit Terraform provider, and probably pylxd which are currently trying which socket exists as they are not snapped.
I think we should re-arrange it so that if /var/snap/lxd/common/lxd/unix.socket is writable we use it, otherwise fallback to /var/lib/lxd/unix.socket
Fixed.
Signed-off-by: Din Music <din.music@canonical.com>
fbee348
to
29b8fd4
Compare
Signed-off-by: Din Music <din.music@canonical.com>
Signed-off-by: Stéphane Graber <stgraber@stgraber.org> (cherry picked from commit 09e4119da1ca24d2c08a0bd9597a7e6a16803a74) Signed-off-by: Din Music <din.music@canonical.com> License: Apache-2.0
29b8fd4
to
50c5df2
Compare
If tool
lxd-migrate
is capable of connection to a local LXD unix socket, first offer the user option to use the socket.In addition, go client function for connecting to a LXD unix socket is expanded to check for snapped LXD unix socket.