diff options
author | Milind Changire <mchangir@redhat.com> | 2023-12-07 09:31:42 +0100 |
---|---|---|
committer | Milind Changire <mchangir@redhat.com> | 2024-01-06 04:28:36 +0100 |
commit | 0c5804ab4e5eb284d127044c5e51fbc870f5727a (patch) | |
tree | 0e0cc68395384979d1c4a32981ceb1cda551dac2 /src/pybind | |
parent | mgr/volumes: ensure correct init of v1 subvol (diff) | |
download | ceph-0c5804ab4e5eb284d127044c5e51fbc870f5727a.tar.xz ceph-0c5804ab4e5eb284d127044c5e51fbc870f5727a.zip |
mgr/volumes: conditionalize subvolume upgrade
Signed-off-by: Milind Changire <mchangir@redhat.com>
Diffstat (limited to 'src/pybind')
-rw-r--r-- | src/pybind/mgr/volumes/fs/operations/versions/__init__.py | 15 | ||||
-rw-r--r-- | src/pybind/mgr/volumes/fs/operations/versions/metadata_manager.py | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/pybind/mgr/volumes/fs/operations/versions/__init__.py b/src/pybind/mgr/volumes/fs/operations/versions/__init__.py index 6c96c457019..097620d7378 100644 --- a/src/pybind/mgr/volumes/fs/operations/versions/__init__.py +++ b/src/pybind/mgr/volumes/fs/operations/versions/__init__.py @@ -49,6 +49,18 @@ class SubvolumeLoader(object): def get_subvolume_object_max(self, mgr, fs, vol_spec, group, subvolname): return self._get_subvolume_version(self.max_version)(mgr, fs, vol_spec, group, subvolname) + def allow_subvolume_upgrade(self, subvolume): + asu = True + try: + opt = subvolume.metadata_mgr.get_global_option(MetadataManager.GLOBAL_META_KEY_ALLOW_SUBVOLUME_UPGRADE) + asu = False if opt == "0" else True + except MetadataMgrException: + # this key is injected for QA testing and will not be available in + # production + pass + + return asu + def upgrade_to_v2_subvolume(self, subvolume): # legacy mode subvolumes cannot be upgraded to v2 if subvolume.legacy_mode: @@ -58,6 +70,9 @@ class SubvolumeLoader(object): if version >= SubvolumeV2.version(): return + if not self.allow_subvolume_upgrade(subvolume): + return + v1_subvolume = self._get_subvolume_version(version)(subvolume.mgr, subvolume.fs, subvolume.vol_spec, subvolume.group, subvolume.subvolname) try: v1_subvolume.open(SubvolumeOpType.SNAP_LIST) diff --git a/src/pybind/mgr/volumes/fs/operations/versions/metadata_manager.py b/src/pybind/mgr/volumes/fs/operations/versions/metadata_manager.py index b33a2b48b77..610a61e6a4c 100644 --- a/src/pybind/mgr/volumes/fs/operations/versions/metadata_manager.py +++ b/src/pybind/mgr/volumes/fs/operations/versions/metadata_manager.py @@ -58,6 +58,7 @@ class MetadataManager(object): GLOBAL_META_KEY_TYPE = "type" GLOBAL_META_KEY_PATH = "path" GLOBAL_META_KEY_STATE = "state" + GLOBAL_META_KEY_ALLOW_SUBVOLUME_UPGRADE = "allow_subvolume_upgrade" CLONE_FAILURE_SECTION = "CLONE_FAILURE" CLONE_FAILURE_META_KEY_ERRNO = "errno" |