Merge "Make aggregate filters use objects"
This commit is contained in:
commit
33414ecb68
6 files changed
+14
-10
No files matched your search
@@ -15,9 +15,9 @@
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from nova import db
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import utils
|
||||
|
||||
opts = [
|
||||
cfg.StrOpt('aggregate_image_properties_isolation_namespace',
|
||||
@@ -49,7 +49,8 @@ class AggregateImagePropertiesIsolation(filters.BaseHostFilter):
|
||||
spec = filter_properties.get('request_spec', {})
|
||||
image_props = spec.get('image', {}).get('properties', {})
|
||||
context = filter_properties['context']
|
||||
metadata = db.aggregate_metadata_get_by_host(context, host_state.host)
|
||||
metadata = utils.aggregate_metadata_get_by_host(context,
|
||||
host_state.host)
|
||||
|
||||
for key, options in metadata.iteritems():
|
||||
if (cfg_namespace and
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova import db
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import extra_specs_ops
|
||||
from nova.scheduler.filters import utils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@@ -42,7 +42,8 @@ class AggregateInstanceExtraSpecsFilter(filters.BaseHostFilter):
|
||||
return True
|
||||
|
||||
context = filter_properties['context']
|
||||
metadata = db.aggregate_metadata_get_by_host(context, host_state.host)
|
||||
metadata = utils.aggregate_metadata_get_by_host(context,
|
||||
host_state.host)
|
||||
|
||||
for key, req in instance_type['extra_specs'].iteritems():
|
||||
# Either not scope format, or aggregate_instance_extra_specs scope
|
||||
|
||||
@@ -13,9 +13,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova import db
|
||||
from nova.openstack.common import log as logging
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import utils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@@ -39,8 +40,9 @@ class AggregateMultiTenancyIsolation(filters.BaseHostFilter):
|
||||
tenant_id = props.get('project_id')
|
||||
|
||||
context = filter_properties['context']
|
||||
metadata = db.aggregate_metadata_get_by_host(context, host_state.host,
|
||||
key="filter_tenant_id")
|
||||
metadata = utils.aggregate_metadata_get_by_host(context,
|
||||
host_state.host,
|
||||
key="filter_tenant_id")
|
||||
|
||||
if metadata != {}:
|
||||
if tenant_id not in metadata["filter_tenant_id"]:
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ from nova import test
|
||||
from nova.tests.unit.scheduler import fakes
|
||||
|
||||
|
||||
@mock.patch('nova.db.aggregate_metadata_get_by_host')
|
||||
@mock.patch('nova.scheduler.filters.utils.aggregate_metadata_get_by_host')
|
||||
class TestAggImagePropsIsolationFilter(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -17,7 +17,7 @@ from nova import test
|
||||
from nova.tests.unit.scheduler import fakes
|
||||
|
||||
|
||||
@mock.patch('nova.db.aggregate_metadata_get_by_host')
|
||||
@mock.patch('nova.scheduler.filters.utils.aggregate_metadata_get_by_host')
|
||||
class TestAggregateInstanceExtraSpecsFilter(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -17,7 +17,7 @@ from nova import test
|
||||
from nova.tests.unit.scheduler import fakes
|
||||
|
||||
|
||||
@mock.patch('nova.db.aggregate_metadata_get_by_host')
|
||||
@mock.patch('nova.scheduler.filters.utils.aggregate_metadata_get_by_host')
|
||||
class TestAggregateMultitenancyIsolationFilter(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
||||
Reference in new issue
Block a user