[lxc-devel] [lxd/master] lxd-p2c: Respect LXD_SOCKET environment variable
ganto on Github
lxc-bot at linuxcontainers.org
Wed May 30 04:48:19 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 461 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180530/3fa866e2/attachment.bin>
-------------- next part --------------
From a8e232d7d4ff23544c54cdd4678335fe7988cf3e Mon Sep 17 00:00:00 2001
From: Reto Gantenbein <reto.gantenbein at linuxmonk.ch>
Date: Wed, 30 May 2018 06:41:49 +0200
Subject: [PATCH] lxd-p2c: Respect LXD_SOCKET environment variable
The unix socket path of the LXD service can be customized via
LXD_SOCKET variable. Make sure this is also supported when migrating
containers from LXC to LXD.
Signed-off-by: Reto Gantenbein <reto.gantenbein at linuxmonk.ch>
---
scripts/lxc-to-lxd | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/lxc-to-lxd b/scripts/lxc-to-lxd
index 1aaa964a2..4a93a4e16 100755
--- a/scripts/lxc-to-lxd
+++ b/scripts/lxc-to-lxd
@@ -601,7 +601,10 @@ if (not args.containers and not args.all) or (args.containers and args.all):
parser.error("You must either pass container names or --all")
# Connect to LXD
-lxd_socket = os.path.join(args.lxdpath, "unix.socket")
+if 'LXD_SOCKET' in os.environ:
+ lxd_socket = os.environ['LXD_SOCKET']
+else:
+ lxd_socket = os.path.join(args.lxdpath, "unix.socket")
if not os.path.exists(lxd_socket):
print("LXD isn't running.")
More information about the lxc-devel
mailing list