예제 #1
0
    def _take_action(self, parsed_args):
        from oio.rdir.client import RdirDispatcher

        self.logger.debug("Checking rdir services.")

        # Load the assigned rdir services
        client = RdirDispatcher({"namespace": self.app.options.ns})

        # rawx
        all_rawx, all_rdir = client.get_assignments('rawx')
        assert not any(r['rdir'] is None for r in all_rawx)
        self.logger.info("All rawx services have an rdir service assigned.")

        # meta2
        all_meta2, all_rdir = client.get_assignments('meta2')
        assert not any(r['rdir'] is None for r in all_meta2)
        self.logger.info("All meta2 services have an rdir service assigned.")

        # Compare with the number of expected services
        l0 = list(self.filter_services(self.live, 'rdir'))
        c0 = list(self.filter_services(self.catalog, 'rdir'))
        assert len(l0) == len(c0)
        assert len(l0) == len(all_rdir)
        self.logger.info("All rdir services are alive.")
        yield ('OK', None)
예제 #2
0
    def test_link_rdir_unachievable_min_dist(self):
        disp = RdirDispatcher({'namespace': self.ns},
                              pool_manager=self.http_pool)

        # Register a service, with score locked to zero
        new_rawx = self._srv('rawx', {'tag.loc': _fake_location})
        new_rawx['score'] = 90
        self._register_srv(new_rawx)
        self._reload_proxy()

        self.assertRaises(exc.OioException, disp.assign_all_rawx, min_dist=4)
        all_rawx, _ = disp.get_assignments('rawx')
        all_rawx_keys = [x['addr'] for x in all_rawx]
        self.assertIn(new_rawx['addr'], all_rawx_keys)
        self.assertRaises(exc.VolumeException, disp.rdir._get_rdir_addr,
                          new_rawx['addr'])