bool peer_add(FSMap &fsmap, Filesystem::const_ref &&fs,
const cmdmap_t &cmdmap, std::stringstream &ss) {
+ string peer_uuid;
string remote_spec;
string remote_fs_name;
+ cmd_getval(cmdmap, "uuid", peer_uuid);
cmd_getval(cmdmap, "remote_cluster_spec", remote_spec);
cmd_getval(cmdmap, "remote_fs_name", remote_fs_name);
return false;
}
- if (fs->mirror_info.has_peer((*remote_conf).first,
- (*remote_conf).second, remote_fs_name)) {
+ if (fs->mirror_info.has_peer(peer_uuid)) {
ss << "peer already exists";
return true;
}
- uuid_d uuid_gen;
- uuid_gen.generate_random();
-
- auto f = [uuid_gen, remote_conf, remote_fs_name](auto &&fs) {
- fs->mirror_info.peer_add(stringify(uuid_gen), (*remote_conf).first,
+ auto f = [peer_uuid, remote_conf, remote_fs_name](auto &&fs) {
+ fs->mirror_info.peer_add(peer_uuid, (*remote_conf).first,
(*remote_conf).second, remote_fs_name);
};
fsmap.modify_filesystem(fs->fscid, std::move(f));
"disable mirroring for a ceph filesystem", "mds", "rw")
COMMAND("fs mirror peer_add "
"name=fs_name,type=CephString "
+ "name=uuid,type=CephString "
"name=remote_cluster_spec,type=CephString "
"name=remote_fs_name,type=CephString",
"add a mirror peer for a ceph filesystem", "mds", "rw")