Merge "[Pure Storage] Disable management of secure tenant volumes and snaps"

This commit is contained in:
Zuul
2025-09-04 21:33:32 +00:00
committed by Gerrit Code Review
2 changed files with 34 additions and 0 deletions

View File

@@ -1676,6 +1676,10 @@ class PureBaseVolumeDriver(san.SanDriver):
" key to identify an existing volume."))
if is_snap:
if existing_ref['source-name'].count("::") > 1:
# Don't allow for managing snaphot in a realm
raise exception.ManageExistingInvalidReference(
_("Unable to manage snapshot in a Realm"))
# Purity snapshot names are prefixed with the source volume name.
ref_vol_name, ref_snap_suffix = existing_ref['source-name'].split(
'.')
@@ -1683,6 +1687,10 @@ class PureBaseVolumeDriver(san.SanDriver):
ref_vol_name = existing_ref['source-name']
current_array = self._get_current_array()
if not is_snap and self._realm_check(current_array, ref_vol_name):
# Don't allow for managing volumes in a realm
raise exception.ManageExistingInvalidReference(
_("Unable to manage volume in a Realm"))
if not is_snap and self._pod_check(current_array, ref_vol_name):
# Don't allow for managing volumes in a replicated pod
raise exception.ManageExistingInvalidReference(
@@ -1992,6 +2000,9 @@ class PureBaseVolumeDriver(san.SanDriver):
def _pod_check(self, array, volume):
"""Check if volume is in a replicated pod."""
if "::" in volume:
if volume.count("::") != 1:
# This is a special for a volume in a realm pod
return False
pod = volume.split("::")[0]
pod_info = list(array.get_pods(names=[pod]).items)[0]
if (pod_info.link_source_count == 0
@@ -2003,6 +2014,16 @@ class PureBaseVolumeDriver(san.SanDriver):
else:
return False
def _realm_check(self, array, volume):
"""Check if volume is in a realm."""
if "::" in volume:
if volume.count("::") > 1:
return True
else:
return False
else:
return False
def _rename_volume_object(self,
old_name,
new_name,
@@ -2184,6 +2205,7 @@ class PureBaseVolumeDriver(san.SanDriver):
cinder_id = existing_vols.get(vol_name)
not_safe_msgs = []
host = connected_vols.get(vol_name)
in_realm = self._realm_check(array, vol_name)
in_pod = self._pod_check(array, vol_name)
is_deleted = pure_vols[pure_vol].destroyed
@@ -2193,6 +2215,9 @@ class PureBaseVolumeDriver(san.SanDriver):
if cinder_id:
not_safe_msgs.append(_('Volume already managed'))
if in_realm:
not_safe_msgs.append(_('Volume is in a Realm'))
if in_pod:
not_safe_msgs.append(_('Volume is in a Replicated Pod'))
@@ -2248,6 +2273,10 @@ class PureBaseVolumeDriver(san.SanDriver):
is_safe = False
reason_not_safe = _("Snapshot is deleted.")
if snap_name.count("::") > 1:
is_safe = False
reason_not_safe = _("Snapshot is in a realm.")
manageable_snaps.append({
'reference': {'name': snap_name},
'size': self._round_bytes_to_gib(

View File

@@ -0,0 +1,5 @@
---
fixes:
- |
Pure Storage driver: Fixed issue with FlashArray secure tenant volumes and
snapshots as theese are not eligible to be managed.