CLS_ERR("peer uuid '%s' already exists",
peer.uuid.c_str());
return -ESTALE;
- } else if (peer.cluster_name == mirror_peer.cluster_name &&
- (peer.pool_id == -1 || mirror_peer.pool_id == -1 ||
- peer.pool_id == mirror_peer.pool_id)) {
+ } else if (peer.cluster_name == mirror_peer.cluster_name) {
CLS_ERR("peer cluster name '%s' already exists",
peer.cluster_name.c_str());
return -EEXIST;
int mirror_peer_add(librados::IoCtx *ioctx, const std::string &uuid,
const std::string &cluster_name,
- const std::string &client_name, int64_t pool_id) {
- cls::rbd::MirrorPeer peer(uuid, cluster_name, client_name, pool_id);
+ const std::string &client_name) {
+ cls::rbd::MirrorPeer peer(uuid, cluster_name, client_name);
bufferlist in_bl;
encode(peer, in_bl);
std::vector<cls::rbd::MirrorPeer> *peers);
int mirror_peer_add(librados::IoCtx *ioctx, const std::string &uuid,
const std::string &cluster_name,
- const std::string &client_name,
- int64_t pool_id = -1);
+ const std::string &client_name);
int mirror_peer_remove(librados::IoCtx *ioctx,
const std::string &uuid);
int mirror_peer_set_client(librados::IoCtx *ioctx,
encode(uuid, bl);
encode(cluster_name, bl);
encode(client_name, bl);
+ int64_t pool_id = -1;
encode(pool_id, bl);
ENCODE_FINISH(bl);
}
decode(uuid, it);
decode(cluster_name, it);
decode(client_name, it);
+ int64_t pool_id;
decode(pool_id, it);
DECODE_FINISH(it);
}
f->dump_string("uuid", uuid);
f->dump_string("cluster_name", cluster_name);
f->dump_string("client_name", client_name);
- f->dump_int("pool_id", pool_id);
}
void MirrorPeer::generate_test_instances(std::list<MirrorPeer*> &o) {
o.push_back(new MirrorPeer());
- o.push_back(new MirrorPeer("uuid-123", "cluster name", "client name", 123));
+ o.push_back(new MirrorPeer("uuid-123", "cluster name", "client name"));
}
bool MirrorPeer::operator==(const MirrorPeer &rhs) const {
return (uuid == rhs.uuid &&
cluster_name == rhs.cluster_name &&
- client_name == rhs.client_name &&
- pool_id == rhs.pool_id);
+ client_name == rhs.client_name);
}
std::ostream& operator<<(std::ostream& os, const MirrorMode& mirror_mode) {
os << "["
<< "uuid=" << peer.uuid << ", "
<< "cluster_name=" << peer.cluster_name << ", "
- << "client_name=" << peer.client_name;
- if (peer.pool_id != -1) {
- os << ", pool_id=" << peer.pool_id;
- }
- os << "]";
+ << "client_name=" << peer.client_name
+ << "]";
return os;
}
MirrorPeer() {
}
MirrorPeer(const std::string &uuid, const std::string &cluster_name,
- const std::string &client_name, int64_t pool_id)
- : uuid(uuid), cluster_name(cluster_name), client_name(client_name),
- pool_id(pool_id) {
+ const std::string &client_name)
+ : uuid(uuid), cluster_name(cluster_name), client_name(client_name) {
}
std::string uuid;
std::string cluster_name;
std::string client_name;
- int64_t pool_id = -1;
inline bool is_valid() const {
return (!uuid.empty() && !cluster_name.empty() && !client_name.empty());