diff options
author | Victor Stinner <vstinner@redhat.com> | 2015-05-14 01:26:33 +0200 |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2015-05-22 11:33:18 -0700 |
commit | 68f6f080b2cddd3d4e97dc25a98e0c84c4979b8a (patch) | |
tree | 5bd181a713c99e7b402af9ab57c4dd171fbf0f5b /nova/block_device.py | |
parent | 792dc63a107751ceccce334541eca643b3e81bf5 (diff) | |
download | nova-68f6f080b2cddd3d4e97dc25a98e0c84c4979b8a.tar.gz |
Replace dict.iteritems() with six.iteritems(dict)
This patch was generated by the sixer tool version 0.2 using the
"iteritems" operation:
https://pypi.python.org/pypi/sixer
Manual changes:
- Don't change get_instance_metadata() in nova/compute/api.py:
fixed by the change Ifd455e70002eb9636b87f83788384127ba6edeeb.
- Don't change sqlalchemy code and
nova/tests/unit/db/test_db_api.py. sqlalchemy objects cannot be
converted to a dictionary using dict(obj) directly yet. It will be
possible with the change I702be362a58155a28482e733e60539d36c039509.
- Revert change in a comment in nova/objects/instance.py; the sixer tool
is limited and don't understand comments
- Reformat nova/virt/vmwareapi/driver.py to respect the 80 columns
contraint
Blueprint nova-python3
Change-Id: I81465661cb8a74778d70ba9b6641073f1effa49b
Diffstat (limited to 'nova/block_device.py')
-rw-r--r-- | nova/block_device.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/nova/block_device.py b/nova/block_device.py index 1b5029799b..a917e7ef30 100644 --- a/nova/block_device.py +++ b/nova/block_device.py @@ -18,6 +18,7 @@ import re from oslo_config import cfg from oslo_log import log as logging from oslo_utils import strutils +import six from nova import exception from nova.i18n import _ @@ -87,11 +88,11 @@ class BlockDeviceDict(dict): bdm_dict['device_name'] = prepend_dev(bdm_dict['device_name']) # NOTE (ndipanov): Never default db fields self.update({field: None for field in self._fields - do_not_default}) - self.update(list(bdm_dict.iteritems())) + self.update(list(six.iteritems(bdm_dict))) def _validate(self, bdm_dict): """Basic data format validations.""" - dict_fields = set(key for key, _ in bdm_dict.iteritems()) + dict_fields = set(key for key, _ in six.iteritems(bdm_dict)) # Check that there are no bogus fields if not (dict_fields <= @@ -137,7 +138,7 @@ class BlockDeviceDict(dict): non_computable_fields = set(['boot_index', 'disk_bus', 'guest_format', 'device_type']) - new_bdm = {fld: val for fld, val in legacy_bdm.iteritems() + new_bdm = {fld: val for fld, val in six.iteritems(legacy_bdm) if fld in copy_over_fields} virt_name = legacy_bdm.get('virtual_name') |