Esempio n. 1
0
 def setUp(self):
     super(PoolWeigherTestCase, self).setUp()
     self.host_manager = fakes.FakeHostManager()
     self.weight_handler = base_host.HostWeightHandler(
         'manila.scheduler.weighers')
     share_servers = [
         {
             'id': 'fake_server_id0'
         },
         {
             'id': 'fake_server_id1'
         },
         {
             'id': 'fake_server_id2'
         },
         {
             'id': 'fake_server_id3'
         },
         {
             'id': 'fake_server_id4'
         },
     ]
     services = [
         dict(id=1,
              host='host1@AAA',
              topic='share',
              disabled=False,
              availability_zone='zone1',
              updated_at=timeutils.utcnow()),
         dict(id=2,
              host='host2@BBB',
              topic='share',
              disabled=False,
              availability_zone='zone1',
              updated_at=timeutils.utcnow()),
         dict(id=3,
              host='host3@CCC',
              topic='share',
              disabled=False,
              availability_zone='zone2',
              updated_at=timeutils.utcnow()),
         dict(id=4,
              host='host@DDD',
              topic='share',
              disabled=False,
              availability_zone='zone3',
              updated_at=timeutils.utcnow()),
         dict(id=5,
              host='host5@EEE',
              topic='share',
              disabled=False,
              availability_zone='zone3',
              updated_at=timeutils.utcnow()),
     ]
     self.host_manager.service_states = (
         fakes.SHARE_SERVICE_STATES_WITH_POOLS)
     self.mock_object(db_api, 'share_server_get_all_by_host',
                      mock.Mock(return_value=share_servers))
     self.mock_object(db_api.IMPL, 'service_get_all_by_topic',
                      mock.Mock(return_value=services))
Esempio n. 2
0
 def __init__(self):
     self.service_states = {}  # { <host>: {<service>: {cap k : v}}}
     self.host_state_map = {}
     self.filter_handler = base_host_filter.HostFilterHandler(
         'manila.scheduler.filters')
     self.filter_classes = self.filter_handler.get_all_classes()
     self.weight_handler = base_host_weigher.HostWeightHandler(
         'manila.scheduler.weighers')
     self.weight_classes = self.weight_handler.get_all_classes()
Esempio n. 3
0
 def setUp(self):
     super(CapacityWeigherTestCase, self).setUp()
     self.host_manager = fakes.FakeHostManager()
     self.weight_handler = base_host.HostWeightHandler(
         'manila.scheduler.weighers')