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
This commit is contained in:
Abhishek Kekane 2017-11-24 10:38:36 +00:00 committed by Brian Rosmaita
parent d8bcf8ba13
commit 778c46763e
1 changed files with 2 additions and 3 deletions

View File

@ -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: