Merge "SF: Remove compat clone image code"
This commit is contained in:
commit
db95ad2772
@ -15,7 +15,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import datetime
|
|
||||||
import re
|
import re
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from unittest.mock import call
|
from unittest.mock import call
|
||||||
@ -37,7 +36,6 @@ from cinder.tests.unit.api import fakes
|
|||||||
from cinder.tests.unit import fake_group_snapshot
|
from cinder.tests.unit import fake_group_snapshot
|
||||||
from cinder.tests.unit import fake_snapshot
|
from cinder.tests.unit import fake_snapshot
|
||||||
from cinder.tests.unit import fake_volume
|
from cinder.tests.unit import fake_volume
|
||||||
from cinder.tests.unit.image import fake as fake_image
|
|
||||||
from cinder.tests.unit import test
|
from cinder.tests.unit import test
|
||||||
from cinder.tests.unit import utils as test_utils
|
from cinder.tests.unit import utils as test_utils
|
||||||
from cinder.volume import configuration as conf
|
from cinder.volume import configuration as conf
|
||||||
@ -103,13 +101,6 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
self.expected_qos_results = {'minIOPS': 1000,
|
self.expected_qos_results = {'minIOPS': 1000,
|
||||||
'maxIOPS': 10000,
|
'maxIOPS': 10000,
|
||||||
'burstIOPS': 20000}
|
'burstIOPS': 20000}
|
||||||
self.mock_stats_data =\
|
|
||||||
{'result':
|
|
||||||
{'clusterCapacity': {'maxProvisionedSpace': 107374182400,
|
|
||||||
'usedSpace': 1073741824,
|
|
||||||
'compressionPercent': 100,
|
|
||||||
'deDuplicationPercent': 100,
|
|
||||||
'thinProvisioningPercent': 100}}}
|
|
||||||
vol_updates = {'project_id': 'testprjid',
|
vol_updates = {'project_id': 'testprjid',
|
||||||
'name': 'testvol',
|
'name': 'testvol',
|
||||||
'size': 1,
|
'size': 1,
|
||||||
@ -122,15 +113,6 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
ctx = context.get_admin_context()
|
ctx = context.get_admin_context()
|
||||||
self.mock_volume = fake_volume.fake_volume_obj(ctx, **vol_updates)
|
self.mock_volume = fake_volume.fake_volume_obj(ctx, **vol_updates)
|
||||||
|
|
||||||
self.fake_image_meta = {'id': '17c550bb-a411-44c0-9aaf-0d96dd47f501',
|
|
||||||
'updated_at': datetime.datetime(2013, 9,
|
|
||||||
28, 15,
|
|
||||||
27, 36,
|
|
||||||
325355),
|
|
||||||
'is_public': True,
|
|
||||||
'owner': 'testprjid'}
|
|
||||||
self.fake_image_service = fake_image.FakeImageService()
|
|
||||||
|
|
||||||
self.vol = test_utils.create_volume(
|
self.vol = test_utils.create_volume(
|
||||||
self.ctxt, volume_id='b831c4d1-d1f0-11e1-9b23-0800200c9a66')
|
self.ctxt, volume_id='b831c4d1-d1f0-11e1-9b23-0800200c9a66')
|
||||||
self.snap = test_utils.create_snapshot(
|
self.snap = test_utils.create_snapshot(
|
||||||
@ -1851,18 +1833,6 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
self.assertEqual('UUID-a720b3c0-d1f0-11e1-9b23-0800200c9a66',
|
self.assertEqual('UUID-a720b3c0-d1f0-11e1-9b23-0800200c9a66',
|
||||||
sf_vol_object['name'])
|
sf_vol_object['name'])
|
||||||
|
|
||||||
@mock.patch.object(solidfire.SolidFireDriver, '_issue_api_request')
|
|
||||||
def test_clone_image_not_configured(self, _mock_issue_api_request):
|
|
||||||
_mock_issue_api_request.side_effect = self.fake_issue_api_request
|
|
||||||
|
|
||||||
sfv = solidfire.SolidFireDriver(configuration=self.configuration)
|
|
||||||
self.assertEqual((None, False),
|
|
||||||
sfv.clone_image(self.ctxt,
|
|
||||||
self.mock_volume,
|
|
||||||
'fake',
|
|
||||||
self.fake_image_meta,
|
|
||||||
'fake'))
|
|
||||||
|
|
||||||
def test_init_volume_mappings(self):
|
def test_init_volume_mappings(self):
|
||||||
sfv = solidfire.SolidFireDriver(configuration=self.configuration)
|
sfv = solidfire.SolidFireDriver(configuration=self.configuration)
|
||||||
|
|
||||||
|
@ -1409,39 +1409,6 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
for vag in sorted_targets[:limit]:
|
for vag in sorted_targets[:limit]:
|
||||||
self._remove_vag(vag['volumeAccessGroupID'])
|
self._remove_vag(vag['volumeAccessGroupID'])
|
||||||
|
|
||||||
@locked_image_id_operation
|
|
||||||
def clone_image(self, context,
|
|
||||||
volume, image_location,
|
|
||||||
image_meta, image_service):
|
|
||||||
"""Clone an existing image volume."""
|
|
||||||
public = False
|
|
||||||
# NOTE(jdg): Glance V2 moved from is_public to visibility
|
|
||||||
# so we check both, as we don't necessarily know or want
|
|
||||||
# to care which we're using. Will need to look at
|
|
||||||
# future handling of things like shared and community
|
|
||||||
# but for now, it's owner or public and that's it
|
|
||||||
visibility = image_meta.get('visibility', None)
|
|
||||||
if visibility and visibility == 'public':
|
|
||||||
public = True
|
|
||||||
elif image_meta.get('is_public', False):
|
|
||||||
public = True
|
|
||||||
else:
|
|
||||||
if image_meta['owner'] == volume['project_id']:
|
|
||||||
public = True
|
|
||||||
if not public:
|
|
||||||
LOG.warning("Requested image is not "
|
|
||||||
"accessible by current Tenant.")
|
|
||||||
return None, False
|
|
||||||
# If we don't have the image-volume to clone from return failure
|
|
||||||
# cinder driver will then create source for clone first
|
|
||||||
try:
|
|
||||||
(data, sfaccount, model) = self._do_clone_volume(image_meta['id'],
|
|
||||||
volume)
|
|
||||||
except exception.VolumeNotFound:
|
|
||||||
return None, False
|
|
||||||
|
|
||||||
return model, True
|
|
||||||
|
|
||||||
# extended_size > 0 when we are extending a volume
|
# extended_size > 0 when we are extending a volume
|
||||||
def _retrieve_qos_setting(self, volume, extended_size=0):
|
def _retrieve_qos_setting(self, volume, extended_size=0):
|
||||||
qos = {}
|
qos = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user