Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/regexp-for-autoselect-datastore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- "Support for regular expression when using `autoselect_datastore: True`."
4 changes: 2 additions & 2 deletions plugins/modules/vmware_guest.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
type: str
description:
- The name of datastore which will be used for the disk.
- If O(disk.autoselect_datastore) is set to True, will select the less used datastore whose name contains this "disk.datastore" string.
- If O(disk.autoselect_datastore) is set to True, will select the less used datastore whose name matches this "disk.datastore" pattern.
filename:
type: str
description:
Expand Down Expand Up @@ -2768,7 +2768,7 @@ def select_datastore(self, vm_obj=None):

if (ds.summary.freeSpace > datastore_freespace) or (ds.summary.freeSpace == datastore_freespace and not datastore):
# If datastore field is provided, filter destination datastores
if self.params['disk'][0]['datastore'] and ds.name.find(self.params['disk'][0]['datastore']) < 0:
if self.params['disk'][0]['datastore'] and re.search(self.params['disk'][0]['datastore'], ds.name):
continue

datastore = ds
Expand Down