Beispiel #1
0
    def test_ceph_check_osd_pools(self):
        """Check OSD pools.

        Check osd pools on all ceph units, expect them to be
        identical, and expect specific pools to be present.
        """
        logging.info('Checking pools on ceph units...')

        expected_pools = zaza_ceph.get_expected_pools()
        results = []
        unit_name = 'ceph-mon/0'

        # Check for presence of expected pools on each unit
        logging.debug('Expected pools: {}'.format(expected_pools))
        pools = zaza_ceph.get_ceph_pools(unit_name)
        results.append(pools)

        for expected_pool in expected_pools:
            if expected_pool not in pools:
                msg = ('{} does not have pool: '
                       '{}'.format(unit_name, expected_pool))
                raise zaza_exceptions.CephPoolNotFound(msg)
        logging.debug('{} has (at least) the expected '
                      'pools.'.format(unit_name))

        # Check that all units returned the same pool name:id data
        for i, result in enumerate(results):
            for other in results[i + 1:]:
                logging.debug('result: {}, other: {}'.format(result, other))
                self.assertEqual(result, other)
 def _test_expected_pools(self,
                          os_release_pair,
                          expected_pools,
                          radosgw=False):
     self.get_current_os_release_pair.return_value = os_release_pair
     actual_pools = ceph_utils.get_expected_pools(radosgw)
     self.assertEqual(expected_pools, actual_pools)