Merge "Make DiskFilter work with capsule"
This commit is contained in:
commit
499863e18a
@ -26,7 +26,7 @@ class DiskFilter(filters.BaseHostFilter):
|
||||
run_filter_once_per_request = True
|
||||
|
||||
def host_passes(self, host_state, container, extra_spec):
|
||||
if not container.disk:
|
||||
if not hasattr(container, 'disk') or not container.disk:
|
||||
return True
|
||||
|
||||
usable_disk = host_state.disk_total - host_state.disk_used
|
||||
|
@ -33,6 +33,15 @@ class TestDiskFilter(base.TestCase):
|
||||
extra_spec = {}
|
||||
self.assertTrue(self.filt_cls.host_passes(host, container, extra_spec))
|
||||
|
||||
def test_disk_filter_pass_capsule(self):
|
||||
self.filt_cls = disk_filter.DiskFilter()
|
||||
capsule = objects.Capsule(self.context)
|
||||
host = fakes.FakeHostState('testhost')
|
||||
host.disk_total = 80
|
||||
host.disk_used = 40
|
||||
extra_spec = {}
|
||||
self.assertTrue(self.filt_cls.host_passes(host, capsule, extra_spec))
|
||||
|
||||
def test_disk_filter_fail(self):
|
||||
self.filt_cls = disk_filter.DiskFilter()
|
||||
container = objects.Container(self.context)
|
||||
|
Loading…
x
Reference in New Issue
Block a user