summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Waldon <brian.waldon@rackspace.com>2011-09-09 17:25:45 -0400
committerBrian Waldon <brian.waldon@rackspace.com>2011-09-09 17:25:45 -0400
commit65a0cc41b1b9ead5acd3128a4a6202bb02e3a6e5 (patch)
treef31ade77fba944275429036151a0d67f3ff679dd
parent67a2445265c8bce704802935b83c6e1ece805332 (diff)
downloadnova-65a0cc41b1b9ead5acd3128a4a6202bb02e3a6e5.tar.gz
nova-65a0cc41b1b9ead5acd3128a4a6202bb02e3a6e5.tar.xz
nova-65a0cc41b1b9ead5acd3128a4a6202bb02e3a6e5.zip
fixing image status mapping
-rw-r--r--nova/api/openstack/views/images.py15
-rw-r--r--nova/tests/api/openstack/test_images.py10
2 files changed, 13 insertions, 12 deletions
diff --git a/nova/api/openstack/views/images.py b/nova/api/openstack/views/images.py
index 21f1b2d3e..8983b2957 100644
--- a/nova/api/openstack/views/images.py
+++ b/nova/api/openstack/views/images.py
@@ -37,17 +37,18 @@ class ViewBuilder(object):
def _format_status(self, image):
"""Update the status field to standardize format."""
status_mapping = {
- 'pending': 'QUEUED',
- 'decrypting': 'PREPARING',
- 'untarring': 'SAVING',
- 'available': 'ACTIVE',
- 'killed': 'FAILED',
+ 'active': 'ACTIVE',
+ 'queued': 'SAVING',
+ 'saving': 'SAVING',
+ 'deleted': 'DELETED',
+ 'pending_delete': 'DELETED',
+ 'killed': 'ERROR',
}
try:
- image['status'] = status_mapping[image['status']].upper()
+ image['status'] = status_mapping[image['status']]
except KeyError:
- image['status'] = image['status'].upper()
+ image['status'] = 'UNKNOWN'
def _build_server(self, image, image_obj):
"""Indicates that you must use a ViewBuilder subclass."""
diff --git a/nova/tests/api/openstack/test_images.py b/nova/tests/api/openstack/test_images.py
index 2a7cfc382..46f763d5e 100644
--- a/nova/tests/api/openstack/test_images.py
+++ b/nova/tests/api/openstack/test_images.py
@@ -407,7 +407,7 @@ class ImageControllerWithGlanceServiceTest(test.TestCase):
"name": "queued snapshot",
"updated": self.NOW_API_FORMAT,
"created": self.NOW_API_FORMAT,
- "status": "QUEUED",
+ "status": "SAVING",
"progress": 0,
'server': {
'id': 42,
@@ -603,7 +603,7 @@ class ImageControllerWithGlanceServiceTest(test.TestCase):
'name': 'queued snapshot',
'updated': self.NOW_API_FORMAT,
'created': self.NOW_API_FORMAT,
- 'status': 'QUEUED',
+ 'status': 'SAVING',
'progress': 0,
},
{
@@ -627,7 +627,7 @@ class ImageControllerWithGlanceServiceTest(test.TestCase):
'name': 'killed snapshot',
'updated': self.NOW_API_FORMAT,
'created': self.NOW_API_FORMAT,
- 'status': 'FAILED',
+ 'status': 'ERROR',
'progress': 0,
},
{
@@ -676,7 +676,7 @@ class ImageControllerWithGlanceServiceTest(test.TestCase):
},
'updated': self.NOW_API_FORMAT,
'created': self.NOW_API_FORMAT,
- 'status': 'QUEUED',
+ 'status': 'SAVING',
'progress': 0,
'server': {
'id': 42,
@@ -769,7 +769,7 @@ class ImageControllerWithGlanceServiceTest(test.TestCase):
},
'updated': self.NOW_API_FORMAT,
'created': self.NOW_API_FORMAT,
- 'status': 'FAILED',
+ 'status': 'ERROR',
'progress': 0,
'server': {
'id': 42,