summaryrefslogtreecommitdiff
path: root/nova/virt/xenapi/vmops.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/virt/xenapi/vmops.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/virt/xenapi/vmops.py')
-rw-r--r--nova/virt/xenapi/vmops.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index 9054051e4c..a8d4f2fc2f 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -664,7 +664,7 @@ class VMOps(object):
vbd_refs.append(vbd_ref)
# Attach original ephemeral disks
- for userdevice, vdi_ref in six.iteritems(orig_vdi_refs):
+ for userdevice, vdi_ref in orig_vdi_refs.items():
if userdevice >= DEVICE_EPHEMERAL:
vbd_ref = vm_utils.create_vbd(self._session, vm_ref, vdi_ref,
userdevice, bootable=False)
@@ -789,7 +789,7 @@ class VMOps(object):
ephemeral_vdis = vdis.get('ephemerals')
if ephemeral_vdis:
# attach existing (migrated) ephemeral disks
- for userdevice, ephemeral_vdi in six.iteritems(ephemeral_vdis):
+ for userdevice, ephemeral_vdi in ephemeral_vdis.items():
vm_utils.create_vbd(self._session, vm_ref,
ephemeral_vdi['ref'],
userdevice, bootable=False)
@@ -1796,7 +1796,7 @@ class VMOps(object):
if dom is None or dom not in counters:
continue
vifs_bw = bw.setdefault(name, {})
- for vif_num, vif_data in six.iteritems(counters[dom]):
+ for vif_num, vif_data in counters[dom].items():
mac = vif_map[vif_num]
vif_data['mac_address'] = mac
vifs_bw[mac] = vif_data