VMware: fix compute node exception when no hosts in cluster
Commit4033c0c9c1
casues the regression. The result was a empty string and not None. That is suds returns a Text object and not None. Change-Id: I79e70e300f40eb3561cf56478d578f0f8cda273e Closes-bug: #1383305 (cherry picked from commit419096ec19
)
This commit is contained in:
parent
e98738d55a
commit
4dd50808bf
|
@ -311,6 +311,16 @@ class DsUtilTestCase(test.NoDBTestCase):
|
|||
ds_util.get_datastore,
|
||||
self.session, 'fake-cluster')
|
||||
|
||||
def test_get_datastore_no_host_in_cluster(self):
|
||||
def fake_call_method(module, method, *args, **kwargs):
|
||||
return ''
|
||||
|
||||
with mock.patch.object(self.session, '_call_method',
|
||||
fake_call_method):
|
||||
self.assertRaises(exception.DatastoreNotFound,
|
||||
ds_util.get_datastore,
|
||||
self.session, 'fake-cluster')
|
||||
|
||||
def _test_is_datastore_valid(self, accessible=True,
|
||||
maintenance_mode="normal",
|
||||
type="VMFS",
|
||||
|
|
|
@ -248,7 +248,9 @@ def get_datastore(session, cluster, datastore_regex=None):
|
|||
vim_util,
|
||||
"get_dynamic_property", cluster,
|
||||
"ClusterComputeResource", "datastore")
|
||||
if datastore_ret is None:
|
||||
# If there are no hosts in the cluster then an empty string is
|
||||
# returned
|
||||
if not datastore_ret:
|
||||
raise exception.DatastoreNotFound()
|
||||
|
||||
data_store_mors = datastore_ret.ManagedObjectReference
|
||||
|
|
Loading…
Reference in New Issue