Use default provisioning type from config

ScaleIO allows to define provisioning type via volume types,
but default value is hardcoded. Cinder has appropriate option in config
and some customers want to have ability to set default volume
provisioning type via this config option for a whole cluster rather
than using volume types.

DocImpact
Change-Id: I2a2df4b2b4296972a46a15b9dca259f9256c1f0d
This commit is contained in:
alexey-mr 2016-06-24 13:35:57 +03:00
parent 0a2265d256
commit 8319ea4c49
4 changed files with 37 additions and 1 deletions
cinder
tests/unit/volume/drivers/emc/scaleio
volume/drivers/emc
releasenotes/notes

@ -44,6 +44,10 @@ class ScaleIODriver(scaleio.ScaleIODriver):
override='test_domain')
configuration.set_override('sio_storage_pools',
override='test_domain:test_pool')
if 'san_thin_provision' in kwargs:
configuration.set_override(
'san_thin_provision',
override=kwargs['san_thin_provision'])
super(ScaleIODriver, self).__init__(configuration=configuration,
*args,

@ -12,6 +12,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import ddt
import mock
from six.moves import urllib
@ -23,6 +25,7 @@ from cinder.tests.unit.volume.drivers.emc import scaleio
from cinder.tests.unit.volume.drivers.emc.scaleio import mocks
@ddt.ddt
class TestMisc(scaleio.TestScaleIODriver):
DOMAIN_NAME = 'PD1'
POOL_NAME = 'SP1'
@ -188,3 +191,20 @@ class TestMisc(scaleio.TestScaleIODriver):
self.volume,
self.new_volume['id']
)
def test_default_provisioning_type_unspecified(self):
empty_storage_type = {}
self.assertEqual(
'thin',
self.driver._find_provisioning_type(empty_storage_type))
@ddt.data((True, 'thin'), (False, 'thick'))
@ddt.unpack
def test_default_provisioning_type_thin(self, config_provisioning_type,
expected_provisioning_type):
self.driver = mocks.ScaleIODriver(
san_thin_provision=config_provisioning_type)
empty_storage_type = {}
self.assertEqual(
expected_provisioning_type,
self.driver._find_provisioning_type(empty_storage_type))

@ -153,6 +153,12 @@ class ScaleIODriver(driver.VolumeDriver):
"Protection domain id: %(domain_id)s."),
{'domain_id': self.protection_domain_id})
self.provisioning_type = (
'thin' if self.configuration.san_thin_provision else 'thick')
LOG.info(_LI(
"Default provisioning type: %(provisioning_type)s."),
{'provisioning_type': self.provisioning_type})
self.connector = connector.InitiatorConnector.factory(
connector.SCALEIO, utils.get_root_helper(),
device_scan_attempts=
@ -235,7 +241,8 @@ class ScaleIODriver(driver.VolumeDriver):
self.protection_domain_name)
def _find_provisioning_type(self, storage_type):
return storage_type.get(PROVISIONING_KEY)
return storage_type.get(PROVISIONING_KEY,
self.provisioning_type)
def _find_limit(self, storage_type, qos_key, extraspecs_key):
qos_limit = (storage_type.get(qos_key)

@ -0,0 +1,5 @@
---
upgrade:
- EMC ScaleIO driver now uses the config option
san_thin_provision to determine the default
provisioning type.