]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tasks/cephfs: pg_num check in volume_client test
authorJohn Spray <john.spray@redhat.com>
Tue, 5 Jan 2016 10:27:07 +0000 (10:27 +0000)
committerJohn Spray <john.spray@redhat.com>
Thu, 14 Jan 2016 22:55:29 +0000 (22:55 +0000)
Signed-off-by: John Spray <john.spray@redhat.com>
tasks/cephfs/test_volume_client.py

index 10b5cb81ab6f98f2aba98431be27d7ff80d933ea..bfc211747c01dd786bc73efec0b9b693bcca0439 100644 (file)
@@ -222,6 +222,23 @@ vc.disconnect()
         self.mount_b.umount_wait()
         self._configure_vc_auth(self.mount_b, "manila")
 
+        # Calculate how many PGs we'll expect the new volume pool to have
+        osd_map = json.loads(self.fs.mon_manager.raw_cluster_cmd('osd', 'dump', '--format=json-pretty'))
+        max_per_osd = int(self.fs.get_config('mon_pg_warn_max_per_osd'))
+        osd_count = len(osd_map['osds'])
+        max_overall = osd_count * max_per_osd
+
+        existing_pg_count = 0
+        for p in osd_map['pools']:
+            existing_pg_count += p['pg_num']
+
+        expected_pg_num = (max_overall - existing_pg_count) / 10
+        log.info("max_per_osd {0}".format(max_per_osd))
+        log.info("osd_count {0}".format(osd_count))
+        log.info("max_overall {0}".format(max_overall))
+        log.info("existing_pg_count {0}".format(existing_pg_count))
+        log.info("expected_pg_num {0}".format(expected_pg_num))
+
         pools_a = json.loads(self.fs.mon_manager.raw_cluster_cmd("osd", "dump", "--format=json-pretty"))['pools']
 
         guest_entity = "guest"
@@ -241,3 +258,9 @@ vc.disconnect()
         # Should have created one new pool
         new_pools = set(p['pool_name'] for p in pools_b) - set([p['pool_name'] for p in pools_a])
         self.assertEqual(len(new_pools), 1)
+
+        # It should have followed the heuristic for PG count
+        # (this is an overly strict test condition, so we may want to remove
+        #  it at some point as/when the logic gets fancier)
+        created_pg_num = self.fs.mon_manager.get_pool_property(list(new_pools)[0], "pg_num")
+        self.assertEqual(expected_pg_num, created_pg_num)