]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: fix misdirecting msgs when an OSD flips at Sepia.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 27 Jul 2021 16:24:55 +0000 (16:24 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 27 Jul 2021 16:29:45 +0000 (16:29 +0000)
For description please refer to:
  * https://gist.github.com/rzarzynski/6cbc20fb28d7ac096ecc4b68500454bf#gistcomment-3830762,
  * https://gist.github.com/rzarzynski/6cbc20fb28d7ac096ecc4b68500454bf#gistcomment-3830939.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/main.cc

index 4b47d89b1510720a232b2a2fce69382d011c4abb..2c6105af8408d268edf7ef536218295c52174249 100644 (file)
@@ -114,13 +114,13 @@ seastar::future<> make_keyring()
 
 uint64_t get_nonce()
 {
-  if (auto pid = getpid(); pid != 1) {
-    return pid;
-  } else {
+  if (auto pid = getpid(); pid == 1 || std::getenv("CEPH_USE_RANDOM_NONCE")) {
     // we're running in a container; use a random number instead!
     std::random_device rd;
     std::default_random_engine rng{rd()};
     return std::uniform_int_distribution<uint64_t>{}(rng);
+  } else {
+    return pid;
   }
 }