ScaleIO: Disable volume creation without padding

Applying previous fix for thick volumes to thin volumes to disallow
volume creation without zero padding unless enabled via config option.

Change-Id: Ibaf6e9b67d252a5aae1b0f64ec632ec26789c389
Closes-Bug: #1784871
Signed-off-by: Matan Sabag <matan.sabag@emc.com>
(cherry picked from commit 949cc46e16)
This commit is contained in:
Matan Sabag 2018-08-15 13:01:36 +03:00 committed by Sean McGinnis
parent 17f2695120
commit 3a39d09166
3 changed files with 26 additions and 7 deletions

View File

@ -40,6 +40,9 @@ class ScaleIODriver(driver.ScaleIODriver):
def unmanage(self, volume):
pass
def _is_volume_creation_safe(self, _pd, _sp, _pt):
return True
class MockHTTPSResponse(requests.Response):
"""Mock HTTP Response

View File

@ -113,6 +113,12 @@ scaleio_opts = [
'when zero padding is disabled. This option should '
'not be enabled if multiple tenants will utilize '
'thick volumes from a shared Storage Pool.'),
cfg.BoolOpt('sio_allow_non_padded_volumes',
default=False,
help='Allow volumes to be created in Storage Pools '
'when zero padding is disabled. This option should '
'not be enabled if multiple tenants will utilize '
'volumes from a shared Storage Pool.'),
]
CONF.register_opts(scaleio_opts, group=configuration.SHARED_CONF_GROUP)
@ -496,17 +502,19 @@ class ScaleIODriver(driver.VolumeDriver):
protection_domain,
storage_pool,
provision_type):
"""Checks if volume creation is safe or not
"""Checks if volume creation is safe or not.
using thick volumes with zero padding disabled can lead
to existing data being read off of a newly created volume
Using volumes with zero padding disabled can lead to existing data
being read off of a newly created volume.
"""
# if we have been told to allow unsafe volumes
if self.configuration.sio_allow_non_padded_thick_volumes:
if self.configuration.sio_allow_non_padded_volumes:
# Enabled regardless of type, so safe to proceed
return True
# all thin volumes are safe
if provision_type == 'ThinProvisioned':
if (provision_type == 'ThickProvisioned' and
self.configuration.sio_allow_non_padded_thick_volumes):
# Enabled for thick volumes
return True
try:
@ -613,7 +621,8 @@ class ScaleIODriver(driver.VolumeDriver):
"zero padding being disabled for pool, %s:%s. "
"This behaviour can be changed by setting "
"the configuration option "
"sio_allow_non_padded_thick_volumes = True.",
"sio_allow_non_padded_thick_volumes = True or"
"sio_allow_non_padded_volumes = True.",
protection_domain_name,
storage_pool_name)
msg = _("Volume creation rejected due to "

View File

@ -0,0 +1,7 @@
security:
- |
Removed the ability to create volumes in a ScaleIO Storage Pool
that has zero-padding disabled.
A new configuration option had been added to override this new
behavior and allow volume creation, but should not be enabled if
multiple tenants will utilize volumes from a shared Storage Pool.