diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index fb3dc9eed..a781b2155 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -2742,7 +2742,7 @@ def _instance_update(context, instance_uuid, values, expected, original=None): else: # Coerce all single values to singleton lists expected = {k: [None] if v is None else sqlalchemyutils.to_list(v) - for (k, v) in six.iteritems(expected)} + for (k, v) in expected.items()} # Extract 'expected_' values from values dict, as these aren't actually # updates @@ -2798,7 +2798,7 @@ def _instance_update(context, instance_uuid, values, expected, original=None): conflicts_expected = {} conflicts_actual = {} - for (field, expected_values) in six.iteritems(expected): + for (field, expected_values) in expected.items(): actual = original[field] if actual not in expected_values: conflicts_expected[field] = expected_values diff --git a/nova/scheduler/filters/aggregate_image_properties_isolation.py b/nova/scheduler/filters/aggregate_image_properties_isolation.py index 0dfb384d0..600c8746f 100644 --- a/nova/scheduler/filters/aggregate_image_properties_isolation.py +++ b/nova/scheduler/filters/aggregate_image_properties_isolation.py @@ -14,7 +14,7 @@ # under the License. from oslo_log import log as logging -import six + import nova.conf from nova.i18n import _LW @@ -44,7 +44,7 @@ class AggregateImagePropertiesIsolation(filters.BaseHostFilter): image_props = spec_obj.image.properties if spec_obj.image else {} metadata = utils.aggregate_metadata_get_by_host(host_state) - for key, options in six.iteritems(metadata): + for key, options in metadata.items(): if (cfg_namespace and not key.startswith(cfg_namespace + cfg_separator)): continue diff --git a/nova/scheduler/filters/aggregate_instance_extra_specs.py b/nova/scheduler/filters/aggregate_instance_extra_specs.py index b57bcaf17..e758bb2ae 100644 --- a/nova/scheduler/filters/aggregate_instance_extra_specs.py +++ b/nova/scheduler/filters/aggregate_instance_extra_specs.py @@ -15,7 +15,7 @@ # under the License. from oslo_log import log as logging -import six + from nova.scheduler import filters from nova.scheduler.filters import extra_specs_ops @@ -48,7 +48,7 @@ class AggregateInstanceExtraSpecsFilter(filters.BaseHostFilter): metadata = utils.aggregate_metadata_get_by_host(host_state) - for key, req in six.iteritems(instance_type.extra_specs): + for key, req in instance_type.extra_specs.items(): # Either not scope format, or aggregate_instance_extra_specs scope scope = key.split(':', 1) if len(scope) > 1: diff --git a/nova/test.py b/nova/test.py index 85ff0d1bd..d0d7eb305 100644 --- a/nova/test.py +++ b/nova/test.py @@ -336,7 +336,7 @@ class TestCase(testtools.TestCase): def flags(self, **kw): """Override flag variables for a test.""" group = kw.pop('group', None) - for k, v in six.iteritems(kw): + for k, v in kw.items(): CONF.set_override(k, v, group, enforce_type=True) def start_service(self, name, host=None, **kwargs): diff --git a/nova/utils.py b/nova/utils.py index d775e579a..56ab18d4a 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -928,7 +928,7 @@ def metadata_to_dict(metadata, include_deleted=False): def dict_to_metadata(metadata): result = [] - for key, value in six.iteritems(metadata): + for key, value in metadata.items(): result.append(dict(key=key, value=value)) return result @@ -1133,7 +1133,7 @@ def get_system_metadata_from_image(image_meta, flavor=None): system_meta = {} prefix_format = SM_IMAGE_PROP_PREFIX + '%s' - for key, value in six.iteritems(image_meta.get('properties', {})): + for key, value in image_meta.get('properties', {}).items(): if key in SM_SKIP_KEYS: continue @@ -1164,7 +1164,7 @@ def get_image_from_system_metadata(system_meta): if not isinstance(system_meta, dict): system_meta = metadata_to_dict(system_meta, include_deleted=True) - for key, value in six.iteritems(system_meta): + for key, value in system_meta.items(): if value is None: continue @@ -1295,7 +1295,7 @@ def filter_and_format_resource_metadata(resource_type, resource_list, if ids and _get_id(resource) not in ids: return {} - for k, v in six.iteritems(input_metadata): + for k, v in input_metadata.items(): # Both keys and value defined -- AND if (keys_filter and values_filter and not _match_any(keys_filter, k) and