Merge "FIx Accounts with identity v3 and v2 data in yaml"
diff --git a/tempest/common/accounts.py b/tempest/common/accounts.py
index 6d376d6..1d5516f 100644
--- a/tempest/common/accounts.py
+++ b/tempest/common/accounts.py
@@ -190,8 +190,15 @@
     def get_hash(self, creds):
         for _hash in self.hash_dict['creds']:
             # Comparing on the attributes that are expected in the YAML
-            if all([getattr(creds, k) == self.hash_dict['creds'][_hash][k] for
-                   k in creds.get_init_attributes()]):
+            init_attributes = creds.get_init_attributes()
+            hash_attributes = self.hash_dict['creds'][_hash].copy()
+            if ('user_domain_name' in init_attributes and 'user_domain_name'
+                    not in hash_attributes):
+                # Allow for the case of domain_name populated from config
+                domain_name = CONF.identity.admin_domain_name
+                hash_attributes['user_domain_name'] = domain_name
+            if all([getattr(creds, k) == hash_attributes[k] for
+                   k in init_attributes]):
                 return _hash
         raise AttributeError('Invalid credentials %s' % creds)
 
diff --git a/tempest/common/cred_provider.py b/tempest/common/cred_provider.py
index 2c6763d..3223027 100644
--- a/tempest/common/cred_provider.py
+++ b/tempest/common/cred_provider.py
@@ -84,6 +84,8 @@
         domain_fields = set(x for x in auth.KeystoneV3Credentials.ATTRIBUTES
                             if 'domain' in x)
         if not domain_fields.intersection(kwargs.keys()):
+            # TODO(andreaf) It might be better here to use a dedicated config
+            # option such as CONF.auth.tenant_isolation_domain_name
             params['user_domain_name'] = CONF.identity.admin_domain_name
         auth_url = CONF.identity.uri_v3
     else: