Example #1
0
 def test_aggregate_disk_filter_value_error(self, agg_mock):
     filt_cls = disk_filter.AggregateDiskFilter()
     self.flags(disk_allocation_ratio=1.0)
     filter_properties = {
         'context': mock.sentinel.ctx,
         'instance_type': {'root_gb': 1,
                           'ephemeral_gb': 1,
                           'swap': 1024}}
     host = fakes.FakeHostState('host1', 'node1',
                                {'free_disk_mb': 3 * 1024,
                                 'total_usable_disk_gb': 1})
     agg_mock.return_value = set(['XXX'])
     self.assertTrue(filt_cls.host_passes(host, filter_properties))
     agg_mock.assert_called_once_with(host, 'disk_allocation_ratio')
Example #2
0
 def test_aggregate_disk_filter_value_error(self, agg_mock):
     filt_cls = disk_filter.AggregateDiskFilter()
     self.flags(disk_allocation_ratio=1.0)
     spec_obj = objects.RequestSpec(context=mock.sentinel.ctx,
                                    flavor=objects.Flavor(root_gb=1,
                                                          ephemeral_gb=1,
                                                          swap=1024))
     host = fakes.FakeHostState('host1', 'node1', {
         'free_disk_mb': 3 * 1024,
         'total_usable_disk_gb': 1
     })
     agg_mock.return_value = set(['XXX'])
     self.assertTrue(filt_cls.host_passes(host, spec_obj))
     agg_mock.assert_called_once_with(host, 'disk_allocation_ratio')