]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: peer_add should accept Ceph file system UUID
authorVenky Shankar <vshankar@redhat.com>
Tue, 23 Feb 2021 04:06:19 +0000 (23:06 -0500)
committerVenky Shankar <vshankar@redhat.com>
Tue, 23 Mar 2021 04:15:25 +0000 (09:45 +0530)
Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit a04010e9490aa726d219c41139c27417dac836e2)

src/mon/FSCommands.cc
src/mon/MonCommands.h

index a401cc786588c7d512848546cfab6f852bda4b0c..63ab1594642df290cae3ea7ededf3b510af5bb2b 100644 (file)
@@ -1132,8 +1132,10 @@ public:
 
   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);
 
@@ -1144,17 +1146,13 @@ public:
       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));
index ada486b48932fcfa0e6eb6d9e388f472bb910c23..cf4a6913de039212497be7c15c65c7cc9717b52b 100644 (file)
@@ -437,6 +437,7 @@ COMMAND("fs mirror disable "
        "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")