Merge "Remove os-image-create API extension"
This commit is contained in:
commit
31a885c046
@ -1,28 +0,0 @@
|
||||
# Copyright (c) 2012 NTT.
|
||||
# Copyright (c) 2012 OpenStack Foundation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""The Create Volume from Image extension."""
|
||||
|
||||
|
||||
from cinder.api import extensions
|
||||
|
||||
|
||||
class Image_create(extensions.ExtensionDescriptor):
|
||||
"""Allow creating a volume from an image in the Create Volume v1 API."""
|
||||
|
||||
name = "CreateVolumeExtension"
|
||||
alias = "os-image-create"
|
||||
updated = "2012-08-13T00:00:00+00:00"
|
@ -246,7 +246,6 @@ class VolumeController(wsgi.Controller):
|
||||
|
||||
LOG.info("Create volume of %s GB", size)
|
||||
|
||||
if self.ext_mgr.is_loaded('os-image-create'):
|
||||
image_ref = volume.get('imageRef')
|
||||
if image_ref is not None:
|
||||
image_uuid = self._image_uuid_from_ref(image_ref, context)
|
||||
|
@ -309,7 +309,6 @@ class VolumeController(volumes_v2.VolumeController):
|
||||
# Not found exception will be handled at the wsgi level
|
||||
kwargs['group'] = self.group_api.get(context, group_id)
|
||||
|
||||
if self.ext_mgr.is_loaded('os-image-create'):
|
||||
image_ref = volume.get('imageRef')
|
||||
if image_ref is not None:
|
||||
image_uuid = self._image_uuid_from_ref(image_ref, context)
|
||||
|
@ -392,7 +392,6 @@ class VolumeApiTest(test.TestCase):
|
||||
self.mock_object(db.sqlalchemy.api, '_volume_type_get_full',
|
||||
v2_fakes.fake_volume_type_get)
|
||||
|
||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||
vol = self._vol_in_request_body(
|
||||
availability_zone="nova",
|
||||
image_ref="c905cedb-7281-47e4-8a62-f26bc5fc4c77")
|
||||
@ -405,7 +404,6 @@ class VolumeApiTest(test.TestCase):
|
||||
|
||||
def test_volume_create_with_image_ref_is_integer(self):
|
||||
self.mock_object(volume_api.API, "create", v2_fakes.fake_volume_create)
|
||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||
vol = self._vol_in_request_body(availability_zone="cinder",
|
||||
image_ref=1234)
|
||||
body = {"volume": vol}
|
||||
@ -420,7 +418,6 @@ class VolumeApiTest(test.TestCase):
|
||||
self.mock_object(fake_image._FakeImageService,
|
||||
"detail",
|
||||
v2_fakes.fake_image_service_detail)
|
||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||
vol = self._vol_in_request_body(availability_zone="cinder",
|
||||
image_ref="12345")
|
||||
body = {"volume": vol}
|
||||
@ -435,7 +432,6 @@ class VolumeApiTest(test.TestCase):
|
||||
self.mock_object(fake_image._FakeImageService,
|
||||
"detail",
|
||||
v2_fakes.fake_image_service_detail)
|
||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||
vol = self._vol_in_request_body(availability_zone="cinder",
|
||||
image_ref="")
|
||||
body = {"volume": vol}
|
||||
@ -453,7 +449,6 @@ class VolumeApiTest(test.TestCase):
|
||||
self.mock_object(db.sqlalchemy.api, '_volume_type_get_full',
|
||||
v2_fakes.fake_volume_type_get)
|
||||
|
||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||
vol = self._vol_in_request_body(
|
||||
availability_zone="nova",
|
||||
image_id="c905cedb-7281-47e4-8a62-f26bc5fc4c77")
|
||||
@ -466,7 +461,6 @@ class VolumeApiTest(test.TestCase):
|
||||
|
||||
def test_volume_create_with_image_id_is_integer(self):
|
||||
self.mock_object(volume_api.API, "create", v2_fakes.fake_volume_create)
|
||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||
vol = self._vol_in_request_body(availability_zone="cinder",
|
||||
image_id=1234)
|
||||
body = {"volume": vol}
|
||||
@ -481,7 +475,6 @@ class VolumeApiTest(test.TestCase):
|
||||
self.mock_object(fake_image._FakeImageService,
|
||||
"detail",
|
||||
v2_fakes.fake_image_service_detail)
|
||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||
vol = self._vol_in_request_body(availability_zone="cinder",
|
||||
image_id="12345")
|
||||
body = {"volume": vol}
|
||||
@ -496,7 +489,6 @@ class VolumeApiTest(test.TestCase):
|
||||
self.mock_object(fake_image._FakeImageService,
|
||||
"detail",
|
||||
v2_fakes.fake_image_service_detail)
|
||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||
vol = self._vol_in_request_body(availability_zone="cinder",
|
||||
image_id="")
|
||||
body = {"volume": vol}
|
||||
@ -518,7 +510,6 @@ class VolumeApiTest(test.TestCase):
|
||||
v2_fakes.fake_image_service_detail)
|
||||
|
||||
test_id = "Fedora-x86_64-20-20140618-sda"
|
||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||
vol = self._vol_in_request_body(availability_zone="nova",
|
||||
image_ref=test_id)
|
||||
ex = self._expected_vol_from_controller(availability_zone="nova")
|
||||
@ -535,7 +526,6 @@ class VolumeApiTest(test.TestCase):
|
||||
v2_fakes.fake_image_service_detail)
|
||||
|
||||
test_id = "multi"
|
||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||
vol = self._vol_in_request_body(availability_zone="nova",
|
||||
image_ref=test_id)
|
||||
body = {"volume": vol}
|
||||
@ -553,7 +543,6 @@ class VolumeApiTest(test.TestCase):
|
||||
v2_fakes.fake_image_service_detail)
|
||||
|
||||
test_id = "MissingName"
|
||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||
vol = self._vol_in_request_body(availability_zone="nova",
|
||||
image_ref=test_id)
|
||||
body = {"volume": vol}
|
||||
|
@ -277,7 +277,6 @@ class VolumeApiTest(test.TestCase):
|
||||
get_snapshot.side_effect = v2_fakes.fake_snapshot_get
|
||||
volume_type_get.side_effect = v2_fakes.fake_volume_type_get
|
||||
|
||||
self.ext_mgr.extensions = {'os-image-create': 'fake'}
|
||||
vol = self._vol_in_request_body(
|
||||
image_id="b0a599e0-41d7-3582-b260-769f443c862a")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user