]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: don't blow away bootstrap-mgr on upgrades 18727/head
authorJohn Spray <john.spray@redhat.com>
Thu, 19 Oct 2017 13:28:18 +0000 (09:28 -0400)
committerShinobu Kinjo <shinobu@redhat.com>
Sat, 4 Nov 2017 09:01:31 +0000 (18:01 +0900)
Fixes: http://tracker.ceph.com/issues/20950
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit 57229ea2a4369518c7a16b7a09b045b7896f5a70)

src/mon/AuthMonitor.cc

index c9c836dc5151d99bedb09bcd156ce822575c6665..1f13145a6d929678b9f7d44cae453586f9a8d8d7 100644 (file)
@@ -1551,11 +1551,15 @@ void AuthMonitor::upgrade_format()
       }
     }
 
-    // add bootstrap key
-    {
+    // add bootstrap key if it does not already exist
+    // (might have already been get-or-create'd by
+    //  ceph-create-keys)
+    EntityName bootstrap_mgr_name;
+    int r = bootstrap_mgr_name.from_str("client.bootstrap-mgr");
+    assert(r);
+    if (!mon->key_server.contains(bootstrap_mgr_name)) {
       KeyServerData::Incremental auth_inc;
-      bool r = auth_inc.name.from_str("client.bootstrap-mgr");
-      assert(r);
+      auth_inc.name = bootstrap_mgr_name;
       ::encode("allow profile bootstrap-mgr", auth_inc.auth.caps["mon"]);
       auth_inc.op = KeyServerData::AUTH_INC_ADD;
       // generate key