[lxc-devel] [lxd/master] More lxc-to-lxd fixes

stgraber on Github lxc-bot at linuxcontainers.org
Tue Nov 29 00:19:54 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161129/0c2ea111/attachment.bin>
-------------- next part --------------
From e1ba6f1d7356b4a515c3462812e5411b1a5388f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 28 Nov 2016 17:52:34 -0500
Subject: [PATCH 1/2] lxc-to-lxd: Show nicer error on missing python3-lxc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 scripts/lxc-to-lxd | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/lxc-to-lxd b/scripts/lxc-to-lxd
index 516d12b..3054192 100755
--- a/scripts/lxc-to-lxd
+++ b/scripts/lxc-to-lxd
@@ -2,12 +2,17 @@
 import argparse
 import http.client
 import json
-import lxc
 import os
 import socket
 import subprocess
 import sys
 
+try:
+    import lxc
+except ImportError:
+    print("You must have python3-lxc installed for this script to work.")
+    sys.exit(1)
+
 
 # Unix connection to LXD
 class UnixHTTPConnection(http.client.HTTPConnection):

From e5559bd479db5fd5657f621e0b8a9d14adb84e64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 28 Nov 2016 17:57:06 -0500
Subject: [PATCH 2/2] lxc-to-lxd: All properties must be strings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #2663

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 scripts/lxc-to-lxd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lxc-to-lxd b/scripts/lxc-to-lxd
index 3054192..e2044b5 100755
--- a/scripts/lxc-to-lxd
+++ b/scripts/lxc-to-lxd
@@ -233,7 +233,7 @@ def convert_container(lxd_socket, container_name, args):
             device['parent'] = dev.link
 
         if dev.mtu:
-            device['mtu'] = int(dev.mtu)
+            device['mtu'] = dev.mtu
 
         if dev.name:
             device['name'] = dev.name


More information about the lxc-devel mailing list