Return None if no suitable datastore is found
In the case of a datastore cluster, if no datastor is found then return None. Do not fail on a key exception for accessing a field that does not exist Change-Id: I036f8022e2b9f454f7cd10846b408153a18b7b60
This commit is contained in:
parent
507afb25b1
commit
009c5e3bfe
|
@ -61,6 +61,9 @@ def get_recommended_datastore(session, sp_spec):
|
|||
"RecommendDatastores",
|
||||
session.vim.service_content.storageResourceManager,
|
||||
storageSpec=sp_spec)
|
||||
if not hasattr(spr, 'recommendations'):
|
||||
LOG.error("Unable to find suitable datastore")
|
||||
return
|
||||
return spr.recommendations[0].key
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue