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);
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{
*this = UserSnapshotNamespace();
break;
case cls::rbd::SNAPSHOT_NAMESPACE_TYPE_GROUP:
- *this = GroupSnapshotNamespace();
+ *this = GroupImageSnapshotNamespace();
break;
case cls::rbd::SNAPSHOT_NAMESPACE_TYPE_TRASH:
*this = TrashSnapshotNamespace();
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"},
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 << ", "
}
};
-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) {}
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;
}
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;
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;
}
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();
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();
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) {
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);