From 09d137cc640aafb2784101915819649642d330bf Mon Sep 17 00:00:00 2001 From: Shyamsundar Ranganathan Date: Tue, 25 Aug 2020 18:46:12 -0400 Subject: [PATCH] mgr/volumes: Disallow subvolume group level snapshots Fixes: https://tracker.ceph.com/issues/47154 Signed-off-by: Shyamsundar Ranganathan (cherry picked from commit f97e57c28c7fa7685b853e9f7f7e23267739a6c0) --- doc/cephfs/fs-volumes.rst | 8 ++----- .../fs/basic_functional/tasks/volumes.yaml | 1 + qa/tasks/cephfs/test_volumes.py | 24 +++++++++++++++++++ src/pybind/mgr/volumes/fs/volume.py | 9 ++++--- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/doc/cephfs/fs-volumes.rst b/doc/cephfs/fs-volumes.rst index 1874ac98e8459..875efa060550f 100644 --- a/doc/cephfs/fs-volumes.rst +++ b/doc/cephfs/fs-volumes.rst @@ -91,12 +91,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 e94728f9ebf7d..1315980eda2eb 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 8710748508447..93d8930e16afe 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 @@ -1623,6 +1624,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() @@ -1649,6 +1669,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() @@ -1678,6 +1699,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() @@ -1713,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_rm_force(self): # test removing non-existing subvolume group snapshot with --force group = self._generate_random_group_name() @@ -1723,6 +1746,7 @@ class TestVolumes(CephFSTestCase): except CommandFailedError as ce: 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 4c314119e0dc7..2477c83232529 100644 --- a/src/pybind/mgr/volumes/fs/volume.py +++ b/src/pybind/mgr/volumes/fs/volume.py @@ -535,15 +535,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 -- 2.39.5