]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Port vmware datastore to Python 3
authorVictor Stinner <vstinner@redhat.com>
Thu, 5 Nov 2015 16:00:15 +0000 (17:00 +0100)
committerVictor Stinner <vstinner@redhat.com>
Fri, 6 Nov 2015 16:30:44 +0000 (17:30 +0100)
* _filter_datastores(): replace filter() with list comprehension
  to get a list on Python 3.
* tox.ini: add test_vmware_datastore to Python 3.4.

Partial-Implements: blueprint cinder-python3
Change-Id: Ide4e4adf012e155b99b528ddde937df1a48a079b

cinder/volume/drivers/vmware/datastore.py
tests-py3.txt

index 61d15d28e698e0a8a0f897f9bcbc8c12720edba5..3f5f126fb5b2d082df78fda1ed4d581b12af9981 100644 (file)
@@ -113,12 +113,10 @@ class DatastoreSelector(object):
         filtered_summaries = [self._vops.get_summary(ds) for ds in
                               filtered_datastores]
 
-        def _filter(summary):
-            return (summary.freeSpace > size_bytes and
+        return [summary for summary in filtered_summaries
+                if (summary.freeSpace > size_bytes and
                     (hard_affinity_ds_types is None or
-                     summary.type.lower() in hard_affinity_ds_types))
-
-        return filter(_filter, filtered_summaries)
+                     summary.type.lower() in hard_affinity_ds_types))]
 
     def _get_all_hosts(self):
         """Get all ESX hosts managed by vCenter."""
index b4de72841016ce00f0070bc85361fb61a5e72ba6..4160aac3bd9bc144c5fb41a8079329acac51d98b 100644 (file)
@@ -107,6 +107,7 @@ cinder.tests.unit.test_v6000_fcp
 cinder.tests.unit.test_v6000_iscsi
 cinder.tests.unit.test_v7000_common
 cinder.tests.unit.test_v7000_fcp
+cinder.tests.unit.test_vmware_datastore
 cinder.tests.unit.test_vmware_vmdk
 cinder.tests.unit.test_vmware_volumeops
 cinder.tests.unit.test_volume