diff --git a/nova/tests/test_nfs.py b/nova/tests/test_nfs.py index 8a931b081b7..4c97f128a35 100644 --- a/nova/tests/test_nfs.py +++ b/nova/tests/test_nfs.py @@ -109,8 +109,9 @@ def test_local_path(self): volume['provider_location'] = self.TEST_NFS_EXPORT1 volume['name'] = 'volume-123' - self.assertEqual('/mnt/test/12118957640568004265/volume-123', - drv.local_path(volume)) + self.assertEqual( + '/mnt/test/2f4f60214cf43c595666dd815f0360a4/volume-123', + drv.local_path(volume)) def test_mount_nfs_should_mount_correctly(self): """_mount_nfs common case usage""" @@ -212,7 +213,7 @@ def test_get_hash_str(self): """_get_hash_str should calculation correct value""" drv = self._driver - self.assertEqual('12118957640568004265', + self.assertEqual('2f4f60214cf43c595666dd815f0360a4', drv._get_hash_str(self.TEST_NFS_EXPORT1)) def test_get_mount_point_for_share(self): @@ -221,7 +222,7 @@ def test_get_mount_point_for_share(self): nfs.FLAGS.nfs_mount_point_base = self.TEST_MNT_POINT_BASE - self.assertEqual('/mnt/test/12118957640568004265', + self.assertEqual('/mnt/test/2f4f60214cf43c595666dd815f0360a4', drv._get_mount_point_for_share(self.TEST_NFS_EXPORT1)) def test_get_available_capacity_with_df(self): diff --git a/nova/volume/nfs.py b/nova/volume/nfs.py index f91b52018b1..7a6ca830716 100644 --- a/nova/volume/nfs.py +++ b/nova/volume/nfs.py @@ -15,8 +15,8 @@ # License for the specific language governing permissions and limitations # under the License. -import ctypes import errno +import hashlib import os from nova import exception @@ -290,4 +290,4 @@ def _path_exists(self, path): def _get_hash_str(self, base_str): """returns string that represents hash of base_str (in a hex format)""" - return str(ctypes.c_uint64(hash(base_str)).value) + return hashlib.md5(base_str).hexdigest()