]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/rbd: rename GroupSnapshotNamespace to GroupImageSnapshotNamespace
authorMykola Golub <mgolub@suse.com>
Wed, 23 Jun 2021 16:56:20 +0000 (17:56 +0100)
committerPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Thu, 24 Apr 2025 15:56:21 +0000 (21:26 +0530)
Signed-off-by: Mykola Golub <mgolub@suse.com>
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
src/cls/rbd/cls_rbd_types.cc
src/cls/rbd/cls_rbd_types.h
src/librbd/api/Group.cc
src/librbd/api/Snapshot.cc

index 1fdfbd0f63e0c370d7820b9ec758b0324befae8d..5d8edb509ef9982e67c07264faf5026519b47ac8 100644 (file)
@@ -708,21 +708,26 @@ void GroupSpec::generate_test_instances(std::list<GroupSpec *> &o) {
   o.push_back(new GroupSpec("1018643c9869", 3));
 }
 
-void GroupSnapshotNamespace::encode(bufferlist& bl) const {
+std::ostream& operator<<(std::ostream& os, const GroupSpec& gs) {
+  os << "{pool_id=" << gs.pool_id << ", group_id=" << gs.group_id << "}";
+  return os;
+}
+
+void GroupImageSnapshotNamespace::encode(bufferlist& bl) const {
   using ceph::encode;
   encode(group_pool, bl);
   encode(group_id, bl);
   encode(group_snapshot_id, bl);
 }
 
-void GroupSnapshotNamespace::decode(bufferlist::const_iterator& it) {
+void GroupImageSnapshotNamespace::decode(bufferlist::const_iterator& it) {
   using ceph::decode;
   decode(group_pool, it);
   decode(group_id, it);
   decode(group_snapshot_id, it);
 }
 
-void GroupSnapshotNamespace::dump(Formatter *f) const {
+void GroupImageSnapshotNamespace::dump(Formatter *f) const {
   f->dump_int("group_pool", group_pool);
   f->dump_string("group_id", group_id);
   f->dump_string("group_snapshot_id", group_snapshot_id);
@@ -885,7 +890,7 @@ void SnapshotInfo::generate_test_instances(std::list<SnapshotInfo*> &o) {
   o.push_back(new SnapshotInfo(1ULL, UserSnapshotNamespace{}, "snap1", 123,
                                {123456, 0}, 12));
   o.push_back(new SnapshotInfo(2ULL,
-                               GroupSnapshotNamespace{567, "group1", "snap1"},
+                               GroupImageSnapshotNamespace{567, "group1", "snap1"},
                                "snap1", 123, {123456, 0}, 987));
   o.push_back(new SnapshotInfo(3ULL,
                                TrashSnapshotNamespace{
@@ -917,7 +922,7 @@ void SnapshotNamespace::decode(bufferlist::const_iterator &p)
       *this = UserSnapshotNamespace();
       break;
     case cls::rbd::SNAPSHOT_NAMESPACE_TYPE_GROUP:
-      *this = GroupSnapshotNamespace();
+      *this = GroupImageSnapshotNamespace();
       break;
     case cls::rbd::SNAPSHOT_NAMESPACE_TYPE_TRASH:
       *this = TrashSnapshotNamespace();
@@ -939,10 +944,10 @@ void SnapshotNamespace::dump(Formatter *f) const {
 
 void SnapshotNamespace::generate_test_instances(std::list<SnapshotNamespace*> &o) {
   o.push_back(new SnapshotNamespace(UserSnapshotNamespace()));
-  o.push_back(new SnapshotNamespace(GroupSnapshotNamespace(0, "10152ae8944a",
-                                                           "2118643c9732")));
-  o.push_back(new SnapshotNamespace(GroupSnapshotNamespace(5, "1018643c9869",
-                                                           "33352be8933c")));
+  o.push_back(new SnapshotNamespace(GroupImageSnapshotNamespace(0, "10152ae8944a",
+                                                                "2118643c9732")));
+  o.push_back(new SnapshotNamespace(GroupImageSnapshotNamespace(5, "1018643c9869",
+                                                                "33352be8933c")));
   o.push_back(new SnapshotNamespace(TrashSnapshotNamespace()));
   o.push_back(new SnapshotNamespace(MirrorSnapshotNamespace(MIRROR_SNAPSHOT_STATE_PRIMARY,
                                                             {"peer uuid"},
@@ -990,7 +995,8 @@ std::ostream& operator<<(std::ostream& os, const UserSnapshotNamespace& ns) {
   return os;
 }
 
-std::ostream& operator<<(std::ostream& os, const GroupSnapshotNamespace& ns) {
+std::ostream& operator<<(std::ostream& os,
+                         const GroupImageSnapshotNamespace& ns) {
   os << "[" << SNAPSHOT_NAMESPACE_TYPE_GROUP << " "
      << "group_pool=" << ns.group_pool << ", "
      << "group_id=" << ns.group_id << ", "
index d5f65abd75f445b37a71893367e1ee2c14a643ec..2f80718207ba8d891034a9e411dc7ac4abf2273b 100644 (file)
@@ -455,15 +455,15 @@ struct UserSnapshotNamespace {
   }
 };
 
-struct GroupSnapshotNamespace {
+struct GroupImageSnapshotNamespace {
   static const SnapshotNamespaceType SNAPSHOT_NAMESPACE_TYPE =
     SNAPSHOT_NAMESPACE_TYPE_GROUP;
 
-  GroupSnapshotNamespace() {}
+  GroupImageSnapshotNamespace() {}
 
-  GroupSnapshotNamespace(int64_t _group_pool,
-                        const std::string &_group_id,
-                        const std::string &_group_snapshot_id)
+  GroupImageSnapshotNamespace(int64_t _group_pool,
+                              const std::string &_group_id,
+                              const std::string &_group_snapshot_id)
     : group_id(_group_id), group_pool(_group_pool),
       group_snapshot_id(_group_snapshot_id) {}
 
@@ -476,17 +476,17 @@ struct GroupSnapshotNamespace {
 
   void dump(ceph::Formatter *f) const;
 
-  inline bool operator==(const GroupSnapshotNamespace& gsn) const {
+  inline bool operator==(const GroupImageSnapshotNamespace& gsn) const {
     return group_pool == gsn.group_pool &&
           group_id == gsn.group_id &&
           group_snapshot_id == gsn.group_snapshot_id;
   }
 
-  inline bool operator!=(const GroupSnapshotNamespace& gsn) const {
+  inline bool operator!=(const GroupImageSnapshotNamespace& gsn) const {
     return !operator==(gsn);
   }
 
-  inline bool operator<(const GroupSnapshotNamespace& gsn) const {
+  inline bool operator<(const GroupImageSnapshotNamespace& gsn) const {
     if (group_pool != gsn.group_pool) {
       return group_pool < gsn.group_pool;
     }
@@ -674,13 +674,13 @@ struct UnknownSnapshotNamespace {
 
 std::ostream& operator<<(std::ostream& os, const SnapshotNamespaceType& type);
 std::ostream& operator<<(std::ostream& os, const UserSnapshotNamespace& ns);
-std::ostream& operator<<(std::ostream& os, const GroupSnapshotNamespace& ns);
+std::ostream& operator<<(std::ostream& os, const GroupImageSnapshotNamespace& ns);
 std::ostream& operator<<(std::ostream& os, const TrashSnapshotNamespace& ns);
 std::ostream& operator<<(std::ostream& os, const MirrorSnapshotNamespace& ns);
 std::ostream& operator<<(std::ostream& os, const UnknownSnapshotNamespace& ns);
 
 typedef std::variant<UserSnapshotNamespace,
-                    GroupSnapshotNamespace,
+                    GroupImageSnapshotNamespace,
                     TrashSnapshotNamespace,
                     MirrorSnapshotNamespace,
                     UnknownSnapshotNamespace> SnapshotNamespaceVariant;
index 22e3ba86757da5caeff6e47920aa244f0f4696db..b95173d2b07636a208f2ac6064a4d7351b21c4f3 100644 (file)
@@ -43,12 +43,12 @@ template <typename I>
 snap_t get_group_snap_id(I* ictx,
                          const cls::rbd::SnapshotNamespace& in_snap_namespace) {
   ceph_assert(ceph_mutex_is_locked(ictx->image_lock));
-  auto it = ictx->snap_ids.lower_bound({cls::rbd::GroupSnapshotNamespace{},
+  auto it = ictx->snap_ids.lower_bound({cls::rbd::GroupImageSnapshotNamespace{},
                                         ""});
   for (; it != ictx->snap_ids.end(); ++it) {
     if (it->first.first == in_snap_namespace) {
       return it->second;
-    } else if (!std::holds_alternative<cls::rbd::GroupSnapshotNamespace>(
+    } else if (!std::holds_alternative<cls::rbd::GroupImageSnapshotNamespace>(
                 it->first.first)) {
       break;
     }
@@ -185,8 +185,8 @@ int group_snap_remove_by_record(librados::IoCtx& group_ioctx,
 
   std::vector<librbd::ImageCtx*> ictxs;
 
-  cls::rbd::GroupSnapshotNamespace ne{group_ioctx.get_id(), group_id,
-                                     group_snap.id};
+  cls::rbd::GroupImageSnapshotNamespace ne{group_ioctx.get_id(), group_id,
+                                           group_snap.id};
 
   ldout(cct, 20) << "Removing snapshots" << dendl;
   int snap_count = group_snap.snaps.size();
@@ -291,8 +291,8 @@ int group_snap_rollback_by_record(librados::IoCtx& group_ioctx,
 
   std::vector<librbd::ImageCtx*> ictxs;
 
-  cls::rbd::GroupSnapshotNamespace ne{group_ioctx.get_id(), group_id,
-                                      group_snap.id};
+  cls::rbd::GroupImageSnapshotNamespace ne{group_ioctx.get_id(), group_id,
+                                           group_snap.id};
 
   ldout(cct, 20) << "Rolling back snapshots" << dendl;
   int snap_count = group_snap.snaps.size();
@@ -956,8 +956,8 @@ int Group<I>::snap_create(librados::IoCtx& group_ioctx,
   group_snap.state = cls::rbd::GROUP_SNAPSHOT_STATE_INCOMPLETE;
   group_snap.snaps = image_snaps;
 
-  cls::rbd::GroupSnapshotNamespace ne{group_ioctx.get_id(), group_id,
-                                      group_snap.id};
+  cls::rbd::GroupImageSnapshotNamespace ne{group_ioctx.get_id(), group_id,
+                                           group_snap.id};
 
   r = cls_client::group_snap_set(&group_ioctx, group_header_oid, group_snap);
   if (r == -EEXIST) {
index 044237484a926ede0f12d1bf4760867ad786158b..3d61de395b54d5f10f48a18cd48e096c144296b5 100644 (file)
@@ -40,12 +40,12 @@ public:
 
   template <typename T>
   inline int operator()(const T&) const {
-    // ignore other than GroupSnapshotNamespace types.
+    // ignore other than GroupImageSnapshotNamespace types.
     return -EINVAL;
   }
 
   inline int operator()(
-      const cls::rbd::GroupSnapshotNamespace& snap_namespace) {
+      const cls::rbd::GroupImageSnapshotNamespace& snap_namespace) {
     IoCtx group_ioctx;
     int r = util::create_ioctx(*image_ioctx, "group", snap_namespace.group_pool,
                                {}, &group_ioctx);