summaryrefslogtreecommitdiff
path: root/nova/block_device.py
diff options
context:
space:
mode:
authorSpencer Yu <yushb@gohighsec.com>2016-12-20 23:43:53 -0800
committerSpencer Yu <yushb@gohighsec.com>2017-01-09 09:11:00 +0000
commit70730c09abd3e0e7d0162dd1a942c6671c57f0eb (patch)
tree2cd21731d71bb7049092f42879726c86d44cced2 /nova/block_device.py
parentf55815b2f90b934801a88e10bf750876b0587328 (diff)
downloadnova-70730c09abd3e0e7d0162dd1a942c6671c57f0eb.tar.gz
[2/3]Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid using six.iteritems to achieve iterators. We can use dict.items instead, as it will return iterators in PY3 as well. And dict.items/keys will more readable. 2.In py2, the performance about list should be negligible, see the link [2]. [1] https://wiki.openstack.org/wiki/Python3 [2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html The patch list: 1. cells. 2. compute api. 3. image. 4. network. 5. objects. 6. scheduler. 7. virt. 8. other resources. Partial-Implements: blueprint replace-iteritems-with-items Change-Id: Ic6e469eb80ee1774de1374bb36f38b5134b6b311
Diffstat (limited to 'nova/block_device.py')
-rw-r--r--nova/block_device.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/nova/block_device.py b/nova/block_device.py
index c6f1d1c773..a6ec93e300 100644
--- a/nova/block_device.py
+++ b/nova/block_device.py
@@ -17,7 +17,7 @@ import re
from oslo_log import log as logging
from oslo_utils import strutils
-import six
+
import nova.conf
from nova import exception
@@ -89,11 +89,11 @@ class BlockDeviceDict(dict):
bdm_dict.get('delete_on_termination'))
# NOTE (ndipanov): Never default db fields
self.update({field: None for field in self._fields - do_not_default})
- self.update(list(six.iteritems(bdm_dict)))
+ self.update(bdm_dict.items())
def _validate(self, bdm_dict):
"""Basic data format validations."""
- dict_fields = set(key for key, _ in six.iteritems(bdm_dict))
+ dict_fields = set(key for key, _ in bdm_dict.items())
# Check that there are no bogus fields
if not (dict_fields <=
@@ -139,7 +139,7 @@ class BlockDeviceDict(dict):
non_computable_fields = set(['boot_index', 'disk_bus',
'guest_format', 'device_type'])
- new_bdm = {fld: val for fld, val in six.iteritems(legacy_bdm)
+ new_bdm = {fld: val for fld, val in legacy_bdm.items()
if fld in copy_over_fields}
virt_name = legacy_bdm.get('virtual_name')