[lxc-devel] [nova-lxd/master] Update check for image format
zulcss on Github
lxc-bot at linuxcontainers.org
Tue Apr 12 15:06:43 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 410 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160412/f2914275/attachment.bin>
-------------- next part --------------
From 9836e520f8bb162fede28e06fbbaf6f655e7e517 Mon Sep 17 00:00:00 2001
From: Chuck Short <chuck.short at canonical.com>
Date: Mon, 11 Apr 2016 21:27:24 -0400
Subject: [PATCH] Re-add check for root-tar image format
Check for root-tar image format as well as raw.
Signed-off-by: Chuck Short <chuck.short at canonical.com>
---
nova_lxd/nova/virt/lxd/image.py | 6 +++---
nova_lxd/tests/test_image.py | 3 ++-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/nova_lxd/nova/virt/lxd/image.py b/nova_lxd/nova/virt/lxd/image.py
index 2f29fcd..9988adb 100644
--- a/nova_lxd/nova/virt/lxd/image.py
+++ b/nova_lxd/nova/virt/lxd/image.py
@@ -130,10 +130,10 @@ def _verify_image(self, context, instance):
raise exception.ImageUnacceptable(image_id=instance.image_ref,
reason=reason)
- if disk_format != 'raw':
+ if disk_format not in ['raw', 'root-tar']:
reason = _('nova-lxd does not support images in %s format. '
- 'You should upload an image in raw format.') % \
- disk_format
+ 'You should upload an image in raw or root-tar '
+ 'format.') % disk_format
raise exception.ImageUnacceptable(image_id=instance.image_ref,
reason=reason)
except Exception as ex:
diff --git a/nova_lxd/tests/test_image.py b/nova_lxd/tests/test_image.py
index 5041827..61519dc 100644
--- a/nova_lxd/tests/test_image.py
+++ b/nova_lxd/tests/test_image.py
@@ -49,7 +49,8 @@ def setUp(self):
self.image = image.LXDContainerImage()
@stubs.annotated_data(
- ('valid_image', True, {'disk_format': 'raw'}, None),
+ ('valid_image_raw', True, {'disk_format': 'raw'}, None),
+ ('valid_image_root-tar', True, {'disk_format': 'root-tar'}, None),
('qcow2_image', False, {'disk_format': 'qcow2'},
exception.ImageUnacceptable),
('iso_image', False, {'disk_format': 'iso'},
More information about the lxc-devel
mailing list