Merge "VMware: Fix retype when storage policy is enabled"
This commit is contained in:
commit
29080b7e75
@ -341,19 +341,21 @@ class DatastoreTest(test.TestCase):
|
||||
get_profile_id_by_name.reset_mock()
|
||||
profile_id = mock.sentinel.profile_id
|
||||
get_profile_id_by_name.return_value = profile_id
|
||||
filter_by_profile.return_value = []
|
||||
filter_by_profile.return_value = {}
|
||||
self.assertFalse(self._ds_sel.is_datastore_compliant(datastore,
|
||||
profile_name))
|
||||
get_profile_id_by_name.assert_called_once_with(self._session,
|
||||
profile_name)
|
||||
filter_by_profile.assert_called_once_with([datastore], profile_id)
|
||||
filter_by_profile.assert_called_once_with({datastore: None},
|
||||
profile_id)
|
||||
|
||||
# Test with valid profile and compliant datastore.
|
||||
get_profile_id_by_name.reset_mock()
|
||||
filter_by_profile.reset_mock()
|
||||
filter_by_profile.return_value = [datastore]
|
||||
filter_by_profile.return_value = {datastore: None}
|
||||
self.assertTrue(self._ds_sel.is_datastore_compliant(datastore,
|
||||
profile_name))
|
||||
get_profile_id_by_name.assert_called_once_with(self._session,
|
||||
profile_name)
|
||||
filter_by_profile.assert_called_once_with([datastore], profile_id)
|
||||
filter_by_profile.assert_called_once_with({datastore: None},
|
||||
profile_id)
|
||||
|
@ -294,7 +294,12 @@ class DatastoreSelector(object):
|
||||
return True
|
||||
|
||||
profile_id = self.get_profile_id(profile_name)
|
||||
is_compliant = bool(self._filter_by_profile([datastore], profile_id))
|
||||
# _filter_by_profile expects a map of datastore references to its
|
||||
# properties. It only uses the properties to construct a map of
|
||||
# filtered datastores to its properties. Here we don't care about
|
||||
# the datastore property, so pass it as None.
|
||||
is_compliant = bool(self._filter_by_profile({datastore: None},
|
||||
profile_id))
|
||||
LOG.debug("Compliance is %(is_compliant)s for datastore: "
|
||||
"%(datastore)s against profile: %(profile)s.",
|
||||
{'is_compliant': is_compliant,
|
||||
|
Loading…
Reference in New Issue
Block a user