Exemplo n.º 1
0
    def hosts_up(self, context, topic):
        """Return the list of hosts that have a running service for topic."""

        services = db.service_get_all_by_topic(context, topic)
        return [service['host']
                for service in services
                if self.servicegroup_api.service_is_up(service)]
Exemplo n.º 2
0
 def test_service_get_all_by_topic(self):
     values = [
         {'host': 'host1', 'topic': 't1'},
         {'host': 'host2', 'topic': 't1'},
         {'disabled': True, 'topic': 't1'},
         {'host': 'host3', 'topic': 't2'}
     ]
     services = [self._create_service(vals) for vals in values]
     expected = services[:2]
     real = db.service_get_all_by_topic(self.ctxt, 't1')
     self._assertEqualListsOfObjects(expected, real)
Exemplo n.º 3
0
Arquivo: db.py Projeto: n-nishida/rack
 def get_all(self, group_id):
     """Returns ALL members of the given group
     """
     LOG.debug(_('DB_Driver: get_all members of the %s group') % group_id)
     rs = []
     ctxt = context.get_admin_context()
     services = db.service_get_all_by_topic(ctxt, group_id)
     for service in services:
         if self.is_up(service):
             rs.append(service['host'])
     return rs