diff options
| author | Brian Waldon <brian.waldon@rackspace.com> | 2011-09-12 17:52:29 -0400 |
|---|---|---|
| committer | Brian Waldon <brian.waldon@rackspace.com> | 2011-09-12 17:52:29 -0400 |
| commit | 07eb6b50c8b7ba30a5923976b66108f136f8628e (patch) | |
| tree | 70654c9f35355382de581d982aae421fcc9c97fa | |
| parent | 4a1db744cc812c29ebaac3180bf32fc033029513 (diff) | |
| parent | 9f39ff070b5500a0ccb9a6454995f97342254381 (diff) | |
| download | nova-07eb6b50c8b7ba30a5923976b66108f136f8628e.tar.gz nova-07eb6b50c8b7ba30a5923976b66108f136f8628e.tar.xz nova-07eb6b50c8b7ba30a5923976b66108f136f8628e.zip | |
merging trunk; resolving conflicts
| -rw-r--r-- | nova/api/openstack/views/images.py | 15 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 2 | ||||
| -rw-r--r-- | nova/tests/api/openstack/fakes.py | 3 | ||||
| -rw-r--r-- | nova/tests/api/openstack/test_images.py | 130 | ||||
| -rw-r--r-- | nova/virt/disk.py | 1 |
5 files changed, 131 insertions, 20 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/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 40e2ca167..e5a661c7f 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -672,7 +672,7 @@ def floating_ip_update(context, address, values): def fixed_ip_associate(context, address, instance_id, network_id=None, reserved=False): """Keyword arguments: - reserved -- should be a boolean value(True or False), exact value will be + reserved -- should be a boolean value(True or False), exact value will be used to filter on the fixed ip address """ session = get_session() diff --git a/nova/tests/api/openstack/fakes.py b/nova/tests/api/openstack/fakes.py index 80a592479..3a567f0cc 100644 --- a/nova/tests/api/openstack/fakes.py +++ b/nova/tests/api/openstack/fakes.py @@ -197,7 +197,8 @@ def _make_image_fixtures(): # Snapshot for User 1 server_ref = 'http://localhost/v1.1/servers/42' snapshot_properties = {'instance_ref': server_ref, 'user_id': 'fake'} - for status in ('queued', 'saving', 'active', 'killed'): + for status in ('queued', 'saving', 'active', 'killed', + 'deleted', 'pending_delete'): add_fixture(id=image_id, name='%s snapshot' % status, is_public=False, status=status, properties=snapshot_properties) diff --git a/nova/tests/api/openstack/test_images.py b/nova/tests/api/openstack/test_images.py index 298b7d831..7759b52ef 100644 --- a/nova/tests/api/openstack/test_images.py +++ b/nova/tests/api/openstack/test_images.py @@ -78,7 +78,9 @@ class ImagesTest(test.TestCase): {'id': '125', 'name': 'saving snapshot'}, {'id': '126', 'name': 'active snapshot'}, {'id': '127', 'name': 'killed snapshot'}, - {'id': '128', 'name': None}] + {'id': '128', 'name': 'deleted snapshot'}, + {'id': '129', 'name': 'pending_delete snapshot'}, + {'id': '130', 'name': None}] self.assertDictListMatch(response_list, expected) @@ -122,7 +124,7 @@ class ImagesTest(test.TestCase): "name": "queued snapshot", "updated": NOW_API_FORMAT, "created": NOW_API_FORMAT, - "status": "QUEUED", + "status": "SAVING", "progress": 0, 'server': { 'id': 42, @@ -174,7 +176,7 @@ class ImagesTest(test.TestCase): self.assertEqual(expected_image.toxml(), actual_image.toxml()) def test_get_image_xml_no_name(self): - request = webob.Request.blank('/v1.0/images/128') + request = webob.Request.blank('/v1.0/images/130') request.accept = "application/xml" app = fakes.wsgi_app(fake_auth_context=self._get_fake_context()) response = request.get_response(app) @@ -183,7 +185,7 @@ class ImagesTest(test.TestCase): expected_now = NOW_API_FORMAT expected_image = minidom.parseString(""" - <image id="128" + <image id="130" name="None" updated="%(expected_now)s" created="%(expected_now)s" @@ -347,7 +349,7 @@ class ImagesTest(test.TestCase): }, { "id": "128", - "name": None, + "name": "deleted snapshot", "links": [ { "rel": "self", @@ -359,6 +361,34 @@ class ImagesTest(test.TestCase): }, ], }, + { + "id": "129", + "name": "pending_delete snapshot", + "links": [ + { + "rel": "self", + "href": "http://localhost/v1.1/fake/images/129", + }, + { + "rel": "bookmark", + "href": "http://localhost/fake/images/129", + }, + ], + }, + { + "id": "130", + "name": None, + "links": [ + { + "rel": "self", + "href": "http://localhost/v1.1/fake/images/130", + }, + { + "rel": "bookmark", + "href": "http://localhost/fake/images/130", + }, + ], + }, ] self.assertDictListMatch(response_list, expected) @@ -384,7 +414,7 @@ class ImagesTest(test.TestCase): 'name': 'queued snapshot', 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, - 'status': 'QUEUED', + 'status': 'SAVING', 'progress': 0, }, { @@ -408,11 +438,27 @@ class ImagesTest(test.TestCase): 'name': 'killed snapshot', 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, - 'status': 'FAILED', + 'status': 'ERROR', 'progress': 0, }, { 'id': '128', + 'name': 'deleted snapshot', + 'updated': NOW_API_FORMAT, + 'created': NOW_API_FORMAT, + 'status': 'DELETED', + 'progress': 0, + }, + { + 'id': '129', + 'name': 'pending_delete snapshot', + 'updated': NOW_API_FORMAT, + 'created': NOW_API_FORMAT, + 'status': 'DELETED', + 'progress': 0, + }, + { + 'id': '130', 'name': None, 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, @@ -458,7 +504,7 @@ class ImagesTest(test.TestCase): }, 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, - 'status': 'QUEUED', + 'status': 'SAVING', 'progress': 0, 'server': { 'id': 42, @@ -551,7 +597,7 @@ class ImagesTest(test.TestCase): }, 'updated': NOW_API_FORMAT, 'created': NOW_API_FORMAT, - 'status': 'FAILED', + 'status': 'ERROR', 'progress': 0, 'server': { 'id': 42, @@ -575,6 +621,68 @@ class ImagesTest(test.TestCase): }, { 'id': '128', + 'name': 'deleted snapshot', + 'metadata': { + u'instance_ref': u'http://localhost/v1.1/servers/42', + u'user_id': u'fake', + }, + 'updated': NOW_API_FORMAT, + 'created': NOW_API_FORMAT, + 'status': 'DELETED', + 'progress': 0, + 'server': { + 'id': 42, + "links": [{ + "rel": "self", + "href": server_href, + }, + { + "rel": "bookmark", + "href": server_bookmark, + }], + }, + "links": [{ + "rel": "self", + "href": "http://localhost/v1.1/fake/images/128", + }, + { + "rel": "bookmark", + "href": "http://localhost/fake/images/128", + }], + }, + { + 'id': '129', + 'name': 'pending_delete snapshot', + 'metadata': { + u'instance_ref': u'http://localhost/v1.1/servers/42', + u'user_id': u'fake', + }, + 'updated': NOW_API_FORMAT, + 'created': NOW_API_FORMAT, + 'status': 'DELETED', + 'progress': 0, + 'server': { + 'id': 42, + "links": [{ + "rel": "self", + "href": server_href, + }, + { + "rel": "bookmark", + "href": server_bookmark, + }], + }, + "links": [{ + "rel": "self", + "href": "http://localhost/v1.1/fake/images/129", + }, + { + "rel": "bookmark", + "href": "http://localhost/fake/images/129", + }], + }, + { + 'id': '130', 'name': None, 'metadata': {}, 'updated': NOW_API_FORMAT, @@ -583,11 +691,11 @@ class ImagesTest(test.TestCase): 'progress': 100, "links": [{ "rel": "self", - "href": "http://localhost/v1.1/fake/images/128", + "href": "http://localhost/v1.1/fake/images/130", }, { "rel": "bookmark", - "href": "http://localhost/fake/images/128", + "href": "http://localhost/fake/images/130", }], }, ] diff --git a/nova/virt/disk.py b/nova/virt/disk.py index d0745c82d..cd3422829 100644 --- a/nova/virt/disk.py +++ b/nova/virt/disk.py @@ -160,6 +160,7 @@ def destroy_container(target, instance, nbd=False): except Exception, exn: LOG.exception(_('Failed to remove container: %s'), exn) + def _link_device(image, nbd): """Link image to device using loopback or nbd""" |
