Merge "Use builtin hashlib.md5"
This commit is contained in:
commit
7c4cd7dd22
@ -15,10 +15,10 @@
|
|||||||
|
|
||||||
"""The volume metadata V3 api."""
|
"""The volume metadata V3 api."""
|
||||||
|
|
||||||
|
import hashlib
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from cinder.api import microversions as mv
|
from cinder.api import microversions as mv
|
||||||
@ -37,7 +37,7 @@ class Controller(volume_meta_v2.Controller):
|
|||||||
metadata = self._get_metadata(context, volume_id)
|
metadata = self._get_metadata(context, volume_id)
|
||||||
data = jsonutils.dumps({"metadata": metadata})
|
data = jsonutils.dumps({"metadata": metadata})
|
||||||
data = data.encode('utf-8')
|
data = data.encode('utf-8')
|
||||||
checksum = md5(data, usedforsecurity=False).hexdigest()
|
checksum = hashlib.md5(data, usedforsecurity=False).hexdigest()
|
||||||
return checksum in req.if_match.etags
|
return checksum in req.if_match.etags
|
||||||
|
|
||||||
@wsgi.extends
|
@wsgi.extends
|
||||||
@ -48,7 +48,8 @@ class Controller(volume_meta_v2.Controller):
|
|||||||
data = jsonutils.dumps(metadata)
|
data = jsonutils.dumps(metadata)
|
||||||
data = data.encode('utf-8')
|
data = data.encode('utf-8')
|
||||||
resp = webob.Response()
|
resp = webob.Response()
|
||||||
resp.headers['Etag'] = md5(data, usedforsecurity=False).hexdigest()
|
resp.headers['Etag'] = hashlib.md5(
|
||||||
|
data, usedforsecurity=False).hexdigest()
|
||||||
resp.body = data
|
resp.body = data
|
||||||
return resp
|
return resp
|
||||||
return metadata
|
return metadata
|
||||||
|
@ -32,7 +32,6 @@ from oslo_config import cfg
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_service import loopingcall
|
from oslo_service import loopingcall
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
from oslo_utils import secretutils
|
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
|
|
||||||
from cinder.backup import driver
|
from cinder.backup import driver
|
||||||
@ -401,7 +400,7 @@ class ChunkedBackupDriver(driver.BackupDriver, metaclass=abc.ABCMeta):
|
|||||||
) as writer:
|
) as writer:
|
||||||
writer.write(output_data)
|
writer.write(output_data)
|
||||||
md5 = eventlet.tpool.execute(
|
md5 = eventlet.tpool.execute(
|
||||||
secretutils.md5, data, usedforsecurity=False).hexdigest()
|
hashlib.md5, data, usedforsecurity=False).hexdigest()
|
||||||
obj[object_name]['md5'] = md5
|
obj[object_name]['md5'] = md5
|
||||||
LOG.debug('backup MD5 for %(object_name)s: %(md5)s',
|
LOG.debug('backup MD5 for %(object_name)s: %(md5)s',
|
||||||
{'object_name': object_name, 'md5': md5})
|
{'object_name': object_name, 'md5': md5})
|
||||||
|
@ -27,6 +27,7 @@ Server-centric flow is used for authentication.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
import hashlib
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -42,7 +43,6 @@ from googleapiclient import errors
|
|||||||
from googleapiclient import http
|
from googleapiclient import http
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import secretutils
|
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
from cinder.backup import chunkeddriver
|
from cinder.backup import chunkeddriver
|
||||||
@ -314,7 +314,7 @@ class GoogleObjectWriter(object):
|
|||||||
body={},
|
body={},
|
||||||
media_body=media).execute(num_retries=self.num_retries)
|
media_body=media).execute(num_retries=self.num_retries)
|
||||||
etag = resp['md5Hash']
|
etag = resp['md5Hash']
|
||||||
md5 = secretutils.md5(self.data, usedforsecurity=False).digest()
|
md5 = hashlib.md5(self.data, usedforsecurity=False).digest()
|
||||||
md5 = md5.encode('utf-8')
|
md5 = md5.encode('utf-8')
|
||||||
etag = bytes(etag, 'utf-8')
|
etag = bytes(etag, 'utf-8')
|
||||||
md5 = base64.b64encode(md5)
|
md5 = base64.b64encode(md5)
|
||||||
|
@ -65,6 +65,7 @@
|
|||||||
|
|
||||||
import base64
|
import base64
|
||||||
import functools
|
import functools
|
||||||
|
import hashlib
|
||||||
import io
|
import io
|
||||||
import itertools as it
|
import itertools as it
|
||||||
import socket
|
import socket
|
||||||
@ -76,7 +77,6 @@ from botocore.vendored.requests.packages.urllib3 import exceptions as \
|
|||||||
urrlib_exc
|
urrlib_exc
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
from cinder.backup import chunkeddriver
|
from cinder.backup import chunkeddriver
|
||||||
@ -325,7 +325,8 @@ class S3ObjectWriter(object):
|
|||||||
def close(self):
|
def close(self):
|
||||||
reader = io.BytesIO(self.data)
|
reader = io.BytesIO(self.data)
|
||||||
contentmd5 = base64.b64encode(
|
contentmd5 = base64.b64encode(
|
||||||
md5(self.data, usedforsecurity=False).digest()).decode('utf-8')
|
hashlib.md5(self.data,
|
||||||
|
usedforsecurity=False).digest()).decode('utf-8')
|
||||||
put_args = {'Bucket': self.bucket,
|
put_args = {'Bucket': self.bucket,
|
||||||
'Body': reader,
|
'Body': reader,
|
||||||
'Key': self.object_name,
|
'Key': self.object_name,
|
||||||
|
@ -42,13 +42,12 @@
|
|||||||
:backup_swift_auth_insecure: If true, bypass verification of server's
|
:backup_swift_auth_insecure: If true, bypass verification of server's
|
||||||
certificate for SSL connections (default: False)
|
certificate for SSL connections (default: False)
|
||||||
"""
|
"""
|
||||||
|
import hashlib
|
||||||
import io
|
import io
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import secretutils
|
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
from swiftclient import client as swift
|
from swiftclient import client as swift
|
||||||
from swiftclient import exceptions as swift_exc
|
from swiftclient import exceptions as swift_exc
|
||||||
@ -323,7 +322,7 @@ class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver):
|
|||||||
headers=headers)
|
headers=headers)
|
||||||
except socket.error as err:
|
except socket.error as err:
|
||||||
raise exception.SwiftConnectionFailed(reason=err)
|
raise exception.SwiftConnectionFailed(reason=err)
|
||||||
md5 = secretutils.md5(self.data, usedforsecurity=False).hexdigest()
|
md5 = hashlib.md5(self.data, usedforsecurity=False).hexdigest()
|
||||||
if etag != md5:
|
if etag != md5:
|
||||||
err = _('error writing object to swift, MD5 of object in '
|
err = _('error writing object to swift, MD5 of object in '
|
||||||
'swift %(etag)s is not the same as MD5 of object sent '
|
'swift %(etag)s is not the same as MD5 of object sent '
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import hashlib
|
||||||
from http import client as http_client
|
from http import client as http_client
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
from swiftclient import client as swift
|
from swiftclient import client as swift
|
||||||
|
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class FakeSwiftConnection2(object):
|
|||||||
object_path = tempfile.gettempdir() + '/' + container + '/' + name
|
object_path = tempfile.gettempdir() + '/' + container + '/' + name
|
||||||
with open(object_path, 'wb') as object_file:
|
with open(object_path, 'wb') as object_file:
|
||||||
object_file.write(reader.read())
|
object_file.write(reader.read())
|
||||||
return md5(reader.read(), usedforsecurity=False).hexdigest()
|
return hashlib.md5(reader.read(), usedforsecurity=False).hexdigest()
|
||||||
|
|
||||||
def delete_object(self, container, name, headers=None):
|
def delete_object(self, container, name, headers=None):
|
||||||
pass
|
pass
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
"""Mock unit tests for the NetApp cmode nfs storage driver."""
|
"""Mock unit tests for the NetApp cmode nfs storage driver."""
|
||||||
|
|
||||||
|
import hashlib
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
from os_brick.remotefs import remotefs as remotefs_brick
|
from os_brick.remotefs import remotefs as remotefs_brick
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
|
|
||||||
from cinder import exception
|
from cinder import exception
|
||||||
@ -993,7 +993,7 @@ class NetAppCmodeNfsDriverTestCase(test.TestCase):
|
|||||||
drv = self.driver
|
drv = self.driver
|
||||||
cinder_mount_point_base = '/opt/stack/data/cinder/mnt/'
|
cinder_mount_point_base = '/opt/stack/data/cinder/mnt/'
|
||||||
# To get the cinder mount point directory, we use:
|
# To get the cinder mount point directory, we use:
|
||||||
mount_dir = md5(
|
mount_dir = hashlib.md5(
|
||||||
'203.0.113.122:/cinder-flexvol1'.encode('utf-8'),
|
'203.0.113.122:/cinder-flexvol1'.encode('utf-8'),
|
||||||
usedforsecurity=False).hexdigest()
|
usedforsecurity=False).hexdigest()
|
||||||
cinder_mount_point = cinder_mount_point_base + mount_dir
|
cinder_mount_point = cinder_mount_point_base + mount_dir
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
"""Unit tests for NexentaStor 5 REST API helper."""
|
"""Unit tests for NexentaStor 5 REST API helper."""
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import posixpath
|
import posixpath
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
import urllib
|
import urllib
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from cinder.tests.unit import test
|
from cinder.tests.unit import test
|
||||||
@ -1185,7 +1185,7 @@ class TestNefProxy(test.TestCase):
|
|||||||
get_settings.return_value = settings
|
get_settings.return_value = settings
|
||||||
self.assertIsNone(self.proxy.update_lock())
|
self.assertIsNone(self.proxy.update_lock())
|
||||||
path = ('%s:%s' % (guid, self.proxy.path)).encode('utf-8')
|
path = ('%s:%s' % (guid, self.proxy.path)).encode('utf-8')
|
||||||
expected = md5(path, usedforsecurity=False).hexdigest()
|
expected = hashlib.md5(path, usedforsecurity=False).hexdigest()
|
||||||
self.assertEqual(expected, self.proxy.lock)
|
self.assertEqual(expected, self.proxy.lock)
|
||||||
|
|
||||||
def test_url(self):
|
def test_url(self):
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
"""Unit tests for OpenStack Cinder volume driver."""
|
"""Unit tests for OpenStack Cinder volume driver."""
|
||||||
|
import hashlib
|
||||||
import os
|
import os
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
|
|
||||||
from cinder import context
|
from cinder import context
|
||||||
@ -802,7 +802,7 @@ class TestNexentaNfsDriver(test.TestCase):
|
|||||||
result = self.drv._local_volume_dir(volume)
|
result = self.drv._local_volume_dir(volume)
|
||||||
get_share.assert_called_with(volume)
|
get_share.assert_called_with(volume)
|
||||||
share = share.encode('utf-8')
|
share = share.encode('utf-8')
|
||||||
digest = md5(share, usedforsecurity=False).hexdigest()
|
digest = hashlib.md5(share, usedforsecurity=False).hexdigest()
|
||||||
expected = os.path.join(self.cfg.nexenta_mount_point_base, digest)
|
expected = os.path.join(self.cfg.nexenta_mount_point_base, digest)
|
||||||
self.assertEqual(expected, result)
|
self.assertEqual(expected, result)
|
||||||
|
|
||||||
|
@ -10,11 +10,10 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import hashlib
|
||||||
import unittest
|
import unittest
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
|
|
||||||
from cinder import exception
|
from cinder import exception
|
||||||
from cinder.tests.unit import test
|
from cinder.tests.unit import test
|
||||||
from cinder.volume import configuration as conf
|
from cinder.volume import configuration as conf
|
||||||
@ -695,7 +694,8 @@ class KioxiaVolumeTestCase(test.TestCase):
|
|||||||
def test_convert_host_name(self):
|
def test_convert_host_name(self):
|
||||||
name = 'ks-node3-000c2960a794-000c2960a797'
|
name = 'ks-node3-000c2960a794-000c2960a797'
|
||||||
result = self.driver._convert_host_name(name)
|
result = self.driver._convert_host_name(name)
|
||||||
expected = md5(name.encode('utf-8'), usedforsecurity=False).hexdigest()
|
expected = hashlib.md5(name.encode('utf-8'),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
self.assertEqual(result, expected)
|
self.assertEqual(result, expected)
|
||||||
|
|
||||||
def test_create_export(self):
|
def test_create_export(self):
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
"""
|
"""
|
||||||
Unit tests for Veritas Access cinder driver.
|
Unit tests for Veritas Access cinder driver.
|
||||||
"""
|
"""
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import tempfile
|
import tempfile
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from xml.dom.minidom import Document
|
from xml.dom.minidom import Document
|
||||||
|
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from cinder import context
|
from cinder import context
|
||||||
@ -224,10 +224,10 @@ class ACCESSIscsiDriverTestCase(test.TestCase):
|
|||||||
index = int(length / 2)
|
index = int(length / 2)
|
||||||
name1 = self.volume.id[:index]
|
name1 = self.volume.id[:index]
|
||||||
name2 = self.volume.id[index:]
|
name2 = self.volume.id[index:]
|
||||||
crc1 = md5(name1.encode('utf-8'),
|
crc1 = hashlib.md5(name1.encode('utf-8'),
|
||||||
usedforsecurity=False).hexdigest()[:5]
|
usedforsecurity=False).hexdigest()[:5]
|
||||||
crc2 = md5(name2.encode('utf-8'),
|
crc2 = hashlib.md5(name2.encode('utf-8'),
|
||||||
usedforsecurity=False).hexdigest()[:5]
|
usedforsecurity=False).hexdigest()[:5]
|
||||||
|
|
||||||
volume_name_to_ret = 'cinder' + '-' + crc1 + '-' + crc2
|
volume_name_to_ret = 'cinder' + '-' + crc1 + '-' + crc2
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import datetime
|
import datetime
|
||||||
|
import hashlib
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
import packaging.version
|
import packaging.version
|
||||||
@ -456,7 +456,7 @@ class PowerMaxUtils(object):
|
|||||||
:returns: uuid
|
:returns: uuid
|
||||||
"""
|
"""
|
||||||
input_str = input_str.lower()
|
input_str = input_str.lower()
|
||||||
m = md5(usedforsecurity=False)
|
m = hashlib.md5(usedforsecurity=False)
|
||||||
m.update(input_str.encode('utf-8'))
|
m.update(input_str.encode('utf-8'))
|
||||||
return m.hexdigest()
|
return m.hexdigest()
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
"""Cinder Volume driver for Fujitsu ETERNUS DX S3 series."""
|
"""Cinder Volume driver for Fujitsu ETERNUS DX S3 series."""
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
import hashlib
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from lxml import etree as ET
|
from lxml import etree as ET
|
||||||
@ -26,7 +27,6 @@ from oslo_concurrency import lockutils
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_service import loopingcall
|
from oslo_service import loopingcall
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
|
|
||||||
from cinder import context
|
from cinder import context
|
||||||
@ -1438,7 +1438,7 @@ class FJDXCommon(object):
|
|||||||
|
|
||||||
id_code = volume['id']
|
id_code = volume['id']
|
||||||
|
|
||||||
m = md5(usedforsecurity=False)
|
m = hashlib.md5(usedforsecurity=False)
|
||||||
m.update(id_code.encode('utf-8'))
|
m.update(id_code.encode('utf-8'))
|
||||||
|
|
||||||
# Pylint: disable=E1121.
|
# Pylint: disable=E1121.
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
|
|
||||||
from cinder import context
|
from cinder import context
|
||||||
@ -35,8 +35,8 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def encode_name(name):
|
def encode_name(name):
|
||||||
encoded_name = md5(name.encode('utf-8'),
|
encoded_name = hashlib.md5(name.encode('utf-8'),
|
||||||
usedforsecurity=False).hexdigest()
|
usedforsecurity=False).hexdigest()
|
||||||
prefix = name.split('-')[0] + '-'
|
prefix = name.split('-')[0] + '-'
|
||||||
postfix = encoded_name[:constants.MAX_NAME_LENGTH - len(prefix)]
|
postfix = encoded_name[:constants.MAX_NAME_LENGTH - len(prefix)]
|
||||||
return prefix + postfix
|
return prefix + postfix
|
||||||
@ -54,8 +54,8 @@ def old_encode_name(name):
|
|||||||
|
|
||||||
def encode_host_name(name):
|
def encode_host_name(name):
|
||||||
if name and len(name) > constants.MAX_NAME_LENGTH:
|
if name and len(name) > constants.MAX_NAME_LENGTH:
|
||||||
encoded_name = md5(name.encode('utf-8'),
|
encoded_name = hashlib.md5(name.encode('utf-8'),
|
||||||
usedforsecurity=False).hexdigest()
|
usedforsecurity=False).hexdigest()
|
||||||
return encoded_name[:constants.MAX_NAME_LENGTH]
|
return encoded_name[:constants.MAX_NAME_LENGTH]
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
"""Volume driver for KIOXIA KumoScale NVMeOF storage system."""
|
"""Volume driver for KIOXIA KumoScale NVMeOF storage system."""
|
||||||
|
|
||||||
|
import hashlib
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
|
|
||||||
from cinder.common import constants
|
from cinder.common import constants
|
||||||
from cinder import exception
|
from cinder import exception
|
||||||
@ -386,7 +386,8 @@ class KumoScaleBaseVolumeDriver(driver.BaseVD):
|
|||||||
if name is None:
|
if name is None:
|
||||||
return ""
|
return ""
|
||||||
if len(name) > 32:
|
if len(name) > 32:
|
||||||
name = md5(name.encode('utf-8'), usedforsecurity=False).hexdigest()
|
name = hashlib.md5(name.encode('utf-8'),
|
||||||
|
usedforsecurity=False).hexdigest()
|
||||||
else:
|
else:
|
||||||
name = name.replace('.', '-').lower()
|
name = name.replace('.', '-').lower()
|
||||||
return name
|
return name
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from eventlet import greenthread
|
from eventlet import greenthread
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import fileutils
|
from oslo_utils import fileutils
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
|
|
||||||
from cinder.common import constants
|
from cinder.common import constants
|
||||||
@ -612,8 +612,9 @@ class NexentaNfsDriver(nfs.NfsDriver):
|
|||||||
:param nfs_share: example 172.18.194.100:/var/nfs
|
:param nfs_share: example 172.18.194.100:/var/nfs
|
||||||
"""
|
"""
|
||||||
nfs_share = nfs_share.encode('utf-8')
|
nfs_share = nfs_share.encode('utf-8')
|
||||||
return os.path.join(self.configuration.nexenta_mount_point_base,
|
return os.path.join(
|
||||||
md5(nfs_share, usedforsecurity=False).hexdigest())
|
self.configuration.nexenta_mount_point_base,
|
||||||
|
hashlib.md5(nfs_share, usedforsecurity=False).hexdigest())
|
||||||
|
|
||||||
def remote_path(self, volume):
|
def remote_path(self, volume):
|
||||||
"""Get volume path (mounted remotely fs path) for given volume.
|
"""Get volume path (mounted remotely fs path) for given volume.
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import posixpath
|
import posixpath
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
from eventlet import greenthread
|
from eventlet import greenthread
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from cinder import exception
|
from cinder import exception
|
||||||
@ -601,7 +601,7 @@ class NefProxy(object):
|
|||||||
path = '%s:%s' % (guid, self.path)
|
path = '%s:%s' % (guid, self.path)
|
||||||
if isinstance(path, str):
|
if isinstance(path, str):
|
||||||
path = path.encode('utf-8')
|
path = path.encode('utf-8')
|
||||||
self.lock = md5(path, usedforsecurity=False).hexdigest()
|
self.lock = hashlib.md5(path, usedforsecurity=False).hexdigest()
|
||||||
|
|
||||||
def url(self, path):
|
def url(self, path):
|
||||||
netloc = '%s:%d' % (self.host, int(self.port))
|
netloc = '%s:%d' % (self.host, int(self.port))
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import errno
|
import errno
|
||||||
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import posixpath
|
import posixpath
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
|
|
||||||
from cinder.common import constants
|
from cinder.common import constants
|
||||||
@ -770,7 +770,7 @@ class NexentaNfsDriver(nfs.NfsDriver):
|
|||||||
share = self._get_volume_share(volume)
|
share = self._get_volume_share(volume)
|
||||||
if isinstance(share, str):
|
if isinstance(share, str):
|
||||||
share = share.encode('utf-8')
|
share = share.encode('utf-8')
|
||||||
path = md5(share, usedforsecurity=False).hexdigest()
|
path = hashlib.md5(share, usedforsecurity=False).hexdigest()
|
||||||
return os.path.join(self.mount_point_base, path)
|
return os.path.join(self.mount_point_base, path)
|
||||||
|
|
||||||
def local_path(self, volume):
|
def local_path(self, volume):
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import binascii
|
import binascii
|
||||||
import collections
|
import collections
|
||||||
import errno
|
import errno
|
||||||
|
import hashlib
|
||||||
import inspect
|
import inspect
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
@ -35,7 +36,6 @@ from oslo_config import cfg
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
from oslo_utils import imageutils
|
from oslo_utils import imageutils
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
|
|
||||||
from cinder import compute
|
from cinder import compute
|
||||||
@ -1041,7 +1041,7 @@ class RemoteFSSnapDriverBase(RemoteFSDriver):
|
|||||||
"""
|
"""
|
||||||
if isinstance(base_str, str):
|
if isinstance(base_str, str):
|
||||||
base_str = base_str.encode('utf-8')
|
base_str = base_str.encode('utf-8')
|
||||||
return md5(base_str, usedforsecurity=False).hexdigest()
|
return hashlib.md5(base_str, usedforsecurity=False).hexdigest()
|
||||||
|
|
||||||
def _get_mount_point_for_share(self, share: str) -> str:
|
def _get_mount_point_for_share(self, share: str) -> str:
|
||||||
"""Return mount point for share.
|
"""Return mount point for share.
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import base64
|
import base64
|
||||||
import functools
|
import functools
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
from os import urandom
|
from os import urandom
|
||||||
@ -32,7 +33,6 @@ import eventlet
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ class AESCipher(object):
|
|||||||
d = d_i = b''
|
d = d_i = b''
|
||||||
while len(d) < key_length + iv_length:
|
while len(d) < key_length + iv_length:
|
||||||
md5_str = d_i + password + salt
|
md5_str = d_i + password + salt
|
||||||
d_i = md5(md5_str, usedforsecurity=True).digest()
|
d_i = hashlib.md5(md5_str, usedforsecurity=True).digest()
|
||||||
d += d_i
|
d += d_i
|
||||||
return d[:key_length], d[key_length:key_length + iv_length]
|
return d[:key_length], d[key_length:key_length + iv_length]
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ Veritas Access Driver for ISCSI.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
import ast
|
import ast
|
||||||
|
import hashlib
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import json
|
import json
|
||||||
from random import randint
|
from random import randint
|
||||||
@ -25,7 +26,6 @@ from oslo_config import cfg
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_service import loopingcall
|
from oslo_service import loopingcall
|
||||||
from oslo_utils import netutils
|
from oslo_utils import netutils
|
||||||
from oslo_utils.secretutils import md5
|
|
||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
import requests
|
import requests
|
||||||
@ -164,10 +164,10 @@ class ACCESSIscsiDriver(driver.ISCSIDriver):
|
|||||||
index = int(length / 2)
|
index = int(length / 2)
|
||||||
name1 = name[:index]
|
name1 = name[:index]
|
||||||
name2 = name[index:]
|
name2 = name[index:]
|
||||||
crc1 = md5(name1.encode('utf-8'),
|
crc1 = hashlib.md5(name1.encode('utf-8'),
|
||||||
usedforsecurity=False).hexdigest()[:5]
|
usedforsecurity=False).hexdigest()[:5]
|
||||||
crc2 = md5(name2.encode('utf-8'),
|
crc2 = hashlib.md5(name2.encode('utf-8'),
|
||||||
usedforsecurity=False).hexdigest()[:5]
|
usedforsecurity=False).hexdigest()[:5]
|
||||||
return 'cinder' + '-' + crc1 + '-' + crc2
|
return 'cinder' + '-' + crc1 + '-' + crc2
|
||||||
|
|
||||||
def check_for_setup_error(self):
|
def check_for_setup_error(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user