Only filter once for trusted filters

In spawn process the filters will be used only once if the
run_filter_once_per_request is set to True. This apply to the hosts
that will not be affected by previous instance resource consumption.
Trusted filter should be in this kind of filters.

Change-Id: Ia223797798679fecfcf90983ca81a9f395e67c3b
This commit is contained in:
jichenjc 2014-10-09 19:34:28 +08:00
parent 90dee8d431
commit d5f1a53593

View File

@ -255,6 +255,9 @@ class TrustedFilter(filters.BaseHostFilter):
def __init__(self):
self.compute_attestation = ComputeAttestation()
# The hosts the instances are running on doesn't change within a request
run_filter_once_per_request = True
def host_passes(self, host_state, filter_properties):
instance_type = filter_properties.get('instance_type', {})
extra = instance_type.get('extra_specs', {})