SF: Remove compat clone image code
SolidFire driver introduced a clone image feature in Kilo release[1] where we would create a cache volume with volume ID same as of image ID to create volume from image efficiently by cloning from that cached volume. This feature worked same as the image cache feature we have in cinder so it was deprecated in queens[2] and removed in train[3] in favor of image cache feature provided by cinder. However, we still kept compatibility code if users had solidfire cached volumes to still take advantage of those to create efficient volume from images. In the current master (Yoga), we can safely assume that people have moved to using the image cache feature of cinder since the solidfire options to enable efficient cloning doesn't exist since train release. This patch removes the remaining code around this feature as it doesn't provide any additional benefit and we also log an ERROR message unnecessarily confusing the operators for every create volume from image request (details are in the linked launchpad bug). Closes-Bug: #1959178 [1] https://review.opendev.org/c/openstack/cinder/+/142859 [2] https://review.opendev.org/c/openstack/cinder/+/511623 [3] https://review.opendev.org/c/openstack/cinder/+/664739 Change-Id: I8fe00b06ebb439f83f8cad0f592064c540c54b77
This commit is contained in:
parent
f6cb333c13
commit
6b97abc4e4
@ -15,7 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
from copy import deepcopy
|
||||
import datetime
|
||||
import re
|
||||
from unittest import mock
|
||||
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_snapshot
|
||||
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 utils as test_utils
|
||||
from cinder.volume import configuration as conf
|
||||
@ -85,8 +83,6 @@ class SolidFireVolumeTestCase(test.TestCase):
|
||||
self.configuration.sf_account_prefix = 'cinder'
|
||||
self.configuration.reserved_percentage = 25
|
||||
self.configuration.target_helper = None
|
||||
self.configuration.sf_template_account_name = 'openstack-vtemplate'
|
||||
self.configuration.sf_allow_template_caching = False
|
||||
self.configuration.sf_svip = None
|
||||
self.configuration.sf_volume_prefix = 'UUID-'
|
||||
self.configuration.sf_enable_vag = False
|
||||
@ -105,13 +101,6 @@ class SolidFireVolumeTestCase(test.TestCase):
|
||||
self.expected_qos_results = {'minIOPS': 1000,
|
||||
'maxIOPS': 10000,
|
||||
'burstIOPS': 20000}
|
||||
self.mock_stats_data =\
|
||||
{'result':
|
||||
{'clusterCapacity': {'maxProvisionedSpace': 107374182400,
|
||||
'usedSpace': 1073741824,
|
||||
'compressionPercent': 100,
|
||||
'deDuplicationPercent': 100,
|
||||
'thinProvisioningPercent': 100}}}
|
||||
vol_updates = {'project_id': 'testprjid',
|
||||
'name': 'testvol',
|
||||
'size': 1,
|
||||
@ -124,15 +113,6 @@ class SolidFireVolumeTestCase(test.TestCase):
|
||||
ctx = context.get_admin_context()
|
||||
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.ctxt, volume_id='b831c4d1-d1f0-11e1-9b23-0800200c9a66')
|
||||
self.snap = test_utils.create_snapshot(
|
||||
@ -1882,18 +1862,6 @@ class SolidFireVolumeTestCase(test.TestCase):
|
||||
self.assertEqual('UUID-a720b3c0-d1f0-11e1-9b23-0800200c9a66',
|
||||
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):
|
||||
sfv = solidfire.SolidFireDriver(configuration=self.configuration)
|
||||
|
||||
|
@ -1460,39 +1460,6 @@ class SolidFireDriver(san.SanISCSIDriver):
|
||||
for vag in sorted_targets[:limit]:
|
||||
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
|
||||
def _retrieve_qos_setting(self, volume, extended_size=0):
|
||||
qos = {}
|
||||
|
Loading…
Reference in New Issue
Block a user