vmware_guest: fix datastore selection on equal sized disks and add tests (#26774)

* Fix datastore selection on equal sized disks and add tests
This commit is contained in:
jctanner 2017-07-13 22:02:33 -04:00 committed by GitHub
commit 245a4d30b9
3 changed files with 43 additions and 1 deletions

View file

@ -1086,7 +1086,7 @@ class PyVmomiHelper(object):
datastore_freespace = 0
for ds in datastores:
if ds.summary.freeSpace > datastore_freespace:
if (ds.summary.freeSpace > datastore_freespace) or (ds.summary.freeSpace == datastore_freespace and not datastore):
# If datastore field is provided, filter destination datastores
if 'datastore' in self.params['disk'][0] and \
isinstance(self.params['disk'][0]['datastore'], str) and \