From 5a87c0726b714261a07fed2dd0ff296c1968c168 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 5 Nov 2015 17:00:15 +0100 Subject: [PATCH] Port vmware datastore to Python 3 * _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 | 8 +++----- tests-py3.txt | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cinder/volume/drivers/vmware/datastore.py b/cinder/volume/drivers/vmware/datastore.py index 61d15d28e..3f5f126fb 100644 --- a/cinder/volume/drivers/vmware/datastore.py +++ b/cinder/volume/drivers/vmware/datastore.py @@ -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.""" diff --git a/tests-py3.txt b/tests-py3.txt index b4de72841..4160aac3b 100644 --- a/tests-py3.txt +++ b/tests-py3.txt @@ -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 -- 2.45.2