From: Shyamsundar Ranganathan Date: Tue, 25 Aug 2020 22:46:12 +0000 (-0400) Subject: mgr/volumes: Disallow subvolume group level snapshots X-Git-Tag: v15.2.9~13^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5b5573fdc61f66db22afdffbf88435cdec0e3018;p=ceph.git mgr/volumes: Disallow subvolume group level snapshots Fixes: https://tracker.ceph.com/issues/47154 Signed-off-by: Shyamsundar Ranganathan (cherry picked from commit f97e57c28c7fa7685b853e9f7f7e23267739a6c0) --- diff --git a/doc/cephfs/fs-volumes.rst b/doc/cephfs/fs-volumes.rst index 16bba5e27b4a..dd38e38e419b 100644 --- a/doc/cephfs/fs-volumes.rst +++ b/doc/cephfs/fs-volumes.rst @@ -111,12 +111,8 @@ List subvolume groups using:: $ ceph fs subvolumegroup ls -Create a snapshot (see :doc:`/cephfs/experimental-features`) of a -subvolume group using:: - - $ ceph fs subvolumegroup snapshot create - -This implicitly snapshots all the subvolumes under the subvolume group. +.. note:: Subvolume group snapshot feature is no longer supported in mainline CephFS (existing group + snapshots can still be listed and deleted) Remove a snapshot of a subvolume group using:: diff --git a/qa/suites/fs/basic_functional/tasks/volumes.yaml b/qa/suites/fs/basic_functional/tasks/volumes.yaml index e94728f9ebf7..1315980eda2e 100644 --- a/qa/suites/fs/basic_functional/tasks/volumes.yaml +++ b/qa/suites/fs/basic_functional/tasks/volumes.yaml @@ -15,5 +15,6 @@ overrides: tasks: - cephfs_test_runner: + fail_on_skip: false modules: - tasks.cephfs.test_volumes diff --git a/qa/tasks/cephfs/test_volumes.py b/qa/tasks/cephfs/test_volumes.py index 96ba02eec1cc..24572b7550ff 100644 --- a/qa/tasks/cephfs/test_volumes.py +++ b/qa/tasks/cephfs/test_volumes.py @@ -6,6 +6,7 @@ import random import logging import collections import uuid +import unittest from hashlib import md5 from textwrap import dedent @@ -1689,6 +1690,25 @@ class TestVolumes(CephFSTestCase): # verify trash dir is clean self._wait_for_trash_empty() + def test_subvolume_group_snapshot_unsupported_status(self): + group = self._generate_random_group_name() + snapshot = self._generate_random_snapshot_name() + + # create group + self._fs_cmd("subvolumegroup", "create", self.volname, group) + + # snapshot group + try: + self._fs_cmd("subvolumegroup", "snapshot", "create", self.volname, group, snapshot) + except CommandFailedError as ce: + self.assertEqual(ce.exitstatus, errno.ENOSYS, "invalid error code on subvolumegroup snapshot create") + else: + self.fail("expected subvolumegroup snapshot create command to fail") + + # remove group + self._fs_cmd("subvolumegroup", "rm", self.volname, group) + + @unittest.skip("skipping subvolumegroup snapshot tests") def test_subvolume_group_snapshot_create_and_rm(self): subvolume = self._generate_random_subvolume_name() group = self._generate_random_group_name() @@ -1715,6 +1735,7 @@ class TestVolumes(CephFSTestCase): # remove group self._fs_cmd("subvolumegroup", "rm", self.volname, group) + @unittest.skip("skipping subvolumegroup snapshot tests") def test_subvolume_group_snapshot_idempotence(self): subvolume = self._generate_random_subvolume_name() group = self._generate_random_group_name() @@ -1744,6 +1765,7 @@ class TestVolumes(CephFSTestCase): # remove group self._fs_cmd("subvolumegroup", "rm", self.volname, group) + @unittest.skip("skipping subvolumegroup snapshot tests") def test_nonexistent_subvolume_group_snapshot_rm(self): subvolume = self._generate_random_subvolume_name() group = self._generate_random_group_name() @@ -1779,6 +1801,7 @@ class TestVolumes(CephFSTestCase): # remove group self._fs_cmd("subvolumegroup", "rm", self.volname, group) + @unittest.skip("skipping subvolumegroup snapshot tests") def test_subvolume_group_snapshot_rm_force(self): # test removing non-existing subvolume group snapshot with --force group = self._generate_random_group_name() @@ -1789,6 +1812,7 @@ class TestVolumes(CephFSTestCase): except CommandFailedError: raise RuntimeError("expected the 'fs subvolumegroup snapshot rm --force' command to succeed") + @unittest.skip("skipping subvolumegroup snapshot tests") def test_subvolume_group_snapshot_ls(self): # tests the 'fs subvolumegroup snapshot ls' command diff --git a/src/pybind/mgr/volumes/fs/volume.py b/src/pybind/mgr/volumes/fs/volume.py index 784589be70a3..7e20ca9a9546 100644 --- a/src/pybind/mgr/volumes/fs/volume.py +++ b/src/pybind/mgr/volumes/fs/volume.py @@ -566,15 +566,18 @@ class VolumeClient(object): ### group snapshot def create_subvolume_group_snapshot(self, **kwargs): - ret = 0, "", "" + ret = -errno.ENOSYS, "", "subvolume group snapshots are not supported" volname = kwargs['vol_name'] groupname = kwargs['group_name'] - snapname = kwargs['snap_name'] + # snapname = kwargs['snap_name'] try: with open_volume(self, volname) as fs_handle: with open_group(fs_handle, self.volspec, groupname) as group: - group.create_snapshot(snapname) + # as subvolumes are marked with the vxattr ceph.dir.subvolume deny snapshots + # at the subvolume group (see: https://tracker.ceph.com/issues/46074) + # group.create_snapshot(snapname) + pass except VolumeException as ve: ret = self.volume_exception_to_retval(ve) return ret