Esempio n. 1
0
 def test_get_group_details_with_no_affinity_filters(self):
     self.flags(scheduler_default_filters=['fake'])
     scheduler_utils._SUPPORTS_ANTI_AFFINITY = None
     scheduler_utils._SUPPORTS_AFFINITY = None
     group_info = scheduler_utils._get_group_details(self.context,
                                                     'fake-uuid')
     self.assertIsNone(group_info)
Esempio n. 2
0
 def test_get_group_details_with_no_affinity_filters(self):
     self.flags(scheduler_default_filters=['fake'])
     scheduler_utils._SUPPORTS_ANTI_AFFINITY = None
     scheduler_utils._SUPPORTS_AFFINITY = None
     group_info = scheduler_utils._get_group_details(
         self.context, 'fake-uuid')
     self.assertIsNone(group_info)
Esempio n. 3
0
    def _get_group_details(self, group, policy=None):
        group_hosts = ['hostB']

        with contextlib.nested(
            mock.patch.object(objects.InstanceGroup, 'get_by_instance_uuid',
                              return_value=group),
            mock.patch.object(objects.InstanceGroup, 'get_hosts',
                              return_value=['hostA']),
        ) as (get_group, get_hosts):
            scheduler_utils._SUPPORTS_ANTI_AFFINITY = None
            scheduler_utils._SUPPORTS_AFFINITY = None
            group_info = scheduler_utils._get_group_details(
                self.context, 'fake_uuid', group_hosts)
            self.assertEqual(
                (set(['hostA', 'hostB']), [policy]),
                group_info)
Esempio n. 4
0
    def _get_group_details(self, group, policy=None):
        group_hosts = ['hostB']

        with contextlib.nested(
                mock.patch.object(objects.InstanceGroup,
                                  'get_by_instance_uuid',
                                  return_value=group),
                mock.patch.object(objects.InstanceGroup,
                                  'get_hosts',
                                  return_value=['hostA']),
        ) as (get_group, get_hosts):
            scheduler_utils._SUPPORTS_ANTI_AFFINITY = None
            scheduler_utils._SUPPORTS_AFFINITY = None
            group_info = scheduler_utils._get_group_details(
                self.context, 'fake_uuid', group_hosts)
            self.assertEqual((set(['hostA', 'hostB']), [policy]), group_info)