[lxc-devel] [nova-lxd/master] Show actual error message when LXD API fails
dstelter on Github
lxc-bot at linuxcontainers.org
Wed May 25 20:43:43 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 1076 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160525/0106f78a/attachment.bin>
-------------- next part --------------
From 491e0f52854688672868ca6c8942650c11ef969d Mon Sep 17 00:00:00 2001
From: Daniel Stelter-Gliese <ds at siriuswhite.de>
Date: Wed, 25 May 2016 22:38:33 +0200
Subject: [PATCH] Show actual error message when LXD API fails
When the LXD API returns an error during instance creation, the actual error message is passed in data['metadata']['err'], not data['metadata']['metadata'].
Even worse metadata might be empty, in which case Nova will only show "An unknown exception occured".
---
nova/virt/lxd/session.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/nova/virt/lxd/session.py b/nova/virt/lxd/session.py
index e2fdc0d..3d05e9c 100644
--- a/nova/virt/lxd/session.py
+++ b/nova/virt/lxd/session.py
@@ -531,7 +531,8 @@ def container_init(self, config, instance):
status, data = self.operation_info(operation, instance)
data = data.get('metadata')
if not data['status_code'] == 200:
- raise exception.NovaException(data['metadata'])
+ msg = data.get('err') or data['metadata']
+ raise exception.NovaException(msg)
LOG.info(_LI('Successfully created container %(instance)s with'
' %(image)s'), {'instance': instance.name,
More information about the lxc-devel
mailing list