From 778c46763e40cfa90e23cdfdbb28295cbbee5cf9 Mon Sep 17 00:00:00 2001 From: Abhishek Kekane Date: Fri, 24 Nov 2017 10:38:36 +0000 Subject: [PATCH] Prevent image become active without disk and container formats If you run image-import api on any image which is in uploading state and does not have container-format and/or disk-format set goes into active state. The reason is during import call status is set to importing from uploading and while checking container format and disk formats are specified only 'queued' status was taken into consideration. Added 'uploading' status where validation is done to check whether disk format and container format is added to the image. Change-Id: I2865d81a01e5ab5d113bd809c273a2876213e7d4 Closes-Bug: #1733816 --- glance/domain/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/glance/domain/__init__.py b/glance/domain/__init__.py index 1e512eaf75..eaf7ac5a40 100644 --- a/glance/domain/__init__.py +++ b/glance/domain/__init__.py @@ -150,9 +150,8 @@ class Image(object): LOG.debug(e) raise e - if self._status == 'queued' and status in ('saving', - 'active', - 'importing'): + if self._status in ('queued', 'uploading') and status in ( + 'saving', 'active', 'importing'): missing = [k for k in ['disk_format', 'container_format'] if not getattr(self, k)] if len(missing) > 0: