]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/osdmaptool.cc: do not use deprecated std::random_shuffle()
authorKefu Chai <kchai@redhat.com>
Wed, 4 Dec 2019 00:06:40 +0000 (16:06 -0800)
committerDavid Zafman <dzafman@redhat.com>
Wed, 4 Dec 2019 01:31:39 +0000 (17:31 -0800)
the use of `std::random_shuffle()` was introduced by
b946308 .

in this change, it is replaced using `std::shuffle()`.

Fixes: https://tracker.ceph.com/issues/43084
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 30dfef208d859a67c1f1b13c314735861c536e85)

Conflicts:
src/tools/osdmaptool.cc (randomizing pools here instead of rules)

src/tools/osdmaptool.cc

index f15a9ba4871cbfa3bb332cc2cafa9a54aabffe02..fb55dbad771e9c50762d00733abf9a793fefbc41 100644 (file)
@@ -390,8 +390,8 @@ int main(int argc, const char **argv)
       cout << "No pools available" << std::endl;
       goto skip_upmap;
     }
-    srand(time(0));
-    random_shuffle (pools.begin(), pools.end());
+    std::random_device rd;
+    std::shuffle(pools.begin(), pools.end(), std::mt19937{rd()});
     cout << "pools ";
     for (auto& i: pools)
       cout << osdmap.get_pool_name(i) << " ";