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_cinder_ceph_restrict_pool_setup(self): """Make sure cinder-ceph restrict pool was created successfully.""" logging.info('Wait for idle/ready status...') zaza_model.wait_for_application_states() pools = zaza_ceph.get_ceph_pools('ceph-mon/0') if 'cinder-ceph' not in pools: msg = 'cinder-ceph pool was not found upon querying ceph-mon/0' raise zaza_exceptions.CephPoolNotFound(msg) # Checking for cinder-ceph specific permissions makes # the test more rugged when we add additional relations # to ceph for other applications (such as glance and nova). expected_permissions = [ "allow rwx pool=cinder-ceph", "allow class-read object_prefix rbd_children", ] cmd = "sudo ceph auth get client.cinder-ceph" result = zaza_model.run_on_unit('ceph-mon/0', cmd) output = result.get('Stdout').strip() for expected in expected_permissions: if expected not in output: msg = ('cinder-ceph pool restriction ({}) was not' ' configured correctly.' ' Found: {}'.format(expected, output)) raise zaza_exceptions.CephPoolNotConfigured(msg)
def test_cinder_ceph_restrict_pool_setup(self): """Make sure cinder-ceph restrict pool was created successfully.""" logging.info('Wait for idle/ready status...') zaza_model.wait_for_application_states() pools = zaza_ceph.get_ceph_pools('ceph-mon/0') if 'cinder-ceph' not in pools: msg = 'cinder-ceph pool was not found upon querying ceph-mon/0' raise zaza_exceptions.CephPoolNotFound(msg) expected = "pool=cinder-ceph, allow class-read " \ "object_prefix rbd_children" cmd = "sudo ceph auth get client.cinder-ceph" result = zaza_model.run_on_unit('ceph-mon/0', cmd) output = result.get('Stdout').strip() if expected not in output: msg = ('cinder-ceph pool restriction was not configured correctly.' ' Found: {}'.format(output)) raise zaza_exceptions.CephPoolNotConfigured(msg)