diff options
152 files changed, 471 insertions, 464 deletions
diff --git a/cinder/api/contrib/services.py b/cinder/api/contrib/services.py index 74abf0365..02180ba4c 100644 --- a/cinder/api/contrib/services.py +++ b/cinder/api/contrib/services.py @@ -36,7 +36,7 @@ from cinder.scheduler import rpcapi as scheduler_rpcapi from cinder import utils from cinder import volume from cinder.volume import rpcapi as volume_rpcapi -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils CONF = cfg.CONF diff --git a/cinder/api/v2/snapshots.py b/cinder/api/v2/snapshots.py index 657163745..66be31b06 100644 --- a/cinder/api/v2/snapshots.py +++ b/cinder/api/v2/snapshots.py @@ -27,7 +27,7 @@ from cinder.api.schemas import snapshots as snapshot from cinder.api import validation from cinder.api.views import snapshots as snapshot_views from cinder import volume -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/api/v2/volumes.py b/cinder/api/v2/volumes.py index 5949ca75c..86d2b082e 100644 --- a/cinder/api/v2/volumes.py +++ b/cinder/api/v2/volumes.py @@ -39,7 +39,7 @@ from cinder.image import glance from cinder import objects from cinder import utils from cinder import volume as cinder_volume -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils CONF = cfg.CONF diff --git a/cinder/api/v3/attachments.py b/cinder/api/v3/attachments.py index 2afab9116..1d98cd997 100644 --- a/cinder/api/v3/attachments.py +++ b/cinder/api/v3/attachments.py @@ -29,7 +29,7 @@ from cinder import objects from cinder.objects import fields from cinder.policies import attachments as attachment_policy from cinder.volume import api as volume_api -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/backup/api.py b/cinder/backup/api.py index b6cc0192b..30f897e24 100644 --- a/cinder/backup/api.py +++ b/cinder/backup/api.py @@ -42,7 +42,7 @@ import cinder.policy from cinder import quota from cinder import quota_utils import cinder.volume -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils backup_opts = [ cfg.BoolOpt('backup_use_same_host', diff --git a/cinder/backup/chunkeddriver.py b/cinder/backup/chunkeddriver.py index b845d4415..4cb8a848f 100644 --- a/cinder/backup/chunkeddriver.py +++ b/cinder/backup/chunkeddriver.py @@ -40,7 +40,7 @@ from cinder import exception from cinder.i18n import _ from cinder import objects from cinder.objects import fields -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils if sys.platform == 'win32': from os_win import utilsfactory as os_win_utilsfactory diff --git a/cinder/backup/manager.py b/cinder/backup/manager.py index 0c43bcfa6..3dc739250 100644 --- a/cinder/backup/manager.py +++ b/cinder/backup/manager.py @@ -58,7 +58,7 @@ from cinder import quota from cinder import rpc from cinder import utils from cinder.volume import rpcapi as volume_rpcapi -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/cmd/manage.py b/cinder/cmd/manage.py index de11e9c07..b430c6e59 100644 --- a/cinder/cmd/manage.py +++ b/cinder/cmd/manage.py @@ -85,7 +85,7 @@ from cinder import rpc from cinder.scheduler import rpcapi as scheduler_rpcapi from cinder import version from cinder.volume import rpcapi as volume_rpcapi -from cinder.volume import utils as vutils +from cinder.volume import volume_utils as vutils CONF = cfg.CONF diff --git a/cinder/cmd/volume_usage_audit.py b/cinder/cmd/volume_usage_audit.py index c7e49d1fc..7c3dce53d 100644 --- a/cinder/cmd/volume_usage_audit.py +++ b/cinder/cmd/volume_usage_audit.py @@ -51,7 +51,7 @@ from cinder import objects from cinder import rpc from cinder import utils from cinder import version -import cinder.volume.utils +import cinder.volume.volume_utils CONF = cfg.CONF @@ -99,7 +99,7 @@ def _vol_notify_usage(LOG, volume_ref, extra_info, admin_context): {'volume_id': volume_ref.id, 'project_id': volume_ref.project_id, 'extra_info': extra_info}) - cinder.volume.utils.notify_about_volume_usage( + cinder.volume.volume_utils.notify_about_volume_usage( admin_context, volume_ref, 'exists', extra_usage_info=extra_info) except Exception as exc_msg: LOG.error("Exists volume notification failed: %s", @@ -114,7 +114,7 @@ def _snap_notify_usage(LOG, snapshot_ref, extra_info, admin_context): {'snapshot_id': snapshot_ref.id, 'project_id': snapshot_ref.project_id, 'extra_info': extra_info}) - cinder.volume.utils.notify_about_snapshot_usage( + cinder.volume.volume_utils.notify_about_snapshot_usage( admin_context, snapshot_ref, 'exists', extra_info) except Exception as exc_msg: LOG.error("Exists snapshot notification failed: %s", @@ -124,7 +124,7 @@ def _snap_notify_usage(LOG, snapshot_ref, extra_info, admin_context): def _backup_notify_usage(LOG, backup_ref, extra_info, admin_context): """backup_ref notify usage""" try: - cinder.volume.utils.notify_about_backup_usage( + cinder.volume.volume_utils.notify_about_backup_usage( admin_context, backup_ref, 'exists', extra_info) LOG.debug("Sent notification for <backup_id: %(backup_id)s> " "<project_id %(project_id)s> <%(extra_info)s>", @@ -221,7 +221,7 @@ def main(): for volume_ref in volumes: _obj_ref_action(_vol_notify_usage, LOG, volume_ref, extra_info, admin_context, begin, end, - cinder.volume.utils.notify_about_volume_usage, + cinder.volume.volume_utils.notify_about_volume_usage, "volume_id", "volume") snapshots = objects.SnapshotList.get_all_active_by_window(admin_context, @@ -229,8 +229,8 @@ def main(): LOG.info("Found %d snapshots", len(snapshots)) for snapshot_ref in snapshots: _obj_ref_action(_snap_notify_usage, LOG, snapshot_ref, extra_info, - admin_context, begin, - end, cinder.volume.utils.notify_about_snapshot_usage, + admin_context, begin, end, + cinder.volume.volume_utils.notify_about_snapshot_usage, "snapshot_id", "snapshot") backups = objects.BackupList.get_all_active_by_window(admin_context, @@ -239,7 +239,7 @@ def main(): LOG.info("Found %d backups", len(backups)) for backup_ref in backups: _obj_ref_action(_backup_notify_usage, LOG, backup_ref, extra_info, - admin_context, begin, - end, cinder.volume.utils.notify_about_backup_usage, + admin_context, begin, end, + cinder.volume.volume_utils.notify_about_backup_usage, "backup_id", "backup") LOG.info("Volume usage audit completed") diff --git a/cinder/db/sqlalchemy/api.py b/cinder/db/sqlalchemy/api.py index ec8d8854c..3cfeb6117 100644 --- a/cinder/db/sqlalchemy/api.py +++ b/cinder/db/sqlalchemy/api.py @@ -66,7 +66,7 @@ from cinder.i18n import _ from cinder import objects from cinder.objects import fields from cinder import utils -from cinder.volume import utils as vol_utils +from cinder.volume import volume_utils as vol_utils CONF = cfg.CONF LOG = logging.getLogger(__name__) diff --git a/cinder/group/api.py b/cinder/group/api.py index 2de39adfd..5fb284bd4 100644 --- a/cinder/group/api.py +++ b/cinder/group/api.py @@ -39,8 +39,8 @@ from cinder import quota_utils from cinder.scheduler import rpcapi as scheduler_rpcapi from cinder.volume import api as volume_api from cinder.volume import rpcapi as volume_rpcapi -from cinder.volume import utils as vol_utils from cinder.volume import volume_types +from cinder.volume import volume_utils as vol_utils CONF = cfg.CONF diff --git a/cinder/image/image_utils.py b/cinder/image/image_utils.py index 4d43e1b87..7d57b839e 100644 --- a/cinder/image/image_utils.py +++ b/cinder/image/image_utils.py @@ -49,7 +49,7 @@ from cinder import exception from cinder.i18n import _ from cinder import utils from cinder.volume import throttling -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/objects/group.py b/cinder/objects/group.py index c18bf8b0b..c159c14f4 100644 --- a/cinder/objects/group.py +++ b/cinder/objects/group.py @@ -21,7 +21,7 @@ from cinder.i18n import _ from cinder import objects from cinder.objects import base from cinder.objects import fields as c_fields -from cinder.volume import utils as vol_utils +from cinder.volume import volume_utils @base.CinderObjectRegistry.register @@ -180,8 +180,8 @@ class Group(base.CinderPersistentObject, base.CinderObject, @property def is_replicated(self): - if (vol_utils.is_group_a_type(self, "group_replication_enabled") or - vol_utils.is_group_a_type( + if (volume_utils.is_group_a_type(self, "group_replication_enabled") or + volume_utils.is_group_a_type( self, "consistent_group_replication_enabled")): return True return False diff --git a/cinder/objects/volume_type.py b/cinder/objects/volume_type.py index 09d63f51e..849ba81fe 100644 --- a/cinder/objects/volume_type.py +++ b/cinder/objects/volume_type.py @@ -21,8 +21,8 @@ from cinder import exception from cinder.i18n import _ from cinder import objects from cinder.objects import base -from cinder.volume import utils from cinder.volume import volume_types +from cinder.volume import volume_utils @base.CinderObjectRegistry.register @@ -163,10 +163,10 @@ class VolumeType(base.CinderPersistentObject, base.CinderObject, orm_obj, expected_attrs=expected_attrs) def is_replicated(self): - return utils.is_replicated_spec(self.extra_specs) + return volume_utils.is_replicated_spec(self.extra_specs) def is_multiattach(self): - return utils.is_multiattach_spec(self.extra_specs) + return volume_utils.is_multiattach_spec(self.extra_specs) @base.CinderObjectRegistry.register diff --git a/cinder/scheduler/filter_scheduler.py b/cinder/scheduler/filter_scheduler.py index daf47c437..bdb1eb020 100644 --- a/cinder/scheduler/filter_scheduler.py +++ b/cinder/scheduler/filter_scheduler.py @@ -28,7 +28,7 @@ from cinder import exception from cinder.i18n import _ from cinder.scheduler import driver from cinder.scheduler import scheduler_options -from cinder.volume import utils +from cinder.volume import volume_utils as utils CONF = cfg.CONF LOG = logging.getLogger(__name__) diff --git a/cinder/scheduler/filters/instance_locality_filter.py b/cinder/scheduler/filters/instance_locality_filter.py index 83ecafcec..01d925842 100644 --- a/cinder/scheduler/filters/instance_locality_filter.py +++ b/cinder/scheduler/filters/instance_locality_filter.py @@ -20,7 +20,7 @@ from cinder.compute import nova from cinder import exception from cinder.i18n import _ from cinder.scheduler import filters -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/scheduler/host_manager.py b/cinder/scheduler/host_manager.py index a9282a3e2..2eb56ffe5 100644 --- a/cinder/scheduler/host_manager.py +++ b/cinder/scheduler/host_manager.py @@ -34,8 +34,8 @@ from cinder import exception from cinder import objects from cinder.scheduler import filters from cinder import utils -from cinder.volume import utils as vol_utils from cinder.volume import volume_types +from cinder.volume import volume_utils as vol_utils # FIXME: This file should be renamed to backend_manager, we should also rename diff --git a/cinder/service.py b/cinder/service.py index 439d768e0..caacb5356 100644 --- a/cinder/service.py +++ b/cinder/service.py @@ -48,7 +48,7 @@ from cinder.objects import base as objects_base from cinder.objects import fields from cinder import rpc from cinder import version -from cinder.volume import utils as vol_utils +from cinder.volume import volume_utils if os.name == 'nt': from os_win import utilsfactory as os_win_utilsfactory @@ -250,7 +250,7 @@ class Service(service.Service): target = messaging.Target( topic='%(topic)s.%(host)s' % {'topic': self.topic, 'host': self.host}, - server=vol_utils.extract_host(self.host, 'host')) + server=volume_utils.extract_host(self.host, 'host')) self.backend_rpcserver = rpc.get_server(target, endpoints, serializer) self.backend_rpcserver.start() @@ -262,7 +262,7 @@ class Service(service.Service): 'cluster': self.cluster}) target = messaging.Target( topic='%s.%s' % (self.topic, self.cluster), - server=vol_utils.extract_host(self.cluster, 'host')) + server=volume_utils.extract_host(self.cluster, 'host')) serializer = objects_base.CinderObjectSerializer(obj_version_cap) self.cluster_rpcserver = rpc.get_server(target, endpoints, serializer) diff --git a/cinder/test.py b/cinder/test.py index 709617603..630ca552f 100644 --- a/cinder/test.py +++ b/cinder/test.py @@ -55,7 +55,7 @@ from cinder import service from cinder.tests import fixtures as cinder_fixtures from cinder.tests.unit import conf_fixture from cinder.tests.unit import fake_notifier -from cinder.volume import utils +from cinder.volume import volume_utils CONF = config.CONF @@ -540,8 +540,8 @@ class RPCAPITestCase(TestCase, ModelsObjectComparatorMixin): version = version or self.base_version topic = None if server is not None: - backend = utils.extract_host(server) - server = utils.extract_host(server, 'host') + backend = volume_utils.extract_host(server) + server = volume_utils.extract_host(server, 'host') topic = 'cinder-volume.%s' % backend if expected_method is None: diff --git a/cinder/tests/fake_driver.py b/cinder/tests/fake_driver.py index 2cc1d8b2e..03bdc3f03 100644 --- a/cinder/tests/fake_driver.py +++ b/cinder/tests/fake_driver.py @@ -21,7 +21,7 @@ from cinder.tests.unit.brick import fake_lvm from cinder import utils from cinder.volume import driver from cinder.volume.drivers import lvm -from cinder.volume import utils as vol_utils +from cinder.volume import volume_utils from cinder.zonemanager import utils as fczm_utils @@ -50,7 +50,7 @@ class FakeLoggingVolumeDriver(lvm.LVMVolumeDriver): model_update = {} try: if (volume.volume_type and volume.volume_type.extra_specs and - vol_utils.is_replicated_spec( + volume_utils.is_replicated_spec( volume.volume_type.extra_specs)): # Sets the new volume's replication_status to disabled model_update['replication_status'] = ( diff --git a/cinder/tests/unit/api/v3/test_attachments.py b/cinder/tests/unit/api/v3/test_attachments.py index 8816a5b69..324c4089e 100644 --- a/cinder/tests/unit/api/v3/test_attachments.py +++ b/cinder/tests/unit/api/v3/test_attachments.py @@ -34,7 +34,7 @@ from cinder.tests.unit.api import fakes from cinder.tests.unit import fake_constants as fake from cinder.volume import api as volume_api from cinder.volume import rpcapi as volume_rpcapi -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils @ddt.ddt diff --git a/cinder/tests/unit/api/v3/test_groups.py b/cinder/tests/unit/api/v3/test_groups.py index f536d7c9a..21dc86285 100644 --- a/cinder/tests/unit/api/v3/test_groups.py +++ b/cinder/tests/unit/api/v3/test_groups.py @@ -1176,9 +1176,9 @@ class GroupsAPITestCase(test.TestCase): volume.destroy() source_grp.destroy() - @mock.patch('cinder.volume.utils.is_replicated_spec', + @mock.patch('cinder.volume.volume_utils.is_replicated_spec', return_value=True) - @mock.patch('cinder.volume.utils.is_group_a_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_type', return_value=True) def test_enable_replication(self, mock_rep_grp_type, mock_rep_vol_type): req = fakes.HTTPRequest.blank('/v3/%s/groups/%s/action' % @@ -1199,8 +1199,8 @@ class GroupsAPITestCase(test.TestCase): @ddt.data((True, False), (False, True), (False, False)) @ddt.unpack - @mock.patch('cinder.volume.utils.is_replicated_spec') - @mock.patch('cinder.volume.utils.is_group_a_type') + @mock.patch('cinder.volume.volume_utils.is_replicated_spec') + @mock.patch('cinder.volume.volume_utils.is_group_a_type') def test_enable_replication_wrong_type(self, is_grp_rep_type, is_vol_rep_type, mock_rep_grp_type, @@ -1217,9 +1217,9 @@ class GroupsAPITestCase(test.TestCase): self.controller.enable_replication, req, self.group3.id, body=body) - @mock.patch('cinder.volume.utils.is_replicated_spec', + @mock.patch('cinder.volume.volume_utils.is_replicated_spec', return_value=False) - @mock.patch('cinder.volume.utils.is_group_a_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_type', return_value=True) def test_enable_replication_wrong_group_type(self, mock_rep_grp_type, mock_rep_vol_type): @@ -1233,9 +1233,9 @@ class GroupsAPITestCase(test.TestCase): self.controller.enable_replication, req, self.group3.id, body=body) - @mock.patch('cinder.volume.utils.is_replicated_spec', + @mock.patch('cinder.volume.volume_utils.is_replicated_spec', return_value=True) - @mock.patch('cinder.volume.utils.is_group_a_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_type', return_value=True) @ddt.data((mv.GROUP_REPLICATION, True, fields.GroupStatus.CREATING, @@ -1266,9 +1266,9 @@ class GroupsAPITestCase(test.TestCase): self.controller.enable_replication, req, group_id, body=body) - @mock.patch('cinder.volume.utils.is_replicated_spec', + @mock.patch('cinder.volume.volume_utils.is_replicated_spec', return_value=True) - @mock.patch('cinder.volume.utils.is_group_a_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_type', return_value=True) def test_disable_replication(self, mock_rep_grp_type, mock_rep_vol_type): req = fakes.HTTPRequest.blank('/v3/%s/groups/%s/action' % @@ -1288,9 +1288,9 @@ class GroupsAPITestCase(test.TestCase): self.assertEqual(fields.ReplicationStatus.DISABLING, group.replication_status) - @mock.patch('cinder.volume.utils.is_replicated_spec', + @mock.patch('cinder.volume.volume_utils.is_replicated_spec', return_value=True) - @mock.patch('cinder.volume.utils.is_group_a_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_type', return_value=True) @ddt.data((mv.GROUP_REPLICATION, True, fields.GroupStatus.CREATING, @@ -1330,9 +1330,9 @@ class GroupsAPITestCase(test.TestCase): self.controller.disable_replication, req, group_id, body=body) - @mock.patch('cinder.volume.utils.is_replicated_spec', + @mock.patch('cinder.volume.volume_utils.is_replicated_spec', return_value=True) - @mock.patch('cinder.volume.utils.is_group_a_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_type', return_value=True) def test_failover_replication(self, mock_rep_grp_type, mock_rep_vol_type): req = fakes.HTTPRequest.blank('/v3/%s/groups/%s/action' % @@ -1352,9 +1352,9 @@ class GroupsAPITestCase(test.TestCase): self.assertEqual(fields.ReplicationStatus.FAILING_OVER, group.replication_status) - @mock.patch('cinder.volume.utils.is_replicated_spec', + @mock.patch('cinder.volume.volume_utils.is_replicated_spec', return_value=True) - @mock.patch('cinder.volume.utils.is_group_a_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_type', return_value=True) @ddt.data((mv.GROUP_REPLICATION, True, fields.GroupStatus.CREATING, @@ -1394,9 +1394,9 @@ class GroupsAPITestCase(test.TestCase): self.controller.failover_replication, req, group_id, body=body) - @mock.patch('cinder.volume.utils.is_replicated_spec', + @mock.patch('cinder.volume.volume_utils.is_replicated_spec', return_value=True) - @mock.patch('cinder.volume.utils.is_group_a_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_type', return_value=True) @mock.patch('cinder.volume.rpcapi.VolumeAPI.list_replication_targets') def test_list_replication_targets(self, mock_list_rep_targets, diff --git a/cinder/tests/unit/backup/drivers/test_backup_google.py b/cinder/tests/unit/backup/drivers/test_backup_google.py index a7a9edaa4..f88e32f46 100644 --- a/cinder/tests/unit/backup/drivers/test_backup_google.py +++ b/cinder/tests/unit/backup/drivers/test_backup_google.py @@ -180,7 +180,7 @@ class GoogleBackupDriverTestCase(test.TestCase): # Note(yikun): It mocks out the backup notifier to avoid to leak # notifications into other test. notify_patcher = mock.patch( - 'cinder.volume.utils.notify_about_backup_usage') + 'cinder.volume.volume_utils.notify_about_backup_usage') notify_patcher.start() self.addCleanup(notify_patcher.stop) diff --git a/cinder/tests/unit/backup/drivers/test_backup_nfs.py b/cinder/tests/unit/backup/drivers/test_backup_nfs.py index 5b0f538d4..f5ba3b128 100644 --- a/cinder/tests/unit/backup/drivers/test_backup_nfs.py +++ b/cinder/tests/unit/backup/drivers/test_backup_nfs.py @@ -71,7 +71,7 @@ class BackupNFSShareTestCase(test.TestCase): # Note(yikun): It mocks out the backup notifier to avoid to leak # notifications into other test. notify_patcher = mock.patch( - 'cinder.volume.utils.notify_about_backup_usage') + 'cinder.volume.volume_utils.notify_about_backup_usage') notify_patcher.start() self.addCleanup(notify_patcher.stop) @@ -257,7 +257,7 @@ class BackupNFSTestCase(test.TestCase): # Note(yikun): It mocks out the backup notifier to avoid to leak # notifications into other test. notify_patcher = mock.patch( - 'cinder.volume.utils.notify_about_backup_usage') + 'cinder.volume.volume_utils.notify_about_backup_usage') notify_patcher.start() self.addCleanup(notify_patcher.stop) diff --git a/cinder/tests/unit/backup/drivers/test_backup_swift.py b/cinder/tests/unit/backup/drivers/test_backup_swift.py index d89e92f4e..adae70313 100644 --- a/cinder/tests/unit/backup/drivers/test_backup_swift.py +++ b/cinder/tests/unit/backup/drivers/test_backup_swift.py @@ -126,7 +126,7 @@ class BackupSwiftTestCase(test.TestCase): self.size_volume_file += 1024 notify_patcher = mock.patch( - 'cinder.volume.utils.notify_about_backup_usage') + 'cinder.volume.volume_utils.notify_about_backup_usage') notify_patcher.start() self.addCleanup(notify_patcher.stop) diff --git a/cinder/tests/unit/backup/test_backup.py b/cinder/tests/unit/backup/test_backup.py index 3983a0d69..93a26da23 100644 --- a/cinder/tests/unit/backup/test_backup.py +++ b/cinder/tests/unit/backup/test_backup.py @@ -1009,7 +1009,7 @@ class BackupTestCase(BaseBackupTest): self.assertEqual('available', temp_vol['status']) self.assertEqual('fake_provider_id', temp_vol['provider_id']) - @mock.patch('cinder.volume.utils.notify_about_backup_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_backup_usage') def test_create_backup_with_notify(self, notify): """Test normal backup creation with notifications.""" vol_size = 1 @@ -1021,7 +1021,7 @@ class BackupTestCase(BaseBackupTest): self.assertEqual(2, notify.call_count) @mock.patch('cinder.volume.rpcapi.VolumeAPI.get_backup_device') - @mock.patch('cinder.volume.utils.clone_encryption_key') + @mock.patch('cinder.volume.volume_utils.clone_encryption_key') @mock.patch('cinder.utils.brick_get_connector_properties') def test_create_backup_encrypted_volume(self, mock_connector_properties, @@ -1049,7 +1049,7 @@ class BackupTestCase(BaseBackupTest): self.assertEqual(fake.UUID2, backup.encryption_key_id) @mock.patch('cinder.volume.rpcapi.VolumeAPI.get_backup_device') - @mock.patch('cinder.volume.utils.clone_encryption_key') + @mock.patch('cinder.volume.volume_utils.clone_encryption_key') @mock.patch('cinder.utils.brick_get_connector_properties') def test_create_backup_encrypted_volume_again(self, mock_connector_properties, @@ -1262,7 +1262,7 @@ class BackupTestCase(BaseBackupTest): backup = db.backup_get(self.ctxt, backup.id) self.assertEqual(fields.BackupStatus.AVAILABLE, backup['status']) - @mock.patch('cinder.volume.utils.notify_about_backup_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_backup_usage') def test_restore_backup_with_notify(self, notify): """Test normal backup restoration with notifications.""" vol_size = 1 @@ -1275,8 +1275,8 @@ class BackupTestCase(BaseBackupTest): self.backup_mgr.restore_backup(self.ctxt, backup, vol_id) self.assertEqual(2, notify.call_count) - @mock.patch('cinder.volume.utils.clone_encryption_key') - @mock.patch('cinder.volume.utils.delete_encryption_key') + @mock.patch('cinder.volume.volume_utils.clone_encryption_key') + @mock.patch('cinder.volume.volume_utils.delete_encryption_key') @mock.patch( 'cinder.tests.unit.backup.fake_service.FakeBackupService.restore') @mock.patch('cinder.utils.brick_get_connector_properties') @@ -1308,8 +1308,8 @@ class BackupTestCase(BaseBackupTest): mock_clone_encryption_key.assert_not_called() mock_delete_encryption_key.assert_not_called() - @mock.patch('cinder.volume.utils.clone_encryption_key') - @mock.patch('cinder.volume.utils.delete_encryption_key') + @mock.patch('cinder.volume.volume_utils.clone_encryption_key') + @mock.patch('cinder.volume.volume_utils.delete_encryption_key') @mock.patch( 'cinder.tests.unit.backup.fake_service.FakeBackupService.restore') @mock.patch('cinder.utils.brick_get_connector_properties') @@ -1369,8 +1369,8 @@ class BackupTestCase(BaseBackupTest): backup = db.backup_get(self.ctxt, backup.id) self.assertEqual(fake.UUID2, backup.encryption_key_id) - @mock.patch('cinder.volume.utils.clone_encryption_key') - @mock.patch('cinder.volume.utils.delete_encryption_key') + @mock.patch('cinder.volume.volume_utils.clone_encryption_key') + @mock.patch('cinder.volume.volume_utils.delete_encryption_key') @mock.patch( 'cinder.tests.unit.backup.fake_service.FakeBackupService.restore') @mock.patch('cinder.utils.brick_get_connector_properties') @@ -1506,7 +1506,7 @@ class BackupTestCase(BaseBackupTest): self.assertGreaterEqual(timeutils.utcnow(), backup.deleted_at) self.assertEqual(fields.BackupStatus.DELETED, backup.status) - @mock.patch('cinder.volume.utils.delete_encryption_key') + @mock.patch('cinder.volume.volume_utils.delete_encryption_key') def test_delete_backup_of_encrypted_volume(self, mock_delete_encryption_key): """Test deletion of backup of encrypted volume""" @@ -1525,7 +1525,7 @@ class BackupTestCase(BaseBackupTest): self.assertTrue(backup.deleted) self.assertIsNone(backup.encryption_key_id) - @mock.patch('cinder.volume.utils.notify_about_backup_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_backup_usage') def test_delete_backup_with_notify(self, notify): """Test normal backup deletion with notifications.""" vol_id = self._create_volume_db_entry(size=1) diff --git a/cinder/tests/unit/backup/test_chunkeddriver.py b/cinder/tests/unit/backup/test_chunkeddriver.py index 69ea4da85..73222c1f3 100644 --- a/cinder/tests/unit/backup/test_chunkeddriver.py +++ b/cinder/tests/unit/backup/test_chunkeddriver.py @@ -415,7 +415,7 @@ class ChunkedDriverTestCase(test.TestCase): metadata['volume-base-metadata']['display_name']) self.assertEqual('testhost', metadata['volume-base-metadata']['host']) - @mock.patch('cinder.volume.utils.notify_about_backup_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_backup_usage') def test_send_progress_end(self, mock_notify): obj_meta = {} self.driver._send_progress_end(self.ctxt, self.backup, obj_meta) @@ -423,7 +423,7 @@ class ChunkedDriverTestCase(test.TestCase): self.assertEqual(100, obj_meta.get('backup_percent', 0)) self.assertTrue(mock_notify.called) - @mock.patch('cinder.volume.utils.notify_about_backup_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_backup_usage') def test_send_progress_notification(self, mock_notify): obj_meta = {} self.driver._send_progress_notification( diff --git a/cinder/tests/unit/group/test_groups_manager.py b/cinder/tests/unit/group/test_groups_manager.py index 3e9a5ccdb..3c9939b06 100644 --- a/cinder/tests/unit/group/test_groups_manager.py +++ b/cinder/tests/unit/group/test_groups_manager.py @@ -35,7 +35,7 @@ from cinder.tests.unit import utils as tests_utils from cinder.volume import api as volume_api from cinder.volume import configuration as conf from cinder.volume import driver -from cinder.volume import utils as volutils +from cinder.volume import volume_utils GROUP_QUOTAS = quota.GROUP_QUOTAS CONF = cfg.CONF @@ -148,7 +148,7 @@ class GroupManagerTestCase(test.TestCase): """Make sure that the pool is part of the host.""" self.assertIn('host', group) host = group.host - pool = volutils.extract_host(host, level='pool') + pool = volume_utils.extract_host(host, level='pool') self.assertEqual('fakepool', pool) return {'status': fields.GroupStatus.AVAILABLE} diff --git a/cinder/tests/unit/group/test_groups_manager_replication.py b/cinder/tests/unit/group/test_groups_manager_replication.py index cf39d8b1d..1942ef3a6 100644 --- a/cinder/tests/unit/group/test_groups_manager_replication.py +++ b/cinder/tests/unit/group/test_groups_manager_replication.py @@ -29,7 +29,7 @@ from cinder.tests.unit import utils as tests_utils from cinder.volume import api as volume_api from cinder.volume import configuration as conf from cinder.volume import driver -from cinder.volume import utils as volutils +from cinder.volume import volume_utils GROUP_QUOTAS = quota.GROUP_QUOTAS CONF = cfg.CONF @@ -77,7 +77,7 @@ class GroupManagerTestCase(test.TestCase): """Make sure that the pool is part of the host.""" self.assertIn('host', group) host = group.host - pool = volutils.extract_host(host, level='pool') + pool = volume_utils.extract_host(host, level='pool') self.assertEqual('fakepool', pool) return {'status': fields.GroupStatus.AVAILABLE, 'replication_status': fields.ReplicationStatus.DISABLING} diff --git a/cinder/tests/unit/scheduler/fakes.py b/cinder/tests/unit/scheduler/fakes.py index 200761d15..c39304ca1 100644 --- a/cinder/tests/unit/scheduler/fakes.py +++ b/cinder/tests/unit/scheduler/fakes.py @@ -22,7 +22,7 @@ from oslo_utils import uuidutils from cinder.scheduler import filter_scheduler from cinder.scheduler import host_manager -from cinder.volume import utils +from cinder.volume import volume_utils as utils UTC_NOW = timeutils.utcnow() diff --git a/cinder/tests/unit/scheduler/test_allocated_capacity_weigher.py b/cinder/tests/unit/scheduler/test_allocated_capacity_weigher.py index f212f755f..4ed90fe99 100644 --- a/cinder/tests/unit/scheduler/test_allocated_capacity_weigher.py +++ b/cinder/tests/unit/scheduler/test_allocated_capacity_weigher.py @@ -24,7 +24,7 @@ from cinder import context from cinder.scheduler import weights from cinder import test from cinder.tests.unit.scheduler import fakes -from cinder.volume import utils +from cinder.volume import volume_utils as utils class AllocatedCapacityWeigherTestCase(test.TestCase): diff --git a/cinder/tests/unit/scheduler/test_capacity_weigher.py b/cinder/tests/unit/scheduler/test_capacity_weigher.py index ac0c7c101..f93e71481 100644 --- a/cinder/tests/unit/scheduler/test_capacity_weigher.py +++ b/cinder/tests/unit/scheduler/test_capacity_weigher.py @@ -25,7 +25,7 @@ from cinder import context from cinder.scheduler import weights from cinder import test from cinder.tests.unit.scheduler import fakes -from cinder.volume import utils +from cinder.volume import volume_utils as utils @ddt.ddt diff --git a/cinder/tests/unit/scheduler/test_filter_scheduler.py b/cinder/tests/unit/scheduler/test_filter_scheduler.py index 1fbf136cc..70a58856c 100644 --- a/cinder/tests/unit/scheduler/test_filter_scheduler.py +++ b/cinder/tests/unit/scheduler/test_filter_scheduler.py @@ -27,7 +27,7 @@ from cinder.scheduler import host_manager from cinder.tests.unit import fake_constants as fake from cinder.tests.unit.scheduler import fakes from cinder.tests.unit.scheduler import test_scheduler -from cinder.volume import utils +from cinder.volume import volume_utils as utils @ddt.ddt diff --git a/cinder/tests/unit/scheduler/test_volume_number_weigher.py b/cinder/tests/unit/scheduler/test_volume_number_weigher.py index 6aceaaab8..890571af2 100644 --- a/cinder/tests/unit/scheduler/test_volume_number_weigher.py +++ b/cinder/tests/unit/scheduler/test_volume_number_weigher.py @@ -25,11 +25,11 @@ from cinder.scheduler import weights from cinder import test from cinder.tests.unit import fake_constants from cinder.tests.unit.scheduler import fakes -from cinder.volume import utils +from cinder.volume import volume_utils def fake_volume_data_get_for_host(context, host, count_only=False): - host = utils.extract_host(host) + host = volume_utils.extract_host(host) if host == 'host1': return 1 elif host == 'host2': @@ -96,7 +96,7 @@ class VolumeNumberWeigherTestCase(test.TestCase): weighed_host = self._get_weighed_host(backend_info_list) self.assertEqual(0.0, weighed_host.weight) self.assertEqual('host1', - utils.extract_host(weighed_host.obj.host)) + volume_utils.extract_host(weighed_host.obj.host)) def test_volume_number_weight_multiplier2(self): self.flags(volume_number_multiplier=1.0) @@ -113,4 +113,4 @@ class VolumeNumberWeigherTestCase(test.TestCase): weighed_host = self._get_weighed_host(backend_info_list) self.assertEqual(1.0, weighed_host.weight) self.assertEqual('host5', - utils.extract_host(weighed_host.obj.host)) + volume_utils.extract_host(weighed_host.obj.host)) diff --git a/cinder/tests/unit/targets/test_scst_driver.py b/cinder/tests/unit/targets/test_scst_driver.py index 1e879d4fb..48e73b10d 100644 --- a/cinder/tests/unit/targets/test_scst_driver.py +++ b/cinder/tests/unit/targets/test_scst_driver.py @@ -16,7 +16,7 @@ from cinder import context from cinder.tests.unit.targets import targets_fixture as tf from cinder import utils from cinder.volume.targets import scst -from cinder.volume import utils as vutils +from cinder.volume import volume_utils as vutils class TestSCSTAdmDriver(tf.TargetDriverFixture): diff --git a/cinder/tests/unit/targets/test_tgt_driver.py b/cinder/tests/unit/targets/test_tgt_driver.py index 6397ded9c..99b20b748 100644 --- a/cinder/tests/unit/targets/test_tgt_driver.py +++ b/cinder/tests/unit/targets/test_tgt_driver.py @@ -23,7 +23,7 @@ from cinder import test from cinder.tests.unit.targets import targets_fixture as tf from cinder import utils from cinder.volume.targets import tgt -from cinder.volume import utils as vutils +from cinder.volume import volume_utils as vutils class TestTgtAdmDriver(tf.TargetDriverFixture): diff --git a/cinder/tests/unit/test_cmd.py b/cinder/tests/unit/test_cmd.py index e8ad2ff9d..bd4fccdf2 100644 --- a/cinder/tests/unit/test_cmd.py +++ b/cinder/tests/unit/test_cmd.py @@ -1800,7 +1800,7 @@ class TestCinderVolumeUsageAuditCmd(test.TestCase): rpc_init.assert_called_once_with(CONF) last_completed_audit_period.assert_called_once_with() - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') @mock.patch('cinder.objects.volume.VolumeList.get_all_active_by_window') @mock.patch('cinder.utils.last_completed_audit_period') @mock.patch('cinder.rpc.init') @@ -1866,7 +1866,7 @@ class TestCinderVolumeUsageAuditCmd(test.TestCase): extra_usage_info=local_extra_info) ]) - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') @mock.patch('cinder.objects.volume.VolumeList.get_all_active_by_window') @mock.patch('cinder.utils.last_completed_audit_period') @mock.patch('cinder.rpc.init') @@ -1940,10 +1940,10 @@ class TestCinderVolumeUsageAuditCmd(test.TestCase): extra_usage_info=local_extra_info_delete) ]) - @mock.patch('cinder.volume.utils.notify_about_snapshot_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_snapshot_usage') @mock.patch('cinder.objects.snapshot.SnapshotList.' 'get_all_active_by_window') - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') @mock.patch('cinder.objects.volume.VolumeList.get_all_active_by_window') @mock.patch('cinder.utils.last_completed_audit_period') @mock.patch('cinder.rpc.init') @@ -2017,9 +2017,9 @@ class TestCinderVolumeUsageAuditCmd(test.TestCase): extra_usage_info=local_extra_info_delete) ]) - @mock.patch('cinder.volume.utils.notify_about_backup_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_backup_usage') @mock.patch('cinder.objects.backup.BackupList.get_all_active_by_window') - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') @mock.patch('cinder.objects.volume.VolumeList.get_all_active_by_window') @mock.patch('cinder.utils.last_completed_audit_period') @mock.patch('cinder.rpc.init') @@ -2084,12 +2084,12 @@ class TestCinderVolumeUsageAuditCmd(test.TestCase): ctxt, backup1, 'delete.start', extra_usage_info=local_extra_info_delete) - @mock.patch('cinder.volume.utils.notify_about_backup_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_backup_usage') @mock.patch('cinder.objects.backup.BackupList.get_all_active_by_window') - @mock.patch('cinder.volume.utils.notify_about_snapshot_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_snapshot_usage') @mock.patch('cinder.objects.snapshot.SnapshotList.' 'get_all_active_by_window') - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') @mock.patch('cinder.objects.volume.VolumeList.get_all_active_by_window') @mock.patch('cinder.utils.last_completed_audit_period') @mock.patch('cinder.rpc.init') diff --git a/cinder/tests/unit/test_image_utils.py b/cinder/tests/unit/test_image_utils.py index c382de713..cb13dab5a 100644 --- a/cinder/tests/unit/test_image_utils.py +++ b/cinder/tests/unit/test_image_utils.py @@ -137,7 +137,7 @@ class TestConvertImage(test.TestCase): mock_info.return_value.virtual_size = 1048576 throttle = throttling.Throttle(prefix=['cgcmd']) - with mock.patch('cinder.volume.utils.check_for_odirect_support', + with mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=True): output = image_utils.convert_image(source, dest, out_format, throttle=throttle) @@ -149,7 +149,7 @@ class TestConvertImage(test.TestCase): mock_exec.reset_mock() - with mock.patch('cinder.volume.utils.check_for_odirect_support', + with mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=False): output = image_utils.convert_image(source, dest, out_format) @@ -170,7 +170,7 @@ class TestConvertImage(test.TestCase): mock_info.side_effect = ValueError throttle = throttling.Throttle(prefix=['cgcmd']) - with mock.patch('cinder.volume.utils.check_for_odirect_support', + with mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=True): output = image_utils.convert_image(source, dest, out_format, throttle=throttle) @@ -183,7 +183,7 @@ class TestConvertImage(test.TestCase): mock_exec.reset_mock() - with mock.patch('cinder.volume.utils.check_for_odirect_support', + with mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=False): output = image_utils.convert_image(source, dest, out_format) @@ -192,7 +192,7 @@ class TestConvertImage(test.TestCase): '-O', out_format, source, dest, run_as_root=True) - @mock.patch('cinder.volume.utils.check_for_odirect_support', + @mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=True) @mock.patch('cinder.image.image_utils.qemu_img_info') @mock.patch('cinder.utils.execute') @@ -217,7 +217,7 @@ class TestConvertImage(test.TestCase): source, dest, run_as_root=True) - @mock.patch('cinder.volume.utils.check_for_odirect_support', + @mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=True) @mock.patch('cinder.image.image_utils.qemu_img_info') @mock.patch('cinder.utils.execute') @@ -253,7 +253,7 @@ class TestConvertImage(test.TestCase): out_format = mock.sentinel.out_format mock_info.return_value.virtual_size = 1048576 - with mock.patch('cinder.volume.utils.check_for_odirect_support', + with mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=True): output = image_utils.convert_image(source, dest, out_format, src_format='AMI') @@ -266,7 +266,7 @@ class TestConvertImage(test.TestCase): @mock.patch('cinder.image.image_utils.qemu_img_info') @mock.patch('cinder.utils.execute') @mock.patch('cinder.utils.is_blk_device', return_value=False) - @mock.patch('cinder.volume.utils.check_for_odirect_support') + @mock.patch('cinder.volume.volume_utils.check_for_odirect_support') def test_convert_to_vhd(self, mock_check_odirect, mock_isblk, mock_exec, mock_info): source = mock.sentinel.source @@ -307,7 +307,7 @@ class TestConvertImage(test.TestCase): run_as_root=True) @mock.patch('cinder.image.image_utils.CONF') - @mock.patch('cinder.volume.utils.check_for_odirect_support', + @mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=True) @mock.patch('cinder.image.image_utils.qemu_img_info') @mock.patch('cinder.utils.execute') diff --git a/cinder/tests/unit/test_macrosan_drivers.py b/cinder/tests/unit/test_macrosan_drivers.py index 9762b8098..27e684b94 100644 --- a/cinder/tests/unit/test_macrosan_drivers.py +++ b/cinder/tests/unit/test_macrosan_drivers.py @@ -26,8 +26,8 @@ from cinder.volume import configuration as conf from cinder.volume.drivers.macrosan import devop_client from cinder.volume.drivers.macrosan import driver from cinder.volume import qos_specs -from cinder.volume import utils as volutils from cinder.volume import volume_types +from cinder.volume import volume_utils as volutils test_volume = ( diff --git a/cinder/tests/unit/test_utils.py b/cinder/tests/unit/test_utils.py index 57b6e3c47..61de7f2da 100644 --- a/cinder/tests/unit/test_utils.py +++ b/cinder/tests/unit/test_utils.py @@ -33,7 +33,7 @@ from cinder import exception from cinder import test from cinder.tests.unit import fake_constants as fake from cinder import utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils POOL_CAPS = {'total_capacity_gb': 0, 'free_capacity_gb': 0, diff --git a/cinder/tests/unit/test_volume_cleanup.py b/cinder/tests/unit/test_volume_cleanup.py index 190e9ea15..9ae3c455d 100644 --- a/cinder/tests/unit/test_volume_cleanup.py +++ b/cinder/tests/unit/test_volume_cleanup.py @@ -37,7 +37,7 @@ class VolumeCleanupTestCase(base.BaseVolumeTestCase): super(VolumeCleanupTestCase, self).setUp() self.service_id = 1 self.mock_object(service.Service, 'service_id', self.service_id) - self.patch('cinder.volume.utils.clear_volume', autospec=True) + self.patch('cinder.volume.volume_utils.clear_volume', autospec=True) def _assert_workers_are_removed(self): workers = db.worker_get_all(self.context, read_deleted='yes') diff --git a/cinder/tests/unit/test_volume_transfer.py b/cinder/tests/unit/test_volume_transfer.py index 5d4084a88..5b5428f08 100644 --- a/cinder/tests/unit/test_volume_transfer.py +++ b/cinder/tests/unit/test_volume_transfer.py @@ -40,7 +40,7 @@ class VolumeTransferTestCase(test.TestCase): project_id=fake.PROJECT_ID) self.updated_at = timeutils.utcnow() - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') def test_transfer_volume_create_delete(self, mock_notify): tx_api = transfer_api.API() volume = utils.create_volume(self.ctxt, updated_at=self.updated_at) @@ -81,7 +81,7 @@ class VolumeTransferTestCase(test.TestCase): tx_api.create, self.ctxt, volume.id, 'Description') - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') def test_transfer_accept_invalid_authkey(self, mock_notify): svc = self.start_service('volume', host='test_host') self.addCleanup(svc.stop) @@ -100,7 +100,7 @@ class VolumeTransferTestCase(test.TestCase): tx_api.accept, self.ctxt, transfer['id'], 'wrong') - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') def test_transfer_accept_invalid_volume(self, mock_notify): svc = self.start_service('volume', host='test_host') self.addCleanup(svc.stop) @@ -130,7 +130,7 @@ class VolumeTransferTestCase(test.TestCase): mock_notify.assert_has_calls(calls) self.assertEqual(3, mock_notify.call_count) - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') def test_transfer_accept_volume_in_consistencygroup(self, mock_notify): svc = self.start_service('volume', host='test_host') self.addCleanup(svc.stop) @@ -149,7 +149,7 @@ class VolumeTransferTestCase(test.TestCase): @mock.patch.object(QUOTAS, "limit_check") @mock.patch.object(QUOTAS, "reserve") @mock.patch.object(QUOTAS, "add_volume_type_opts") - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') def test_transfer_accept(self, mock_notify, mock_quota_voltype, mock_quota_reserve, mock_quota_limit): svc = self.start_service('volume', host='test_host') @@ -203,7 +203,7 @@ class VolumeTransferTestCase(test.TestCase): @mock.patch.object(QUOTAS, "reserve") @mock.patch.object(QUOTAS, "add_volume_type_opts") - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') def test_transfer_accept_over_quota(self, mock_notify, mock_quota_voltype, mock_quota_reserve): svc = self.start_service('volume', host='test_host') @@ -236,7 +236,7 @@ class VolumeTransferTestCase(test.TestCase): self.assertEqual(2, mock_notify.call_count) @mock.patch.object(QUOTAS, "limit_check") - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') def test_transfer_accept_over_quota_check_limit(self, mock_notify, mock_quota_limit): svc = self.start_service('volume', host='test_host') @@ -287,7 +287,7 @@ class VolumeTransferTestCase(test.TestCase): ts = tx_api.get_all(nctxt) self.assertEqual(0, len(ts), 'Unexpected transfers listed.') - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') def test_delete_transfer_with_deleted_volume(self, mock_notify): # create a volume volume = utils.create_volume(self.ctxt, updated_at=self.updated_at) @@ -309,7 +309,7 @@ class VolumeTransferTestCase(test.TestCase): self.ctxt, transfer['id']) - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') def test_transfer_accept_with_snapshots(self, mock_notify): svc = self.start_service('volume', host='test_host') self.addCleanup(svc.stop) @@ -350,7 +350,7 @@ class VolumeTransferTestCase(test.TestCase): self.assertEqual(1, usages.get('volumes', {}).get('in_use', 0)) self.assertEqual(1, usages.get('snapshots', {}).get('in_use', 0)) - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') def test_transfer_accept_with_snapshots_invalid(self, mock_notify): svc = self.start_service('volume', host='test_host') self.addCleanup(svc.stop) @@ -364,7 +364,7 @@ class VolumeTransferTestCase(test.TestCase): self.assertRaises(exception.InvalidSnapshot, tx_api.create, self.ctxt, volume.id, 'Description') - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') def test_transfer_accept_with_detail_records(self, mock_notify): svc = self.start_service('volume', host='test_host') self.addCleanup(svc.stop) diff --git a/cinder/tests/unit/test_volume_utils.py b/cinder/tests/unit/test_volume_utils.py index 2470b1c7a..cc18ba8e8 100644 --- a/cinder/tests/unit/test_volume_utils.py +++ b/cinder/tests/unit/test_volume_utils.py @@ -42,17 +42,17 @@ from cinder.tests.unit.image import fake as fake_image from cinder.tests.unit import utils as test_utils from cinder import utils from cinder.volume import throttling -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils CONF = cfg.CONF class NotifyUsageTestCase(test.TestCase): - @mock.patch('cinder.volume.utils._usage_from_volume') - @mock.patch('cinder.volume.utils.CONF') - @mock.patch('cinder.volume.utils.rpc') + @mock.patch('cinder.volume.volume_utils._usage_from_volume') + @mock.patch('cinder.volume.volume_utils.CONF') + @mock.patch('cinder.volume.volume_utils.rpc') def test_notify_about_volume_usage(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' output = volume_utils.notify_about_volume_usage(mock.sentinel.context, @@ -67,9 +67,9 @@ class NotifyUsageTestCase(test.TestCase): 'volume.test_suffix', mock_usage.return_value) - @mock.patch('cinder.volume.utils._usage_from_volume') - @mock.patch('cinder.volume.utils.CONF') - @mock.patch('cinder.volume.utils.rpc') + @mock.patch('cinder.volume.volume_utils._usage_from_volume') + @mock.patch('cinder.volume.volume_utils.CONF') + @mock.patch('cinder.volume.volume_utils.rpc') def test_notify_about_volume_usage_with_kwargs(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' @@ -88,9 +88,9 @@ class NotifyUsageTestCase(test.TestCase): 'volume.test_suffix', mock_usage.return_value) - @mock.patch('cinder.volume.utils._usage_from_snapshot') - @mock.patch('cinder.volume.utils.CONF') - @mock.patch('cinder.volume.utils.rpc') + @mock.patch('cinder.volume.volume_utils._usage_from_snapshot') + @mock.patch('cinder.volume.volume_utils.CONF') + @mock.patch('cinder.volume.volume_utils.rpc') def test_notify_about_snapshot_usage(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' @@ -107,9 +107,9 @@ class NotifyUsageTestCase(test.TestCase): 'snapshot.test_suffix', mock_usage.return_value) - @mock.patch('cinder.volume.utils._usage_from_snapshot') - @mock.patch('cinder.volume.utils.CONF') - @mock.patch('cinder.volume.utils.rpc') + @mock.patch('cinder.volume.volume_utils._usage_from_snapshot') + @mock.patch('cinder.volume.volume_utils.CONF') + @mock.patch('cinder.volume.volume_utils.rpc') def test_notify_about_snapshot_usage_with_kwargs(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' @@ -265,9 +265,9 @@ class NotifyUsageTestCase(test.TestCase): } self.assertEqual(expected_volume, usage_info) - @mock.patch('cinder.volume.utils._usage_from_consistencygroup') - @mock.patch('cinder.volume.utils.CONF') - @mock.patch('cinder.volume.utils.rpc') + @mock.patch('cinder.volume.volume_utils._usage_from_consistencygroup') + @mock.patch('cinder.volume.volume_utils.CONF') + @mock.patch('cinder.volume.volume_utils.rpc') def test_notify_about_consistencygroup_usage(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' @@ -284,9 +284,9 @@ class NotifyUsageTestCase(test.TestCase): 'consistencygroup.test_suffix', mock_usage.return_value) - @mock.patch('cinder.volume.utils._usage_from_consistencygroup') - @mock.patch('cinder.volume.utils.CONF') - @mock.patch('cinder.volume.utils.rpc') + @mock.patch('cinder.volume.volume_utils._usage_from_consistencygroup') + @mock.patch('cinder.volume.volume_utils.CONF') + @mock.patch('cinder.volume.volume_utils.rpc') def test_notify_about_consistencygroup_usage_with_kwargs(self, mock_rpc, mock_conf, mock_usage): @@ -307,9 +307,9 @@ class NotifyUsageTestCase(test.TestCase): 'consistencygroup.test_suffix', mock_usage.return_value) - @mock.patch('cinder.volume.utils._usage_from_cgsnapshot') - @mock.patch('cinder.volume.utils.CONF') - @mock.patch('cinder.volume.utils.rpc') + @mock.patch('cinder.volume.volume_utils._usage_from_cgsnapshot') + @mock.patch('cinder.volume.volume_utils.CONF') + @mock.patch('cinder.volume.volume_utils.rpc') def test_notify_about_cgsnapshot_usage(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' @@ -325,9 +325,9 @@ class NotifyUsageTestCase(test.TestCase): 'cgsnapshot.test_suffix', mock_usage.return_value) - @mock.patch('cinder.volume.utils._usage_from_cgsnapshot') - @mock.patch('cinder.volume.utils.CONF') - @mock.patch('cinder.volume.utils.rpc') + @mock.patch('cinder.volume.volume_utils._usage_from_cgsnapshot') + @mock.patch('cinder.volume.volume_utils.CONF') + @mock.patch('cinder.volume.volume_utils.rpc') def test_notify_about_cgsnapshot_usage_with_kwargs(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' @@ -404,9 +404,9 @@ class LVMVolumeDriverTestCase(test.TestCase): bs = volume_utils._check_blocksize('ABM') self.assertEqual('1M', bs) - @mock.patch('cinder.volume.utils._usage_from_capacity') - @mock.patch('cinder.volume.utils.CONF') - @mock.patch('cinder.volume.utils.rpc') + @mock.patch('cinder.volume.volume_utils._usage_from_capacity') + @mock.patch('cinder.volume.volume_utils.CONF') + @mock.patch('cinder.volume.volume_utils.rpc') def test_notify_about_capacity_usage(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' @@ -422,9 +422,9 @@ class LVMVolumeDriverTestCase(test.TestCase): 'capacity.test_suffix', mock_usage.return_value) - @mock.patch('cinder.volume.utils._usage_from_capacity') - @mock.patch('cinder.volume.utils.CONF') - @mock.patch('cinder.volume.utils.rpc') + @mock.patch('cinder.volume.volume_utils._usage_from_capacity') + @mock.patch('cinder.volume.volume_utils.CONF') + @mock.patch('cinder.volume.volume_utils.rpc') def test_notify_about_capacity_usage_with_kwargs(self, mock_rpc, mock_conf, mock_usage): mock_conf.host = 'host1' @@ -518,8 +518,8 @@ class OdirectSupportTestCase(test.TestCase): class ClearVolumeTestCase(test.TestCase): - @mock.patch('cinder.volume.utils.copy_volume', return_value=None) - @mock.patch('cinder.volume.utils.CONF') + @mock.patch('cinder.volume.volume_utils.copy_volume', return_value=None) + @mock.patch('cinder.volume.volume_utils.CONF') def test_clear_volume_conf(self, mock_conf, mock_copy): mock_conf.volume_clear = 'zero' mock_conf.volume_clear_size = 0 @@ -532,8 +532,8 @@ class ClearVolumeTestCase(test.TestCase): execute=utils.execute, ionice='-c3', throttle=None, sparse=False) - @mock.patch('cinder.volume.utils.copy_volume', return_value=None) - @mock.patch('cinder.volume.utils.CONF') + @mock.patch('cinder.volume.volume_utils.copy_volume', return_value=None) + @mock.patch('cinder.volume.volume_utils.CONF') def test_clear_volume_args(self, mock_conf, mock_copy): mock_conf.volume_clear = 'should_override_with_arg' mock_conf.volume_clear_size = 0 @@ -547,7 +547,7 @@ class ClearVolumeTestCase(test.TestCase): execute=utils.execute, ionice='-c0', throttle=None, sparse=False) - @mock.patch('cinder.volume.utils.CONF') + @mock.patch('cinder.volume.volume_utils.CONF') def test_clear_volume_invalid_opt(self, mock_conf): mock_conf.volume_clear = 'non_existent_volume_clearer' mock_conf.volume_clear_size = 0 @@ -558,10 +558,10 @@ class ClearVolumeTestCase(test.TestCase): class CopyVolumeTestCase(test.TestCase): - @mock.patch('cinder.volume.utils.check_for_odirect_support', + @mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=True) @mock.patch('cinder.utils.execute') - @mock.patch('cinder.volume.utils.CONF') + @mock.patch('cinder.volume.volume_utils.CONF') def test_copy_volume_dd_iflag_and_oflag(self, mock_conf, mock_exec, mock_support): fake_throttle = throttling.Throttle(['fake_throttle']) @@ -589,7 +589,7 @@ class CopyVolumeTestCase(test.TestCase): 'bs=3M', 'iflag=count_bytes,direct', 'oflag=direct', run_as_root=True) - @mock.patch('cinder.volume.utils.check_for_odirect_support', + @mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=False) @mock.patch('cinder.utils.execute') def test_copy_volume_dd_no_iflag_or_oflag(self, mock_exec, mock_support): @@ -618,7 +618,7 @@ class CopyVolumeTestCase(test.TestCase): 'bs=3M', 'iflag=count_bytes', run_as_root=True) - @mock.patch('cinder.volume.utils.check_for_odirect_support', + @mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=False) @mock.patch('cinder.utils.execute') def test_copy_volume_dd_no_throttle(self, mock_exec, mock_support): @@ -631,7 +631,7 @@ class CopyVolumeTestCase(test.TestCase): 'iflag=count_bytes', 'conv=fdatasync', run_as_root=True) - @mock.patch('cinder.volume.utils.check_for_odirect_support', + @mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=False) @mock.patch('cinder.utils.execute') def test_copy_volume_dd_with_ionice(self, mock_exec, mock_support): @@ -645,7 +645,7 @@ class CopyVolumeTestCase(test.TestCase): 'iflag=count_bytes', 'conv=fdatasync', run_as_root=True) - @mock.patch('cinder.volume.utils.check_for_odirect_support', + @mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=False) @mock.patch('cinder.utils.execute') def test_copy_volume_dd_with_sparse(self, mock_exec, mock_support): @@ -659,7 +659,7 @@ class CopyVolumeTestCase(test.TestCase): 'conv=fdatasync,sparse', run_as_root=True) - @mock.patch('cinder.volume.utils.check_for_odirect_support', + @mock.patch('cinder.volume.volume_utils.check_for_odirect_support', return_value=True) @mock.patch('cinder.utils.execute') def test_copy_volume_dd_with_sparse_iflag_and_oflag(self, mock_exec, @@ -674,7 +674,7 @@ class CopyVolumeTestCase(test.TestCase): 'oflag=direct', 'conv=sparse', run_as_root=True) - @mock.patch('cinder.volume.utils._copy_volume_with_file') + @mock.patch('cinder.volume.volume_utils._copy_volume_with_file') def test_copy_volume_handles(self, mock_copy): handle1 = io.RawIOBase() handle2 = io.RawIOBase() @@ -682,8 +682,8 @@ class CopyVolumeTestCase(test.TestCase): self.assertIsNone(output) mock_copy.assert_called_once_with(handle1, handle2, 1024) - @mock.patch('cinder.volume.utils._transfer_data') - @mock.patch('cinder.volume.utils._open_volume_with_path') + @mock.patch('cinder.volume.volume_utils._transfer_data') + @mock.patch('cinder.volume.volume_utils._open_volume_with_path') def test_copy_volume_handle_transfer(self, mock_open, mock_transfer): handle = io.RawIOBase() output = volume_utils.copy_volume('/foo/bar', handle, 1024, 1) @@ -737,7 +737,7 @@ class VolumeUtilsTestCase(test.TestCase): self.assertEqual(16, len(password)) self.assertEqual(10, len(volume_utils.generate_password(10))) - @mock.patch('cinder.volume.utils.generate_password') + @mock.patch('cinder.volume.volume_utils.generate_password') def test_generate_username(self, mock_gen_pass): output = volume_utils.generate_username() self.assertEqual(mock_gen_pass.return_value, output) @@ -840,7 +840,7 @@ class VolumeUtilsTestCase(test.TestCase): host_2 = 'fake_host2@backend1' self.assertFalse(volume_utils.hosts_are_equivalent(host_1, host_2)) - @mock.patch('cinder.volume.utils.CONF') + @mock.patch('cinder.volume.volume_utils.CONF') def test_extract_id_from_volume_name_vol_id_pattern(self, conf_mock): conf_mock.volume_name_template = 'volume-%s' vol_id = 'd8cd1feb-2dcc-404d-9b15-b86fe3bec0a1' @@ -848,7 +848,7 @@ class VolumeUtilsTestCase(test.TestCase): result = volume_utils.extract_id_from_volume_name(vol_name) self.assertEqual(vol_id, result) - @mock.patch('cinder.volume.utils.CONF') + @mock.patch('cinder.volume.volume_utils.CONF') def test_extract_id_from_volume_name_vol_id_vol_pattern(self, conf_mock): conf_mock.volume_name_template = 'volume-%s-volume' vol_id = 'd8cd1feb-2dcc-404d-9b15-b86fe3bec0a1' @@ -856,7 +856,7 @@ class VolumeUtilsTestCase(test.TestCase): result = volume_utils.extract_id_from_volume_name(vol_name) self.assertEqual(vol_id, result) - @mock.patch('cinder.volume.utils.CONF') + @mock.patch('cinder.volume.volume_utils.CONF') def test_extract_id_from_volume_name_id_vol_pattern(self, conf_mock): conf_mock.volume_name_template = '%s-volume' vol_id = 'd8cd1feb-2dcc-404d-9b15-b86fe3bec0a1' @@ -864,7 +864,7 @@ class VolumeUtilsTestCase(test.TestCase): result = volume_utils.extract_id_from_volume_name(vol_name) self.assertEqual(vol_id, result) - @mock.patch('cinder.volume.utils.CONF') + @mock.patch('cinder.volume.volume_utils.CONF') def test_extract_id_from_volume_name_no_match(self, conf_mock): conf_mock.volume_name_template = '%s-volume' vol_name = 'd8cd1feb-2dcc-404d-9b15-b86fe3bec0a1' @@ -894,7 +894,7 @@ class VolumeUtilsTestCase(test.TestCase): result = volume_utils.check_already_managed_volume('not-a-uuid') self.assertFalse(result) - @mock.patch('cinder.volume.utils.CONF') + @mock.patch('cinder.volume.volume_utils.CONF') def test_extract_id_from_snapshot_name(self, conf_mock): conf_mock.snapshot_name_template = '%s-snapshot' snap_id = 'd8cd1feb-2dcc-404d-9b15-b86fe3bec0a1' @@ -902,7 +902,7 @@ class VolumeUtilsTestCase(test.TestCase): result = volume_utils.extract_id_from_snapshot_name(snap_name) self.assertEqual(snap_id, result) - @mock.patch('cinder.volume.utils.CONF') + @mock.patch('cinder.volume.volume_utils.CONF') def test_extract_id_from_snapshot_name_no_match(self, conf_mock): conf_mock.snapshot_name_template = '%s-snapshot' snap_name = 'd8cd1feb-2dcc-404d-9b15-b86fe3bec0a1' diff --git a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py index 1b2b42f83..55cf671a5 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py @@ -33,7 +33,7 @@ from cinder.volume.drivers.dell_emc.powermax import masking from cinder.volume.drivers.dell_emc.powermax import provision from cinder.volume.drivers.dell_emc.powermax import rest from cinder.volume.drivers.dell_emc.powermax import utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils class PowerMaxCommonTest(test.TestCase): diff --git a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_fc.py b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_fc.py index b2baf341a..e7cedf418 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_fc.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_fc.py @@ -23,7 +23,7 @@ from cinder.tests.unit.volume.drivers.dell_emc.powermax import ( from cinder.volume.drivers.dell_emc.powermax import common from cinder.volume.drivers.dell_emc.powermax import fc from cinder.volume.drivers.dell_emc.powermax import rest -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils from cinder.zonemanager import utils as fczm_utils diff --git a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_iscsi.py b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_iscsi.py index 618db5910..1a7cdaefa 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_iscsi.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_iscsi.py @@ -25,7 +25,7 @@ from cinder.tests.unit.volume.drivers.dell_emc.powermax import ( powermax_fake_objects as tpfo) from cinder.volume.drivers.dell_emc.powermax import iscsi from cinder.volume.drivers.dell_emc.powermax import rest -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils class PowerMaxISCSITest(test.TestCase): diff --git a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_masking.py b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_masking.py index c8870072b..89a771620 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_masking.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_masking.py @@ -27,7 +27,7 @@ from cinder.volume.drivers.dell_emc.powermax import masking from cinder.volume.drivers.dell_emc.powermax import provision from cinder.volume.drivers.dell_emc.powermax import rest from cinder.volume.drivers.dell_emc.powermax import utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils class PowerMaxMaskingTest(test.TestCase): diff --git a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_provision.py b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_provision.py index 537a834a5..f0398f68b 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_provision.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_provision.py @@ -28,7 +28,7 @@ from cinder.volume.drivers.dell_emc.powermax import iscsi from cinder.volume.drivers.dell_emc.powermax import provision from cinder.volume.drivers.dell_emc.powermax import rest from cinder.volume.drivers.dell_emc.powermax import utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils class PowerMaxProvisionTest(test.TestCase): diff --git a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_replication.py b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_replication.py index f045bad61..55ad9c004 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_replication.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_replication.py @@ -35,7 +35,7 @@ from cinder.volume.drivers.dell_emc.powermax import masking from cinder.volume.drivers.dell_emc.powermax import provision from cinder.volume.drivers.dell_emc.powermax import rest from cinder.volume.drivers.dell_emc.powermax import utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils class PowerMaxReplicationTest(test.TestCase): diff --git a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_rest.py b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_rest.py index 859c26e15..6ec327a4d 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_rest.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_rest.py @@ -29,7 +29,7 @@ from cinder.tests.unit.volume.drivers.dell_emc.powermax import ( from cinder.volume.drivers.dell_emc.powermax import fc from cinder.volume.drivers.dell_emc.powermax import rest from cinder.volume.drivers.dell_emc.powermax import utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils class PowerMaxRestTest(test.TestCase): diff --git a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_utils.py b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_utils.py index 0cfe70370..4510c6a18 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_utils.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_utils.py @@ -31,8 +31,8 @@ from cinder.tests.unit.volume.drivers.dell_emc.powermax import ( from cinder.volume.drivers.dell_emc.powermax import iscsi from cinder.volume.drivers.dell_emc.powermax import rest from cinder.volume.drivers.dell_emc.powermax import utils -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils @ddt diff --git a/cinder/tests/unit/volume/drivers/dell_emc/sc/test_sc.py b/cinder/tests/unit/volume/drivers/dell_emc/sc/test_sc.py index 4f2bc9ae8..1b70dad94 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/sc/test_sc.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/sc/test_sc.py @@ -2415,7 +2415,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): @mock.patch.object(storagecenter_api.SCApi, 'create_replay_profile', return_value=SCRPLAYPROFILE) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group(self, mock_is_cg, @@ -2429,7 +2429,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): mock_create_replay_profile.assert_called_once_with(fake.GROUP_ID) self.assertEqual({'status': 'available'}, model_update) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=False) def test_create_group_not_a_cg(self, mock_is_cg, @@ -2444,7 +2444,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): @mock.patch.object(storagecenter_api.SCApi, 'create_replay_profile', return_value=None) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group_fail(self, mock_is_cg, @@ -2465,7 +2465,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): return_value=SCRPLAYPROFILE) @mock.patch.object(storagecenter_iscsi.SCISCSIDriver, 'delete_volume') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_delete_group(self, mock_is_cg, @@ -2489,7 +2489,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): self.assertEqual(group['status'], model_update['status']) self.assertEqual(expected_volumes, volumes) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=False) def test_delete_group_not_a_cg( self, mock_is_cg, mock_close_connection, @@ -2509,7 +2509,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): return_value=None) @mock.patch.object(storagecenter_iscsi.SCISCSIDriver, 'delete_volume') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_delete_group_not_found(self, mock_is_cg, @@ -2535,7 +2535,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): @mock.patch.object(storagecenter_api.SCApi, 'find_replay_profile', return_value=SCRPLAYPROFILE) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_update_group(self, mock_is_cg, @@ -2558,7 +2558,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): self.assertIsNone(rt2) self.assertIsNone(rt3) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=False) def test_update_group_not_a_cg(self, mock_is_cg, @@ -2575,7 +2575,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): @mock.patch.object(storagecenter_api.SCApi, 'find_replay_profile', return_value=None) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_update_group_not_found(self, mock_is_cg, @@ -2601,7 +2601,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): @mock.patch.object(storagecenter_api.SCApi, 'find_replay_profile', return_value=SCRPLAYPROFILE) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_update_group_error(self, mock_is_cg, @@ -2631,7 +2631,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): 'create_group') @mock.patch.object(storagecenter_iscsi.SCISCSIDriver, 'create_cloned_volume') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group_from_src( self, mock_is_cg, mock_create_cloned_volume, mock_create_group, @@ -2662,7 +2662,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): 'create_group') @mock.patch.object(storagecenter_iscsi.SCISCSIDriver, 'create_volume_from_snapshot') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group_from_src_from_snapshot( self, mock_is_cg, mock_create_volume_from_snapshot, @@ -2699,7 +2699,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): self.driver.create_group_from_src, context, group, volumes, None, None, None, None) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=False) def test_create_group_from_src_not_a_cg( self, mock_is_cg, mock_close_connection, @@ -2720,7 +2720,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): @mock.patch.object(storagecenter_api.SCApi, 'find_replay_profile', return_value=SCRPLAYPROFILE) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group_snapshot(self, mock_is_cg, @@ -2747,7 +2747,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): @mock.patch.object(storagecenter_api.SCApi, 'find_replay_profile', return_value=None) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group_snapshot_profile_not_found(self, mock_is_cg, @@ -2764,7 +2764,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): mock_find_replay_profile.assert_called_once_with(fake.GROUP_ID) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=False) def test_create_group_snapshot_not_a_cg( self, mock_is_cg, mock_close_connection, @@ -2781,7 +2781,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): @mock.patch.object(storagecenter_api.SCApi, 'find_replay_profile', return_value=SCRPLAYPROFILE) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group_snapshot_fail(self, mock_is_cg, @@ -2806,7 +2806,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): @mock.patch.object(storagecenter_api.SCApi, 'find_replay_profile', return_value=SCRPLAYPROFILE) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_delete_group_snapshot(self, mock_is_cg, @@ -2833,7 +2833,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): @mock.patch.object(storagecenter_api.SCApi, 'find_replay_profile', return_value=None) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_delete_group_snapshot_profile_not_found(self, mock_is_cg, @@ -2859,7 +2859,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): @mock.patch.object(storagecenter_api.SCApi, 'find_replay_profile', return_value=SCRPLAYPROFILE) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_delete_group_snapshot_profile_failed_delete( self, mock_is_cg, mock_find_replay_profile, mock_delete_cg_replay, @@ -2874,7 +2874,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): mock_delete_cg_replay.assert_called_once_with(self.SCRPLAYPROFILE, fake.GROUP_SNAPSHOT_ID) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=False) def test_delete_group_snapshot_not_a_cg( self, mock_is_cg, mock_close_connection, diff --git a/cinder/tests/unit/volume/drivers/dell_emc/unity/test_adapter.py b/cinder/tests/unit/volume/drivers/dell_emc/unity/test_adapter.py index bf3c7a89a..3410890d8 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/unity/test_adapter.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/unity/test_adapter.py @@ -351,7 +351,7 @@ def patch_dd_copy(copied_lun): @contextlib.contextmanager def patch_copy_volume(): - with mock.patch('cinder.volume.utils.copy_volume') as mocked: + with mock.patch('cinder.volume.volume_utils.copy_volume') as mocked: yield mocked diff --git a/cinder/tests/unit/volume/drivers/dell_emc/unity/test_driver.py b/cinder/tests/unit/volume/drivers/dell_emc/unity/test_driver.py index 6b2eedc58..8dc06f47d 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/unity/test_driver.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/unity/test_driver.py @@ -144,7 +144,7 @@ class MockAdapter(object): patch_check_cg = mock.patch( - 'cinder.volume.utils.is_group_a_cg_snapshot_type', + 'cinder.volume.volume_utils.is_group_a_cg_snapshot_type', side_effect=lambda g: not g.id.endswith('_generic')) diff --git a/cinder/tests/unit/volume/drivers/dell_emc/vxflexos/test_get_manageable.py b/cinder/tests/unit/volume/drivers/dell_emc/vxflexos/test_get_manageable.py index 9a8c2aa4d..e933bcf7d 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/vxflexos/test_get_manageable.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/vxflexos/test_get_manageable.py @@ -136,7 +136,8 @@ class VxFlexOSManageableCase(vxflexos.TestVxFlexOSDriver): } - with mock.patch('cinder.volume.utils.paginate_entries_list') as mpage: + with mock.patch('cinder.volume.volume_utils.' + 'paginate_entries_list') as mpage: test_func = self.driver.get_manageable_volumes test_func(cinder_objs, marker, limit, offset, sort_keys, sort_dirs) mpage.assert_called_once_with( diff --git a/cinder/tests/unit/volume/drivers/dell_emc/vxflexos/test_groups.py b/cinder/tests/unit/volume/drivers/dell_emc/vxflexos/test_groups.py index 73854c76f..14b6e6b0f 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/vxflexos/test_groups.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/vxflexos/test_groups.py @@ -110,7 +110,7 @@ class TestGroups(vxflexos.TestVxFlexOSDriver): }, } - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group(self, is_group_a_cg_snapshot_type): """Test group create. @@ -126,7 +126,7 @@ class TestGroups(vxflexos.TestVxFlexOSDriver): self.assertEqual(fields.GroupStatus.AVAILABLE, model_update['status']) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group(self, is_group_a_cg_snapshot_type): """Test group deletion. @@ -145,7 +145,7 @@ class TestGroups(vxflexos.TestVxFlexOSDriver): self.assertEqual(fields.GroupStatus.DELETED, model_update[0]['status']) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_update_group(self, is_group_a_cg_snapshot_type): """Test updating a group @@ -163,7 +163,7 @@ class TestGroups(vxflexos.TestVxFlexOSDriver): self.assertIsNone(add_up) self.assertIsNone(remove_up) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_from_src_group(self, is_group_a_cg_snapshot_type): """Test creating group from source group @@ -191,7 +191,7 @@ class TestGroups(vxflexos.TestVxFlexOSDriver): volume_provider_list = list(map(get_pid, result_volumes_model_update)) self.assertListEqual(volume_provider_list, ['sid1', 'sid2']) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_from_src_snapshot(self, is_group_a_cg_snapshot_type): """Test creating group from snapshot @@ -218,7 +218,7 @@ class TestGroups(vxflexos.TestVxFlexOSDriver): volume_provider_list = list(map(get_pid, result_volumes_model_update)) self.assertListEqual(volume_provider_list, ['sid1', 'sid2']) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group_snapshot(self, is_group_a_cg_snapshot_type): """Test deleting group snapshot @@ -250,7 +250,7 @@ class TestGroups(vxflexos.TestVxFlexOSDriver): self.assertTrue(all(snapshot['status'] == 'deleted' for snapshot in result_snapshot_model_update)) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_snapshot(self, is_group_a_cg_snapshot_type): """Test creating group snapshot diff --git a/cinder/tests/unit/volume/drivers/fusionstorage/test_dsware.py b/cinder/tests/unit/volume/drivers/fusionstorage/test_dsware.py index 272e90862..bf562e2a9 100644 --- a/cinder/tests/unit/volume/drivers/fusionstorage/test_dsware.py +++ b/cinder/tests/unit/volume/drivers/fusionstorage/test_dsware.py @@ -25,7 +25,7 @@ from cinder.volume import configuration as config from cinder.volume.drivers.fusionstorage import dsware from cinder.volume.drivers.fusionstorage import fs_client from cinder.volume.drivers.fusionstorage import fs_conf -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils class FakeDSWAREDriver(dsware.DSWAREDriver): diff --git a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py index 8beb473b3..f7220c424 100644 --- a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py +++ b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py @@ -33,8 +33,8 @@ from cinder.volume.drivers.hpe import hpe_3par_common as hpecommon from cinder.volume.drivers.hpe import hpe_3par_fc as hpefcdriver from cinder.volume.drivers.hpe import hpe_3par_iscsi as hpedriver from cinder.volume import qos_specs -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils hpeexceptions = hpe3parclient.hpeexceptions @@ -4899,7 +4899,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group(self, cg_ss_enable, vol_ss_enable): cg_ss_enable.return_value = True vol_ss_enable.return_value = True @@ -4934,7 +4934,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_with_replication_enabled(self, cg_ss_enable, vol_ss_enable): cg_ss_enable.return_value = True @@ -4999,7 +4999,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_empty_group_with_replication_enabled(self, cg_ss_enable, vol_ss_enable): cg_ss_enable.return_value = True @@ -5043,7 +5043,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group_with_replication_enabled(self, cg_ss_enable, vol_ss_enable): cg_ss_enable.return_value = True @@ -5099,7 +5099,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_enable_group_replication(self, cg_ss_enable, vol_ss_enable): cg_ss_enable.return_value = True vol_ss_enable.return_value = True @@ -5137,7 +5137,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_disable_group_replication(self, cg_ss_enable, vol_ss_enable): cg_ss_enable.return_value = True vol_ss_enable.return_value = True @@ -5304,7 +5304,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') @mock.patch.object(volume_types, 'get_volume_type') def test_update_replication_enabled_group_add_vol(self, _mock_volume_types, cg_ss_enable, @@ -5383,7 +5383,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') @mock.patch.object(volume_types, 'get_volume_type') def test_update_repl_group_add_periodic_vol(self, _mock_volume_types, cg_ss_enable, @@ -5469,7 +5469,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') @mock.patch.object(volume_types, 'get_volume_type') def test_update_replication_enabled_group_remove_vol( self, _mock_volume_types, cg_ss_enable, vol_ss_enable): @@ -5865,7 +5865,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): 'get_volume_settings_from_type') @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'create_group') @mock.patch.object(volume_types, 'get_volume_type') @@ -5977,7 +5977,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): 'get_volume_settings_from_type') @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_from_src(self, cg_ss_enable, vol_ss_enable, typ_info): cg_ss_enable.return_value = True @@ -6081,7 +6081,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): 'get_volume_settings_from_type') @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_from_src_group(self, cg_ss_enable, vol_ss_enable, typ_info): cg_ss_enable.return_value = True @@ -6154,7 +6154,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group(self, cg_ss_enable, vol_ss_enable): cg_ss_enable.return_value = True vol_ss_enable.return_value = True @@ -6206,7 +6206,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group_exceptions(self, cg_ss_enable, vol_ss_enable): cg_ss_enable.return_value = True vol_ss_enable.return_value = True @@ -6247,7 +6247,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_update_group_add_vol(self, cg_ss_enable, vol_ss_enable): cg_ss_enable.return_value = True vol_ss_enable.return_value = True @@ -6301,7 +6301,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_update_group_remove_vol(self, cg_ss_enable, vol_ss_enable): cg_ss_enable.return_value = True vol_ss_enable.return_value = True @@ -6372,7 +6372,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_snapshot(self, cg_ss_enable, vol_ss_enable): cg_ss_enable.return_value = True vol_ss_enable.return_value = True @@ -6454,7 +6454,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): @mock.patch('cinder.volume.drivers.hpe.hpe_3par_common.HPE3PARCommon.' 'is_volume_group_snap_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group_snapshot(self, cg_ss_enable, vol_ss_enable): cg_ss_enable.return_value = True vol_ss_enable.return_value = True @@ -9768,7 +9768,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver): common, 'test-host', 'test-vol', 'test-host', 'fake') mock_client.assert_has_calls(expected) - @mock.patch('cinder.volume.utils.generate_password') + @mock.patch('cinder.volume.volume_utils.generate_password') def test_do_export(self, mock_utils): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client @@ -9849,7 +9849,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver): mock_client.assert_has_calls(expected) self.assertEqual(expected_model, model) - @mock.patch('cinder.volume.utils.generate_password') + @mock.patch('cinder.volume.volume_utils.generate_password') def test_do_export_host_not_found(self, mock_utils): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP 3PAR client @@ -9885,7 +9885,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver): mock_client.assert_has_calls(expected) self.assertEqual(expected_model, model) - @mock.patch('cinder.volume.utils.generate_password') + @mock.patch('cinder.volume.volume_utils.generate_password') def test_do_export_host_chap_disabled(self, mock_utils): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP 3PAR client @@ -9931,7 +9931,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver): mock_client.assert_has_calls(expected) self.assertEqual(expected_model, model) - @mock.patch('cinder.volume.utils.generate_password') + @mock.patch('cinder.volume.volume_utils.generate_password') def test_do_export_no_active_vluns(self, mock_utils): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP 3PAR client @@ -9975,7 +9975,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver): mock_client.assert_has_calls(expected) self.assertEqual(expected_model, model) - @mock.patch('cinder.volume.utils.generate_password') + @mock.patch('cinder.volume.volume_utils.generate_password') def test_do_export_vlun_missing_chap_credentials(self, mock_utils): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP 3PAR client @@ -10032,7 +10032,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver): mock_client.assert_has_calls(expected) self.assertDictEqual(expected_model, model_without_remote_name) - @mock.patch('cinder.volume.utils.generate_password') + @mock.patch('cinder.volume.volume_utils.generate_password') def test_create_export(self, mock_utils): config = self.setup_configuration() config.hpe3par_iscsi_chap_enabled = True diff --git a/cinder/tests/unit/volume/drivers/hpe/test_hpelefthand.py b/cinder/tests/unit/volume/drivers/hpe/test_hpelefthand.py index 8cb24a1e7..aaabc257f 100644 --- a/cinder/tests/unit/volume/drivers/hpe/test_hpelefthand.py +++ b/cinder/tests/unit/volume/drivers/hpe/test_hpelefthand.py @@ -689,7 +689,7 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase): # validate call chain mock_client.assert_has_calls(expected) - @mock.patch('cinder.volume.utils.generate_password') + @mock.patch('cinder.volume.volume_utils.generate_password') def test_initialize_connection_with_chap_disabled(self, mock_utils): # setup_mock_client drive with CHAP disabled configuration # and return the mock HTTP LeftHand client @@ -719,7 +719,7 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase): self.connector) mock_client.assert_has_calls(expected) - @mock.patch('cinder.volume.utils.generate_password') + @mock.patch('cinder.volume.volume_utils.generate_password') def test_initialize_connection_with_chap_enabled(self, mock_utils): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP LeftHand client @@ -2754,7 +2754,7 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase): mock_client.assert_has_calls(expected) @mock.patch.object(volume_types, 'get_volume_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group(self, cg_ss_enabled, mock_get_volume_type): cg_ss_enabled.side_effect = [False, True, True] ctxt = context.get_admin_context() @@ -2794,7 +2794,7 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase): model_update['status']) @mock.patch.object(volume_types, 'get_volume_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group(self, cg_ss_enabled, mock_get_volume_type): cg_ss_enabled.return_value = True ctxt = context.get_admin_context() @@ -2826,7 +2826,7 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase): model_update['status']) @mock.patch.object(volume_types, 'get_volume_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_update_group_add_vol_delete_group(self, cg_ss_enabled, mock_get_volume_type): cg_ss_enabled.return_value = True @@ -2870,7 +2870,7 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase): model_update['status']) @mock.patch.object(volume_types, 'get_volume_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_update_group_remove_vol_delete_group(self, cg_ss_enabled, mock_get_volume_type): cg_ss_enabled.return_value = True @@ -2917,7 +2917,7 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase): model_update['status']) @mock.patch.object(volume_types, 'get_volume_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_groupsnapshot(self, cg_ss_enabled, mock_get_volume_type): cg_ss_enabled.return_value = True ctxt = context.get_admin_context() @@ -2974,7 +2974,7 @@ class TestHPELeftHandISCSIDriver(HPELeftHandBaseDriver, test.TestCase): ctxt, groupsnapshot, expected_snaps) @mock.patch.object(volume_types, 'get_volume_type') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_groupsnapshot(self, cg_ss_enabled, mock_get_volume_type): cg_ss_enabled.return_value = True ctxt = context.get_admin_context() diff --git a/cinder/tests/unit/volume/drivers/huawei/test_huawei_drivers.py b/cinder/tests/unit/volume/drivers/huawei/test_huawei_drivers.py index 8eacc045a..323a708b4 100644 --- a/cinder/tests/unit/volume/drivers/huawei/test_huawei_drivers.py +++ b/cinder/tests/unit/volume/drivers/huawei/test_huawei_drivers.py @@ -47,8 +47,8 @@ from cinder.volume.drivers.huawei import replication from cinder.volume.drivers.huawei import rest_client from cinder.volume.drivers.huawei import smartx from cinder.volume import qos_specs -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils admin_contex = context.get_admin_context() diff --git a/cinder/tests/unit/volume/drivers/ibm/test_ibm_flashsystem.py b/cinder/tests/unit/volume/drivers/ibm/test_ibm_flashsystem.py index db6c13c49..8611b822c 100644 --- a/cinder/tests/unit/volume/drivers/ibm/test_ibm_flashsystem.py +++ b/cinder/tests/unit/volume/drivers/ibm/test_ibm_flashsystem.py @@ -31,8 +31,8 @@ from cinder import test from cinder import utils from cinder.volume import configuration as conf from cinder.volume.drivers.ibm import flashsystem_fc -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils class FlashSystemManagementSimulator(object): diff --git a/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py b/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py index 01aff4750..6cfd1938a 100644 --- a/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py +++ b/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py @@ -51,8 +51,8 @@ from cinder.volume.drivers.ibm.storwize_svc import storwize_svc_fc from cinder.volume.drivers.ibm.storwize_svc import storwize_svc_iscsi from cinder.volume import group_types from cinder.volume import qos_specs -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils SVC_POOLS = ['openstack', 'openstack1'] @@ -6170,8 +6170,8 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase): @mock.patch('oslo_service.loopingcall.FixedIntervalLoopingCall', new=testutils.ZeroIntervalLoopingCall) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') - @mock.patch('cinder.volume.utils.is_group_a_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_type') @mock.patch.object(storwize_svc_common.StorwizeSVCCommonDriver, '_delete_replication_grp') def test_storwize_delete_group(self, _del_rep_grp, is_grp_a_cg_rep_type, @@ -6198,8 +6198,8 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase): for volume in model_update[1]: self.assertEqual('deleted', volume['status']) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') - @mock.patch('cinder.volume.utils.is_group_a_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_type') @mock.patch.object(storwize_svc_common.StorwizeSVCCommonDriver, '_update_replication_grp') def test_storwize_group_update(self, _update_rep_grp, is_grp_a_cg_rep_type, @@ -6224,7 +6224,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase): @mock.patch('oslo_service.loopingcall.FixedIntervalLoopingCall', new=testutils.ZeroIntervalLoopingCall) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_storwize_create_group_snapshot(self, is_grp_a_cg_snapshot_type): is_grp_a_cg_snapshot_type.side_effect = [True, True, False, True] type_ref = volume_types.create(self.ctxt, 'testtype', None) @@ -6253,7 +6253,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase): @mock.patch('oslo_service.loopingcall.FixedIntervalLoopingCall', new=testutils.ZeroIntervalLoopingCall) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_storwize_delete_group_snapshot(self, is_grp_a_cg_snapshot_type): is_grp_a_cg_snapshot_type.side_effect = [True, True, True, False, True] type_ref = volume_types.create(self.ctxt, 'testtype', None) @@ -7644,7 +7644,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase): self.ctxt, mirror_volume, hyperswap_vol_type, diff, host3) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_storwize_hyperswap_group_create(self, is_grp_a_cg_snapshot_type): """Test group create.""" is_grp_a_cg_snapshot_type.side_effect = [False, False, False, False] @@ -7683,7 +7683,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase): self.assertEqual(fields.GroupStatus.AVAILABLE, model_update['status']) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_storwize_hyperswap_group_delete(self, is_grp_a_cg_snapshot_type): """Test group create.""" is_grp_a_cg_snapshot_type.side_effect = [False, False, False] @@ -7728,7 +7728,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase): for volume in model_update[1]: self.assertEqual('deleted', volume['status']) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_storwize_hyperswap_group_update(self, is_grp_a_cg_snapshot_type): """Test group create.""" is_grp_a_cg_snapshot_type.side_effect = [False, False, False, diff --git a/cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py b/cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py index 3e9678fa5..3840f01b5 100644 --- a/cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py +++ b/cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py @@ -717,7 +717,7 @@ class XIVProxyTest(test.TestCase): pool_name = p_failback._get_backend_pool() self.assertEqual(REPLICA_POOL, pool_name) - @mock.patch("cinder.volume.utils.is_group_a_cg_snapshot_type", + @mock.patch("cinder.volume.volume_utils.is_group_a_cg_snapshot_type", mock.MagicMock(return_value=True)) def test_create_volume_with_consistency_group(self): """Test Create volume with consistency_group""" @@ -751,7 +751,7 @@ class XIVProxyTest(test.TestCase): @mock.patch('pyxcli.mirroring.mirrored_entities.' 'MirroredEntities', mock.MagicMock()) - @mock.patch('cinder.volume.utils.is_group_a_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_type', mock.MagicMock(return_value=True)) @mock.patch("cinder.volume.drivers.ibm.ibm_storage." "xiv_proxy.XIVProxy._get_extra_specs", @@ -2529,8 +2529,8 @@ class XIVProxyTest(test.TestCase): # check no assertion occurs p._silent_delete_volume(TEST_VOLUME) - @mock.patch("cinder.volume.utils.group_get_by_id", mock.MagicMock()) - @mock.patch("cinder.volume.utils.is_group_a_cg_snapshot_type", + @mock.patch("cinder.volume.volume_utils.group_get_by_id", mock.MagicMock()) + @mock.patch("cinder.volume.volume_utils.is_group_a_cg_snapshot_type", mock.MagicMock(return_value=False)) def test_create_cloned_volume_calls_vol_create_and_copy(self): """test create_cloned_volume @@ -2567,8 +2567,8 @@ class XIVProxyTest(test.TestCase): vol_src=vol_src['name'], vol_trg=vol_trg['name']) - @mock.patch("cinder.volume.utils.group_get_by_id", mock.MagicMock()) - @mock.patch("cinder.volume.utils.is_group_a_cg_snapshot_type", + @mock.patch("cinder.volume.volume_utils.group_get_by_id", mock.MagicMock()) + @mock.patch("cinder.volume.volume_utils.is_group_a_cg_snapshot_type", mock.MagicMock(return_value=False)) def test_handle_created_vol_properties_returns_vol_update(self): """test handle_created_vol_props diff --git a/cinder/tests/unit/volume/drivers/infortrend/test_infortrend_common.py b/cinder/tests/unit/volume/drivers/infortrend/test_infortrend_common.py index 80f1a548b..d9f72ee67 100644 --- a/cinder/tests/unit/volume/drivers/infortrend/test_infortrend_common.py +++ b/cinder/tests/unit/volume/drivers/infortrend/test_infortrend_common.py @@ -23,7 +23,7 @@ from cinder.tests.unit import utils from cinder.tests.unit.volume.drivers.infortrend import test_infortrend_cli from cinder.volume import configuration from cinder.volume.drivers.infortrend.raidcmd_cli import common_cli -from cinder.volume import utils as cv_utils +from cinder.volume import volume_utils SUCCEED = (0, '') FAKE_ERROR_RETURN = (-1, '') @@ -2769,8 +2769,8 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCase): result = self.driver.get_manageable_volumes(fake_cinder_volumes, None, 1000, 0, ['reference'], ['desc']) - ans = cv_utils.paginate_entries_list(ans, None, 1000, 0, - ['reference'], ['desc']) + ans = volume_utils.paginate_entries_list(ans, None, 1000, 0, + ['reference'], ['desc']) self.assertEqual(ans, result) def test_get_manageable_snapshots(self): @@ -2830,8 +2830,8 @@ class InfortrendiSCSICommonTestCase(InfortrendTestCase): result = self.driver.get_manageable_snapshots(fake_cinder_snapshots, None, 1000, 0, ['reference'], ['desc']) - ans = cv_utils.paginate_entries_list(ans, None, 1000, 0, - ['reference'], ['desc']) + ans = volume_utils.paginate_entries_list(ans, None, 1000, 0, + ['reference'], ['desc']) self.assertEqual(ans, result) def test_manage_existing_snapshot(self): diff --git a/cinder/tests/unit/volume/drivers/inspur/as13000/test_as13000_driver.py b/cinder/tests/unit/volume/drivers/inspur/as13000/test_as13000_driver.py index 062aa38b2..c588911bb 100644 --- a/cinder/tests/unit/volume/drivers/inspur/as13000/test_as13000_driver.py +++ b/cinder/tests/unit/volume/drivers/inspur/as13000/test_as13000_driver.py @@ -34,7 +34,7 @@ from cinder.tests.unit import fake_snapshot from cinder.tests.unit import fake_volume from cinder.volume import configuration from cinder.volume.drivers.inspur.as13000 import as13000_driver -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils CONF = cfg.CONF diff --git a/cinder/tests/unit/volume/drivers/inspur/instorage/test_common.py b/cinder/tests/unit/volume/drivers/inspur/instorage/test_common.py index c70f51e93..a61db2007 100644 --- a/cinder/tests/unit/volume/drivers/inspur/instorage/test_common.py +++ b/cinder/tests/unit/volume/drivers/inspur/instorage/test_common.py @@ -39,8 +39,8 @@ from cinder.volume.drivers.inspur.instorage import ( from cinder.volume.drivers.inspur.instorage import instorage_common from cinder.volume.drivers.inspur.instorage import instorage_iscsi from cinder.volume import qos_specs -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils from cinder.tests.unit.volume.drivers.inspur.instorage import fakes diff --git a/cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_client_cmode.py b/cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_client_cmode.py index 12fb2c8ea..2e9169fa2 100644 --- a/cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_client_cmode.py +++ b/cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_client_cmode.py @@ -1055,7 +1055,7 @@ class NetAppCmodeClientTestCase(test.TestCase): mock.call('qos-policy-group-delete-iter', api_args, False)]) self.assertEqual(1, mock_log.call_count) - @mock.patch('cinder.volume.utils.resolve_hostname', + @mock.patch('cinder.volume.volume_utils.resolve_hostname', return_value='192.168.1.101') def test_get_if_info_by_ip_not_found(self, mock_resolve_hostname): fake_ip = '192.168.1.101' @@ -1070,7 +1070,7 @@ class NetAppCmodeClientTestCase(test.TestCase): self.assertRaises(exception.NotFound, self.client.get_if_info_by_ip, fake_ip) - @mock.patch('cinder.volume.utils.resolve_hostname', + @mock.patch('cinder.volume.volume_utils.resolve_hostname', return_value='192.168.1.101') def test_get_if_info_by_ip(self, mock_resolve_hostname): fake_ip = '192.168.1.101' diff --git a/cinder/tests/unit/volume/drivers/netapp/dataontap/test_block_base.py b/cinder/tests/unit/volume/drivers/netapp/dataontap/test_block_base.py index a027f9d70..91dc5b0cf 100644 --- a/cinder/tests/unit/volume/drivers/netapp/dataontap/test_block_base.py +++ b/cinder/tests/unit/volume/drivers/netapp/dataontap/test_block_base.py @@ -42,7 +42,7 @@ from cinder.volume.drivers.netapp.dataontap import block_base from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api from cinder.volume.drivers.netapp.dataontap.utils import loopingcalls from cinder.volume.drivers.netapp import utils as na_utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils @ddt.ddt diff --git a/cinder/tests/unit/volume/drivers/netapp/dataontap/test_block_cmode.py b/cinder/tests/unit/volume/drivers/netapp/dataontap/test_block_cmode.py index 30068a11e..8d5832efe 100644 --- a/cinder/tests/unit/volume/drivers/netapp/dataontap/test_block_cmode.py +++ b/cinder/tests/unit/volume/drivers/netapp/dataontap/test_block_cmode.py @@ -38,7 +38,7 @@ from cinder.volume.drivers.netapp.dataontap.utils import data_motion from cinder.volume.drivers.netapp.dataontap.utils import loopingcalls from cinder.volume.drivers.netapp.dataontap.utils import utils as dot_utils from cinder.volume.drivers.netapp import utils as na_utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils @ddt.ddt diff --git a/cinder/tests/unit/volume/drivers/netapp/dataontap/test_nfs_base.py b/cinder/tests/unit/volume/drivers/netapp/dataontap/test_nfs_base.py index cc5b4ff16..de0314ea9 100644 --- a/cinder/tests/unit/volume/drivers/netapp/dataontap/test_nfs_base.py +++ b/cinder/tests/unit/volume/drivers/netapp/dataontap/test_nfs_base.py @@ -41,7 +41,7 @@ from cinder.volume.drivers.netapp.dataontap.utils import loopingcalls from cinder.volume.drivers.netapp import utils as na_utils from cinder.volume.drivers import nfs from cinder.volume.drivers import remotefs -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils @ddt.ddt diff --git a/cinder/tests/unit/volume/drivers/netapp/dataontap/test_nfs_cmode.py b/cinder/tests/unit/volume/drivers/netapp/dataontap/test_nfs_cmode.py index 133bf9684..fcabf5136 100644 --- a/cinder/tests/unit/volume/drivers/netapp/dataontap/test_nfs_cmode.py +++ b/cinder/tests/unit/volume/drivers/netapp/dataontap/test_nfs_cmode.py @@ -44,7 +44,7 @@ from cinder.volume.drivers.netapp.dataontap.utils import loopingcalls from cinder.volume.drivers.netapp.dataontap.utils import utils as dot_utils from cinder.volume.drivers.netapp import utils as na_utils from cinder.volume.drivers import nfs -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils @ddt.ddt diff --git a/cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py b/cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py index c56528598..a739d0f54 100644 --- a/cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py +++ b/cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py @@ -2129,7 +2129,7 @@ class SolidFireVolumeTestCase(test.TestCase): get.assert_called_once_with(name) self.assertEqual('model', result) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_cg(self, group_cg_test): sfv = solidfire.SolidFireDriver(configuration=self.configuration) group_cg_test.return_value = True @@ -2139,7 +2139,7 @@ class SolidFireVolumeTestCase(test.TestCase): {'status': fields.GroupStatus.AVAILABLE}) group_cg_test.assert_called_once_with(group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group_snap_cg(self, group_cg_test): sfv = solidfire.SolidFireDriver(configuration=self.configuration) group_cg_test.return_value = True @@ -2154,7 +2154,7 @@ class SolidFireVolumeTestCase(test.TestCase): _del_mock.assert_called_once_with(self.ctxt, cgsnapshot, snapshots) self.assertEqual({}, model_update) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group_snap(self, group_cg_test): sfv = solidfire.SolidFireDriver(configuration=self.configuration) group_cg_test.return_value = False @@ -2169,7 +2169,7 @@ class SolidFireVolumeTestCase(test.TestCase): self.ctxt, cgsnapshot, snapshots) _del_mock.assert_not_called() - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_rainy(self, group_cg_test): sfv = solidfire.SolidFireDriver(configuration=self.configuration) group_cg_test.return_value = False @@ -2179,7 +2179,7 @@ class SolidFireVolumeTestCase(test.TestCase): self.ctxt, group) group_cg_test.assert_called_once_with(group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_from_src_rainy(self, group_cg_test): sfv = solidfire.SolidFireDriver(configuration=self.configuration) group_cg_test.return_value = False @@ -2190,7 +2190,7 @@ class SolidFireVolumeTestCase(test.TestCase): self.ctxt, group, volumes) group_cg_test.assert_called_once_with(group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_from_src_cg(self, group_cg_test): sfv = solidfire.SolidFireDriver(configuration=self.configuration) group_cg_test.return_value = True @@ -2206,7 +2206,7 @@ class SolidFireVolumeTestCase(test.TestCase): self.assertEqual(ret, result) group_cg_test.assert_called_once_with(group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_snapshot_rainy(self, group_cg_test): sfv = solidfire.SolidFireDriver(configuration=self.configuration) group_cg_test.return_value = False @@ -2219,7 +2219,7 @@ class SolidFireVolumeTestCase(test.TestCase): snapshots) group_cg_test.assert_called_once_with(group_snapshot) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_snapshot(self, group_cg_test): sfv = solidfire.SolidFireDriver(configuration=self.configuration) group_cg_test.return_value = True @@ -2235,7 +2235,7 @@ class SolidFireVolumeTestCase(test.TestCase): self.assertEqual(ret, result) group_cg_test.assert_called_once_with(group_snapshot) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group_rainy(self, group_cg_test): sfv = solidfire.SolidFireDriver(configuration=self.configuration) group_cg_test.return_value = False @@ -2248,7 +2248,7 @@ class SolidFireVolumeTestCase(test.TestCase): volumes) group_cg_test.assert_called_once_with(group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group(self, group_cg_test): sfv = solidfire.SolidFireDriver(configuration=self.configuration) group_cg_test.return_value = True @@ -2264,7 +2264,7 @@ class SolidFireVolumeTestCase(test.TestCase): self.assertEqual(ret, result) group_cg_test.assert_called_once_with(group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_update_group_rainy(self, group_cg_test): sfv = solidfire.SolidFireDriver(configuration=self.configuration) group_cg_test.return_value = False @@ -2275,7 +2275,7 @@ class SolidFireVolumeTestCase(test.TestCase): group) group_cg_test.assert_called_once_with(group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_update_group(self, group_cg_test): sfv = solidfire.SolidFireDriver(configuration=self.configuration) group_cg_test.return_value = True diff --git a/cinder/tests/unit/volume/drivers/test_gpfs.py b/cinder/tests/unit/volume/drivers/test_gpfs.py index 6d562f200..f8021171f 100644 --- a/cinder/tests/unit/volume/drivers/test_gpfs.py +++ b/cinder/tests/unit/volume/drivers/test_gpfs.py @@ -1737,7 +1737,7 @@ class GPFSDriverTestCase(test.TestCase): self.assertEqual(volume_path, ret) @mock.patch('cinder.db.get_by_id') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_local_path_volume_in_cg(self, mock_group_cg_snapshot_type, mock_group_obj): mock_group_cg_snapshot_type.return_value = True @@ -1856,7 +1856,7 @@ class GPFSDriverTestCase(test.TestCase): return (volume, new_type, diff, host) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group(self, mock_cg_snapshot_type): mock_cg_snapshot_type.return_value = False ctxt = self.context @@ -1869,7 +1869,7 @@ class GPFSDriverTestCase(test.TestCase): @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_create_consistencygroup') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_cg(self, mock_cg_snapshot_type, mock_consisgroup_create): mock_cg_snapshot_type.return_value = True @@ -1878,7 +1878,7 @@ class GPFSDriverTestCase(test.TestCase): self.driver.create_group(ctxt, group) mock_consisgroup_create.assert_called_once_with(ctxt, group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group(self, mock_cg_snapshot_type): mock_cg_snapshot_type.return_value = False ctxt = self.context @@ -1892,7 +1892,7 @@ class GPFSDriverTestCase(test.TestCase): @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_delete_consistencygroup') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group_cg(self, mock_cg_snapshot_type, mock_consisgroup_delete): mock_cg_snapshot_type.return_value = True @@ -1902,7 +1902,7 @@ class GPFSDriverTestCase(test.TestCase): self.driver.delete_group(ctxt, group, volumes) mock_consisgroup_delete.assert_called_once_with(ctxt, group, volumes) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_update_group(self, mock_cg_snapshot_type): mock_cg_snapshot_type.return_value = False ctxt = self.context @@ -1915,7 +1915,7 @@ class GPFSDriverTestCase(test.TestCase): @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_update_consistencygroup') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_update_group_cg(self, mock_cg_snapshot_type, mock_consisgroup_update): mock_cg_snapshot_type.return_value = True @@ -1925,7 +1925,7 @@ class GPFSDriverTestCase(test.TestCase): mock_consisgroup_update.assert_called_once_with(ctxt, group, None, None) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_snapshot(self, mock_cg_snapshot_type): mock_cg_snapshot_type.return_value = False ctxt = self.context @@ -1939,7 +1939,7 @@ class GPFSDriverTestCase(test.TestCase): @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_create_cgsnapshot') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_snapshot_cg(self, mock_cg_snapshot_type, mock_cgsnapshot_create): mock_cg_snapshot_type.return_value = True @@ -1950,7 +1950,7 @@ class GPFSDriverTestCase(test.TestCase): mock_cgsnapshot_create.assert_called_once_with(ctxt, group_snapshot, snapshots) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group_snapshot(self, mock_cg_snapshot_type): mock_cg_snapshot_type.return_value = False ctxt = self.context @@ -1964,7 +1964,7 @@ class GPFSDriverTestCase(test.TestCase): @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_delete_cgsnapshot') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group_snapshot_cg(self, mock_cg_snapshot_type, mock_cgsnapshot_delete): mock_cg_snapshot_type.return_value = True @@ -1975,7 +1975,7 @@ class GPFSDriverTestCase(test.TestCase): mock_cgsnapshot_delete.assert_called_once_with(ctxt, group_snapshot, snapshots) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_from_src(self, mock_cg_snapshot_type): mock_cg_snapshot_type.return_value = False ctxt = self.context @@ -1989,7 +1989,7 @@ class GPFSDriverTestCase(test.TestCase): @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.' '_create_consistencygroup_from_src') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_from_src_cg(self, mock_cg_snapshot_type, mock_cg_clone_create): mock_cg_snapshot_type.return_value = True @@ -2219,7 +2219,7 @@ class GPFSNFSDriverTestCase(test.TestCase): self.assertEqual('file', stats['storage_protocol']) @mock.patch('cinder.db.get_by_id') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_get_volume_path(self, mock_group_cg_snapshot_type, mock_group): mock_group_cg_snapshot_type.return_value = True self.driver.configuration.gpfs_mount_point_base = ( @@ -2240,7 +2240,7 @@ class GPFSNFSDriverTestCase(test.TestCase): self.driver._get_volume_path(volume)) @mock.patch('cinder.db.get_by_id') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSNFSDriver.' '_get_mount_point_for_share') def test_local_path(self, mock_mount_point, diff --git a/cinder/tests/unit/volume/drivers/test_infinidat.py b/cinder/tests/unit/volume/drivers/test_infinidat.py index 7af437bdf..62c4190d0 100644 --- a/cinder/tests/unit/volume/drivers/test_infinidat.py +++ b/cinder/tests/unit/volume/drivers/test_infinidat.py @@ -350,7 +350,7 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): self.assertRaises(exception.VolumeBackendAPIException, self.driver.create_snapshot, test_snapshot) - @mock.patch("cinder.volume.utils.copy_volume") + @mock.patch("cinder.volume.volume_utils.copy_volume") @mock.patch("cinder.utils.brick_get_connector") @mock.patch("cinder.utils.brick_get_connector_properties", return_value=test_connector) @@ -379,7 +379,7 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): self.driver.create_volume_from_snapshot, test_clone, test_snapshot) - @mock.patch("cinder.volume.utils.copy_volume") + @mock.patch("cinder.volume.volume_utils.copy_volume") @mock.patch("cinder.utils.brick_get_connector") @mock.patch("cinder.utils.brick_get_connector_properties", return_value=test_connector) @@ -402,7 +402,7 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): self.assertRaises(exception.VolumeBackendAPIException, self.driver.delete_snapshot, test_snapshot) - @mock.patch("cinder.volume.utils.copy_volume") + @mock.patch("cinder.volume.volume_utils.copy_volume") @mock.patch("cinder.utils.brick_get_connector") @mock.patch("cinder.utils.brick_get_connector_properties", return_value=test_connector) @@ -433,24 +433,24 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): self.driver.create_cloned_volume, test_clone, test_volume) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group(self, *mocks): self.driver.create_group(None, test_group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group_metadata(self, *mocks): self.driver.create_group(None, test_group) self._validate_object_metadata(self._mock_group, test_group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group_twice(self, *mocks): self.driver.create_group(None, test_group) self.driver.create_group(None, test_group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group_api_fail(self, *mocks): self._system.cons_groups.create.side_effect = self._raise_infinisdk @@ -458,18 +458,18 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): self.driver.create_group, None, test_group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_delete_group(self, *mocks): self.driver.delete_group(None, test_group, [test_volume]) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_delete_group_doesnt_exist(self, *mocks): self._system.cons_groups.safe_get.return_value = None self.driver.delete_group(None, test_group, [test_volume]) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_delete_group_api_fail(self, *mocks): self._mock_group.safe_delete.side_effect = self._raise_infinisdk @@ -477,13 +477,13 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): self.driver.delete_group, None, test_group, [test_volume]) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_update_group_add_and_remove(self, *mocks): self.driver.update_group(None, test_group, [test_volume], [test_volume]) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_update_group_api_fail(self, *mocks): self._mock_group.add_member.side_effect = self._raise_infinisdk @@ -492,11 +492,11 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): None, test_group, [test_volume], [test_volume]) - @mock.patch("cinder.volume.utils.copy_volume") + @mock.patch("cinder.volume.volume_utils.copy_volume") @mock.patch("cinder.utils.brick_get_connector") @mock.patch("cinder.utils.brick_get_connector_properties", return_value=test_connector) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) @mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs") def test_create_group_from_src_snaps(self, *mocks): @@ -504,11 +504,11 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): test_snapgroup, [test_snapshot], None, None) - @mock.patch("cinder.volume.utils.copy_volume") + @mock.patch("cinder.volume.volume_utils.copy_volume") @mock.patch("cinder.utils.brick_get_connector") @mock.patch("cinder.utils.brick_get_connector_properties", return_value=test_connector) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) @mock.patch("cinder.volume.volume_types.get_volume_type_qos_specs") def test_create_group_from_src_vols(self, *mocks): @@ -516,7 +516,7 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): None, None, test_group, [test_volume]) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group_snap(self, *mocks): mock_snapgroup = mock.Mock() @@ -528,7 +528,7 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): test_snapgroup, [test_snapshot]) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_create_group_snap_api_fail(self, *mocks): self._mock_group.create_snapshot.side_effect = self._raise_infinisdk @@ -536,14 +536,14 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): self.driver.create_group_snapshot, None, test_snapgroup, [test_snapshot]) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_delete_group_snap(self, *mocks): self.driver.delete_group_snapshot(None, test_snapgroup, [test_snapshot]) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_delete_group_snap_does_not_exist(self, *mocks): self._system.cons_groups.safe_get.return_value = None @@ -551,7 +551,7 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): test_snapgroup, [test_snapshot]) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_delete_group_snap_invalid_group(self, *mocks): self._mock_group.is_snapgroup.return_value = False @@ -559,7 +559,7 @@ class InfiniboxDriverTestCase(InfiniboxDriverTestCaseBase): self.driver.delete_group_snapshot, None, test_snapgroup, [test_snapshot]) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type', + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type', return_value=True) def test_delete_group_snap_api_fail(self, *mocks): self._mock_group.safe_delete.side_effect = self._raise_infinisdk diff --git a/cinder/tests/unit/volume/drivers/test_kaminario.py b/cinder/tests/unit/volume/drivers/test_kaminario.py index a98834721..35c99ef16 100644 --- a/cinder/tests/unit/volume/drivers/test_kaminario.py +++ b/cinder/tests/unit/volume/drivers/test_kaminario.py @@ -32,7 +32,7 @@ from cinder.volume import configuration from cinder.volume.drivers.kaminario import kaminario_common from cinder.volume.drivers.kaminario import kaminario_fc from cinder.volume.drivers.kaminario import kaminario_iscsi -from cinder.volume import utils as vol_utils +from cinder.volume import volume_utils as vol_utils CONNECTOR = {'initiator': 'iqn.1993-08.org.debian:01:12aa12aa12aa', 'ip': '192.168.2.5', 'platform': 'x86_64', 'host': 'test-k2', diff --git a/cinder/tests/unit/volume/drivers/test_lvm_driver.py b/cinder/tests/unit/volume/drivers/test_lvm_driver.py index e58ab7764..a9b0a3d39 100644 --- a/cinder/tests/unit/volume/drivers/test_lvm_driver.py +++ b/cinder/tests/unit/volume/drivers/test_lvm_driver.py @@ -30,8 +30,8 @@ from cinder.tests.unit import utils as tests_utils from cinder.tests.unit.volume import test_driver from cinder.volume import configuration as conf from cinder.volume.drivers import lvm -import cinder.volume.utils -from cinder.volume import utils as volutils +import cinder.volume.volume_utils +from cinder.volume import volume_utils as volutils CONF = cfg.CONF @@ -244,7 +244,7 @@ class LVMVolumeDriverTestCase(test_driver.BaseDriverTestCase): snapshot_ref) mock_extend.assert_called_with(dst_volume, dst_volume['size']) - @mock.patch.object(cinder.volume.utils, 'get_all_volume_groups', + @mock.patch.object(cinder.volume.volume_utils, 'get_all_volume_groups', return_value=[{'name': 'cinder-volumes'}]) @mock.patch('cinder.brick.local_dev.lvm.LVM.update_volume_group_info') @mock.patch('cinder.brick.local_dev.lvm.LVM.get_all_physical_volumes') @@ -266,7 +266,7 @@ class LVMVolumeDriverTestCase(test_driver.BaseDriverTestCase): self.assertEqual('thin', lvm_driver.configuration.lvm_type) - @mock.patch.object(cinder.volume.utils, 'get_all_volume_groups', + @mock.patch.object(cinder.volume.volume_utils, 'get_all_volume_groups', return_value=[{'name': 'cinder-volumes'}]) @mock.patch.object(cinder.brick.local_dev.lvm.LVM, 'get_volumes', return_value=[]) @@ -290,7 +290,7 @@ class LVMVolumeDriverTestCase(test_driver.BaseDriverTestCase): self.assertEqual('thin', lvm_driver.configuration.lvm_type) - @mock.patch.object(cinder.volume.utils, 'get_all_volume_groups', + @mock.patch.object(cinder.volume.volume_utils, 'get_all_volume_groups', return_value=[{'name': 'cinder-volumes'}]) @mock.patch('cinder.brick.local_dev.lvm.LVM.get_lv_info') @mock.patch('cinder.brick.local_dev.lvm.LVM.activate_lv') @@ -310,7 +310,7 @@ class LVMVolumeDriverTestCase(test_driver.BaseDriverTestCase): self.assertEqual('default', lvm_driver.configuration.lvm_type) - @mock.patch.object(cinder.volume.utils, 'get_all_volume_groups', + @mock.patch.object(cinder.volume.volume_utils, 'get_all_volume_groups', return_value=[{'name': 'cinder-volumes'}]) @mock.patch('cinder.brick.local_dev.lvm.LVM.get_lv_info') @mock.patch('cinder.brick.local_dev.lvm.LVM.activate_lv') diff --git a/cinder/tests/unit/volume/drivers/test_nfs.py b/cinder/tests/unit/volume/drivers/test_nfs.py index 50e2f73f0..b4ac4bfd8 100644 --- a/cinder/tests/unit/volume/drivers/test_nfs.py +++ b/cinder/tests/unit/volume/drivers/test_nfs.py @@ -34,7 +34,7 @@ from cinder.tests.unit import fake_volume from cinder.volume import configuration as conf from cinder.volume.drivers import nfs from cinder.volume.drivers import remotefs -from cinder.volume import utils as vutils +from cinder.volume import volume_utils class RemoteFsDriverTestCase(test.TestCase): @@ -417,7 +417,7 @@ class NfsDriverTestCase(test.TestCase): self.configuration.nas_mount_options = None self.configuration.volume_dd_blocksize = '1M' - self.mock_object(vutils, 'get_max_over_subscription_ratio', + self.mock_object(volume_utils, 'get_max_over_subscription_ratio', return_value=1) self.context = context.get_admin_context() diff --git a/cinder/tests/unit/volume/drivers/test_pure.py b/cinder/tests/unit/volume/drivers/test_pure.py index f92af734f..2ea0fb5b0 100644 --- a/cinder/tests/unit/volume/drivers/test_pure.py +++ b/cinder/tests/unit/volume/drivers/test_pure.py @@ -30,7 +30,7 @@ from cinder.tests.unit import fake_group from cinder.tests.unit import fake_group_snapshot from cinder.tests.unit import fake_snapshot from cinder.tests.unit import fake_volume -from cinder.volume import utils as volume_utis +from cinder.volume import volume_utils def fake_retry(exceptions, interval=1, retries=3, backoff_rate=2): @@ -2180,7 +2180,8 @@ class PureBaseVolumeDriverTestCase(PureBaseSharedDriverTestCase): sort_keys = mock.Mock() sort_dirs = mock.Mock() - with mock.patch('cinder.volume.utils.paginate_entries_list') as mpage: + with mock.patch('cinder.volume.volume_utils.' + 'paginate_entries_list') as mpage: if is_snapshot: test_func = self.driver.get_manageable_snapshots else: @@ -3645,7 +3646,7 @@ class PureVolumeUpdateStatsTestCase(PureBaseSharedDriverTestCase): config_ratio, expected_ratio, auto): - volume_utis.get_max_over_subscription_ratio = mock.Mock( + volume_utils.get_max_over_subscription_ratio = mock.Mock( return_value=expected_ratio) self.mock_config.pure_automatic_max_oversubscription_ratio = auto self.mock_config.max_over_subscription_ratio = config_ratio @@ -3732,7 +3733,7 @@ class PureVolumeGroupsTestCase(PureBaseSharedDriverTestCase): self.driver.db.group_get = mock.Mock() @mock.patch(BASE_DRIVER_OBJ + '._add_volume_to_consistency_group') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_add_to_group_if_needed(self, mock_is_cg, mock_add_to_cg): mock_is_cg.return_value = False volume, vol_name = self.new_fake_vol() @@ -3746,7 +3747,7 @@ class PureVolumeGroupsTestCase(PureBaseSharedDriverTestCase): mock_add_to_cg.assert_not_called() @mock.patch(BASE_DRIVER_OBJ + '._add_volume_to_consistency_group') - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_add_to_group_if_needed_with_cg(self, mock_is_cg, mock_add_to_cg): mock_is_cg.return_value = True volume, vol_name = self.new_fake_vol() @@ -3762,7 +3763,7 @@ class PureVolumeGroupsTestCase(PureBaseSharedDriverTestCase): vol_name ) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group(self, mock_is_cg): mock_is_cg.return_value = False group = fake_group.fake_group_type_obj(None) @@ -3773,7 +3774,7 @@ class PureVolumeGroupsTestCase(PureBaseSharedDriverTestCase): ) mock_is_cg.assert_called_once_with(group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group(self, mock_is_cg): mock_is_cg.return_value = False group = mock.MagicMock() @@ -3785,7 +3786,7 @@ class PureVolumeGroupsTestCase(PureBaseSharedDriverTestCase): ) mock_is_cg.assert_called_once_with(group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_update_group(self, mock_is_cg): mock_is_cg.return_value = False group = mock.MagicMock() @@ -3796,7 +3797,7 @@ class PureVolumeGroupsTestCase(PureBaseSharedDriverTestCase): ) mock_is_cg.assert_called_once_with(group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_from_src(self, mock_is_cg): mock_is_cg.return_value = False group = mock.MagicMock() @@ -3808,7 +3809,7 @@ class PureVolumeGroupsTestCase(PureBaseSharedDriverTestCase): ) mock_is_cg.assert_called_once_with(group) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_create_group_snapshot(self, mock_is_cg): mock_is_cg.return_value = False group_snapshot = mock.MagicMock() @@ -3820,7 +3821,7 @@ class PureVolumeGroupsTestCase(PureBaseSharedDriverTestCase): ) mock_is_cg.assert_called_once_with(group_snapshot) - @mock.patch('cinder.volume.utils.is_group_a_cg_snapshot_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_cg_snapshot_type') def test_delete_group_snapshot(self, mock_is_cg): mock_is_cg.return_value = False group_snapshot = mock.MagicMock() diff --git a/cinder/tests/unit/volume/drivers/test_rbd.py b/cinder/tests/unit/volume/drivers/test_rbd.py index 3f8b0c5d1..00983ffad 100644 --- a/cinder/tests/unit/volume/drivers/test_rbd.py +++ b/cinder/tests/unit/volume/drivers/test_rbd.py @@ -44,7 +44,7 @@ from cinder.tests.unit import utils from cinder.tests.unit.volume import test_driver from cinder.volume import configuration as conf import cinder.volume.drivers.rbd as driver -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils # This is used to collect raised exceptions so that tests may check what was @@ -2356,7 +2356,7 @@ class RBDTestCase(test.TestCase): self.assertEqual((True, None), ret) @mock.patch('tempfile.NamedTemporaryFile') - @mock.patch('cinder.volume.utils.check_encryption_provider', + @mock.patch('cinder.volume.volume_utils.check_encryption_provider', return_value={'encryption_key_id': fake.ENCRYPTION_KEY_ID}) def test_create_encrypted_volume(self, mock_check_enc_prov, @@ -2380,7 +2380,7 @@ class RBDTestCase(test.TestCase): 'cipher': 'aes-xts-essiv', 'key_size': 256} - with mock.patch('cinder.volume.utils.check_encryption_provider', + with mock.patch('cinder.volume.volume_utils.check_encryption_provider', return_value=enc_info), \ mock.patch('cinder.volume.drivers.rbd.open') as mock_open, \ mock.patch.object(self.driver, '_execute') as mock_exec: diff --git a/cinder/tests/unit/volume/drivers/test_remotefs.py b/cinder/tests/unit/volume/drivers/test_remotefs.py index b9d0552e2..45c3ab47b 100644 --- a/cinder/tests/unit/volume/drivers/test_remotefs.py +++ b/cinder/tests/unit/volume/drivers/test_remotefs.py @@ -30,7 +30,7 @@ from cinder.tests.unit import fake_snapshot from cinder.tests.unit import fake_volume from cinder import utils from cinder.volume.drivers import remotefs -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils @ddt.ddt diff --git a/cinder/tests/unit/volume/drivers/test_zfssa.py b/cinder/tests/unit/volume/drivers/test_zfssa.py index 371d488f1..bbd832139 100644 --- a/cinder/tests/unit/volume/drivers/test_zfssa.py +++ b/cinder/tests/unit/volume/drivers/test_zfssa.py @@ -38,7 +38,7 @@ from cinder.volume.drivers.zfssa import webdavclient from cinder.volume.drivers.zfssa import zfssaiscsi as iscsi from cinder.volume.drivers.zfssa import zfssanfs from cinder.volume.drivers.zfssa import zfssarest as rest -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils nfs_logbias = 'latency' diff --git a/cinder/tests/unit/volume/flows/test_create_volume_flow.py b/cinder/tests/unit/volume/flows/test_create_volume_flow.py index d5c2b08c4..ce7d4270e 100644 --- a/cinder/tests/unit/volume/flows/test_create_volume_flow.py +++ b/cinder/tests/unit/volume/flows/test_create_volume_flow.py @@ -60,7 +60,7 @@ class CreateVolumeFlowTestCase(test.TestCase): return_value={}) @mock.patch('cinder.objects.Volume.get_by_id') - @mock.patch('cinder.volume.utils.extract_host') + @mock.patch('cinder.volume.volume_utils.extract_host') @mock.patch('time.time') @mock.patch('cinder.objects.Snapshot.get_by_id') def test_cast_create_volume_from_resource(self, mock_snapshot_get, @@ -129,7 +129,7 @@ class CreateVolumeFlowTestCase(test.TestCase): mock_extract_host.assert_not_called() @mock.patch('cinder.objects.Volume.get_by_id') - @mock.patch('cinder.volume.utils.extract_host') + @mock.patch('cinder.volume.volume_utils.extract_host') @mock.patch('time.time') @mock.patch('cinder.objects.ConsistencyGroup.get_by_id') def test_cast_create_volume(self, consistencygroup_get_by_id, mock_time, diff --git a/cinder/tests/unit/volume/test_connection.py b/cinder/tests/unit/volume/test_connection.py index 4ca1a1568..5577c94a8 100644 --- a/cinder/tests/unit/volume/test_connection.py +++ b/cinder/tests/unit/volume/test_connection.py @@ -396,7 +396,7 @@ class VolumeAttachDetachTestCase(base.BaseVolumeTestCase): def setUp(self): super(VolumeAttachDetachTestCase, self).setUp() - self.patch('cinder.volume.utils.clear_volume', autospec=True) + self.patch('cinder.volume.volume_utils.clear_volume', autospec=True) self.user_context = context.RequestContext(user_id=fake.USER_ID, project_id=fake.PROJECT_ID) diff --git a/cinder/tests/unit/volume/test_driver.py b/cinder/tests/unit/volume/test_driver.py index 4904ce7c4..d7213bb7b 100644 --- a/cinder/tests/unit/volume/test_driver.py +++ b/cinder/tests/unit/volume/test_driver.py @@ -44,7 +44,7 @@ from cinder.volume import driver from cinder.volume import manager from cinder.volume import rpcapi as volume_rpcapi import cinder.volume.targets.tgt -from cinder.volume import utils as volutils +from cinder.volume import volume_utils CONF = cfg.CONF @@ -274,7 +274,7 @@ class GenericVolumeDriverTestCase(BaseDriverTestCase): @mock.patch.object(utils, 'brick_get_connector_properties') @mock.patch.object(cinder.volume.manager.VolumeManager, '_attach_volume') @mock.patch.object(cinder.volume.manager.VolumeManager, '_detach_volume') - @mock.patch.object(volutils, 'copy_volume') + @mock.patch.object(volume_utils, 'copy_volume') @mock.patch.object(volume_rpcapi.VolumeAPI, 'get_capabilities') @mock.patch.object(cinder.volume.volume_types, 'volume_types_encryption_changed') diff --git a/cinder/tests/unit/volume/test_init_host.py b/cinder/tests/unit/volume/test_init_host.py index 0bad4f9db..ab0cbf319 100644 --- a/cinder/tests/unit/volume/test_init_host.py +++ b/cinder/tests/unit/volume/test_init_host.py @@ -25,8 +25,8 @@ from cinder import objects from cinder.tests.unit import utils as tests_utils from cinder.tests.unit import volume as base from cinder.volume import driver -from cinder.volume import utils as volutils from cinder.volume import volume_migration as volume_migration +from cinder.volume import volume_utils as volutils CONF = cfg.CONF diff --git a/cinder/tests/unit/volume/test_manage_volume.py b/cinder/tests/unit/volume/test_manage_volume.py index f9a81cd57..1f7ce854a 100644 --- a/cinder/tests/unit/volume/test_manage_volume.py +++ b/cinder/tests/unit/volume/test_manage_volume.py @@ -25,7 +25,7 @@ from cinder.tests.unit import utils as tests_utils from cinder.tests.unit import volume as base from cinder.volume.flows.manager import manage_existing from cinder.volume import manager -from cinder.volume import utils +from cinder.volume import volume_utils FAKE_HOST_POOL = 'volPool' FAKE_HOST = 'hostname@backend' @@ -160,7 +160,8 @@ class ManageVolumeTestCase(base.BaseVolumeTestCase): self.manager._update_stats_for_managed(volume_obj) mock_safe_get.assert_called_once_with('volume_backend_name') - backend_stats = self.manager.stats['pools'][utils.DEFAULT_POOL_NAME] + pool_stats = self.manager.stats['pools'] + backend_stats = pool_stats[volume_utils.DEFAULT_POOL_NAME] self.assertEqual(1, backend_stats['allocated_capacity_gb']) def test_update_stats_key_error(self): @@ -174,7 +175,7 @@ class ManageVolumeTestCase(base.BaseVolumeTestCase): 'manage_existing') @mock.patch('cinder.volume.drivers.lvm.LVMVolumeDriver.' 'manage_existing_get_size') - @mock.patch('cinder.volume.utils.notify_about_volume_usage') + @mock.patch('cinder.volume.volume_utils.notify_about_volume_usage') def test_manage_volume_with_notify(self, mock_notify, mock_size, mock_manage): elevated = context.get_admin_context() diff --git a/cinder/tests/unit/volume/test_replication_manager.py b/cinder/tests/unit/volume/test_replication_manager.py index 9b50b7ead..f9f183d5a 100644 --- a/cinder/tests/unit/volume/test_replication_manager.py +++ b/cinder/tests/unit/volume/test_replication_manager.py @@ -33,7 +33,7 @@ from cinder.tests.unit import volume as base import cinder.volume from cinder.volume import manager from cinder.volume import rpcapi as volume_rpcapi -from cinder.volume import utils as vol_utils +from cinder.volume import volume_utils CONF = cfg.CONF @@ -462,7 +462,7 @@ class ReplicationTestCase(base.BaseVolumeTestCase): in_groups=None, out_groups=None, driver_group_result=None, secondary_id=None): - host = vol_utils.extract_host(self.manager.host) + host = volume_utils.extract_host(self.manager.host) utils.create_service(self.context, {'host': host, 'binary': constants.VOLUME_BINARY}) for volume in in_volumes: @@ -487,7 +487,7 @@ class ReplicationTestCase(base.BaseVolumeTestCase): self._check_failover_db(objects.SnapshotList, out_snapshots) self._check_failover_db(objects.GroupList, out_groups) - @mock.patch('cinder.volume.utils.is_group_a_type') + @mock.patch('cinder.volume.volume_utils.is_group_a_type') def test_failover_host_model_updates(self, mock_group_type): status = fields.ReplicationStatus mock_group_type.return_value = True diff --git a/cinder/tests/unit/volume/test_volume.py b/cinder/tests/unit/volume/test_volume.py index a74a7cec4..5570dc4cd 100644 --- a/cinder/tests/unit/volume/test_volume.py +++ b/cinder/tests/unit/volume/test_volume.py @@ -92,7 +92,7 @@ class VolumeTestCase(base.BaseVolumeTestCase): def setUp(self): super(VolumeTestCase, self).setUp() - self.patch('cinder.volume.utils.clear_volume', autospec=True) + self.patch('cinder.volume.volume_utils.clear_volume', autospec=True) self.expected_status = 'available' self.service_id = 1 self.user_context = context.RequestContext(user_id=fake.USER_ID, diff --git a/cinder/tests/unit/volume/test_volume_migration.py b/cinder/tests/unit/volume/test_volume_migration.py index 809ef460c..5815e00f7 100644 --- a/cinder/tests/unit/volume/test_volume_migration.py +++ b/cinder/tests/unit/volume/test_volume_migration.py @@ -40,8 +40,8 @@ import cinder.volume from cinder.volume import api as volume_api from cinder.volume.flows.manager import create_volume as create_volume_manager from cinder.volume import rpcapi as volume_rpcapi -from cinder.volume import utils as volutils from cinder.volume import volume_types +from cinder.volume import volume_utils as volutils QUOTAS = quota.QUOTAS @@ -72,8 +72,9 @@ class VolumeMigrationTestCase(base.BaseVolumeTestCase): def setUp(self): super(VolumeMigrationTestCase, self).setUp() - self._clear_patch = mock.patch('cinder.volume.utils.clear_volume', - autospec=True) + self._clear_patch = mock.patch( + 'cinder.volume.volume_utils.clear_volume', + autospec=True) self._clear_patch.start() self.expected_status = 'available' self._service = tests_utils.create_service( diff --git a/cinder/tests/unit/volume/test_volume_retype.py b/cinder/tests/unit/volume/test_volume_retype.py index 9b056a218..6b019ccfe 100644 --- a/cinder/tests/unit/volume/test_volume_retype.py +++ b/cinder/tests/unit/volume/test_volume_retype.py @@ -35,7 +35,7 @@ class VolumeRetypeTestCase(base.BaseVolumeTestCase): def setUp(self): super(VolumeRetypeTestCase, self).setUp() - self.patch('cinder.volume.utils.clear_volume', autospec=True) + self.patch('cinder.volume.volume_utils.clear_volume', autospec=True) self.expected_status = 'available' self.service_id = 1 self.user_context = context.RequestContext(user_id=fake.USER_ID, diff --git a/cinder/tests/unit/windows/test_iscsi.py b/cinder/tests/unit/windows/test_iscsi.py index 7404ccb28..3885cb528 100644 --- a/cinder/tests/unit/windows/test_iscsi.py +++ b/cinder/tests/unit/windows/test_iscsi.py @@ -260,8 +260,8 @@ class TestWindowsISCSIDriver(test.TestCase): self.assertEqual(expected_target_name, target_name) @mock.patch.object(windows_iscsi.WindowsISCSIDriver, '_get_target_name') - @mock.patch.object(windows_iscsi.utils, 'generate_username') - @mock.patch.object(windows_iscsi.utils, 'generate_password') + @mock.patch.object(windows_iscsi.volume_utils, 'generate_username') + @mock.patch.object(windows_iscsi.volume_utils, 'generate_password') def test_create_export(self, mock_generate_password, mock_generate_username, mock_get_target_name): diff --git a/cinder/transfer/api.py b/cinder/transfer/api.py index 75f5cf007..955eeed14 100644 --- a/cinder/transfer/api.py +++ b/cinder/transfer/api.py @@ -35,7 +35,7 @@ from cinder.policies import volume_transfer as policy from cinder import quota from cinder import quota_utils from cinder.volume import api as volume_api -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils volume_transfer_opts = [ diff --git a/cinder/volume/api.py b/cinder/volume/api.py index 21f9d62e1..185590c0d 100644 --- a/cinder/volume/api.py +++ b/cinder/volume/api.py @@ -61,8 +61,8 @@ from cinder import utils from cinder.volume.flows.api import create_volume from cinder.volume.flows.api import manage_existing from cinder.volume import rpcapi as volume_rpcapi -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils allow_force_upload_opt = cfg.BoolOpt('enable_force_upload', default=False, diff --git a/cinder/volume/drivers/datera/datera_api2.py b/cinder/volume/drivers/datera/datera_api2.py index 23a31d50c..1ed23eddb 100644 --- a/cinder/volume/drivers/datera/datera_api2.py +++ b/cinder/volume/drivers/datera/datera_api2.py @@ -26,7 +26,7 @@ from oslo_utils import units from cinder import exception from cinder.i18n import _ -from cinder.volume import utils as volutils +from cinder.volume import volume_utils import cinder.volume.drivers.datera.datera_common as datc @@ -579,7 +579,7 @@ class DateraApi(object): 'cinder_id': cinder_id, 'extra_info': extra_info}) - page_results = volutils.paginate_entries_list( + page_results = volume_utils.paginate_entries_list( results, marker, limit, offset, sort_keys, sort_dirs) return page_results diff --git a/cinder/volume/drivers/datera/datera_api21.py b/cinder/volume/drivers/datera/datera_api21.py index 80f68490c..b4a75d16e 100644 --- a/cinder/volume/drivers/datera/datera_api21.py +++ b/cinder/volume/drivers/datera/datera_api21.py @@ -27,7 +27,7 @@ from oslo_utils import units from cinder import exception from cinder.i18n import _ -from cinder.volume import utils as volutils +from cinder.volume import volume_utils import cinder.volume.drivers.datera.datera_common as datc @@ -701,7 +701,7 @@ class DateraApi(object): 'cinder_id': cinder_id, 'extra_info': extra_info}) - page_results = volutils.paginate_entries_list( + page_results = volume_utils.paginate_entries_list( results, marker, limit, offset, sort_keys, sort_dirs) return page_results diff --git a/cinder/volume/drivers/dell_emc/powermax/common.py b/cinder/volume/drivers/dell_emc/powermax/common.py index fa09e598f..c0087032d 100644 --- a/cinder/volume/drivers/dell_emc/powermax/common.py +++ b/cinder/volume/drivers/dell_emc/powermax/common.py @@ -37,8 +37,8 @@ from cinder.volume.drivers.dell_emc.powermax import metadata as volume_metadata from cinder.volume.drivers.dell_emc.powermax import provision from cinder.volume.drivers.dell_emc.powermax import rest from cinder.volume.drivers.dell_emc.powermax import utils -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) CONF = cfg.CONF diff --git a/cinder/volume/drivers/dell_emc/powermax/masking.py b/cinder/volume/drivers/dell_emc/powermax/masking.py index e848c0ecf..5ff79bb57 100644 --- a/cinder/volume/drivers/dell_emc/powermax/masking.py +++ b/cinder/volume/drivers/dell_emc/powermax/masking.py @@ -27,7 +27,7 @@ from cinder import exception from cinder.i18n import _ from cinder.volume.drivers.dell_emc.powermax import provision from cinder.volume.drivers.dell_emc.powermax import utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/dell_emc/powermax/utils.py b/cinder/volume/drivers/dell_emc/powermax/utils.py index ec4d2c5cb..d471becf3 100644 --- a/cinder/volume/drivers/dell_emc/powermax/utils.py +++ b/cinder/volume/drivers/dell_emc/powermax/utils.py @@ -27,8 +27,8 @@ import six from cinder import exception from cinder.i18n import _ from cinder.objects import fields -from cinder.volume import utils as vol_utils from cinder.volume import volume_types +from cinder.volume import volume_utils as vol_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py b/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py index 80b063437..2b61f6d02 100644 --- a/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py +++ b/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py @@ -26,8 +26,8 @@ from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.dell_emc.sc import storagecenter_api from cinder.volume.drivers.san.san import san_opts -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils common_opts = [ cfg.IntOpt('dell_sc_ssn', diff --git a/cinder/volume/drivers/dell_emc/unity/adapter.py b/cinder/volume/drivers/dell_emc/unity/adapter.py index 755eb8fcf..96afe7d41 100644 --- a/cinder/volume/drivers/dell_emc/unity/adapter.py +++ b/cinder/volume/drivers/dell_emc/unity/adapter.py @@ -30,7 +30,7 @@ from cinder.objects import fields from cinder import utils as cinder_utils from cinder.volume.drivers.dell_emc.unity import client from cinder.volume.drivers.dell_emc.unity import utils -from cinder.volume import utils as vol_utils +from cinder.volume import volume_utils as vol_utils storops = importutils.try_import('storops') if storops: diff --git a/cinder/volume/drivers/dell_emc/unity/driver.py b/cinder/volume/drivers/dell_emc/unity/driver.py index 646e17621..81963c111 100644 --- a/cinder/volume/drivers/dell_emc/unity/driver.py +++ b/cinder/volume/drivers/dell_emc/unity/driver.py @@ -25,7 +25,7 @@ from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.dell_emc.unity import adapter from cinder.volume.drivers.san.san import san_opts -from cinder.volume import utils +from cinder.volume import volume_utils from cinder.zonemanager import utils as zm_utils LOG = logging.getLogger(__name__) @@ -53,7 +53,7 @@ def skip_if_not_cg(func): @six.wraps(func) def inner(self, *args, **kwargs): # Only used to decorating the second argument is `group` - if utils.is_group_a_cg_snapshot_type(args[1]): + if volume_utils.is_group_a_cg_snapshot_type(args[1]): return func(self, *args, **kwargs) LOG.debug('Group is not a consistency group. Unity driver does ' diff --git a/cinder/volume/drivers/dell_emc/unity/utils.py b/cinder/volume/drivers/dell_emc/unity/utils.py index d931924a0..0298f2f16 100644 --- a/cinder/volume/drivers/dell_emc/unity/utils.py +++ b/cinder/volume/drivers/dell_emc/unity/utils.py @@ -27,8 +27,8 @@ from cinder import coordination from cinder import exception from cinder.i18n import _ from cinder.objects import fields -from cinder.volume import utils as vol_utils from cinder.volume import volume_types +from cinder.volume import volume_utils as vol_utils from cinder.zonemanager import utils as zm_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/dell_emc/vnx/adapter.py b/cinder/volume/drivers/dell_emc/vnx/adapter.py index 51f87623f..47dd69de5 100644 --- a/cinder/volume/drivers/dell_emc/vnx/adapter.py +++ b/cinder/volume/drivers/dell_emc/vnx/adapter.py @@ -34,7 +34,7 @@ from cinder.volume.drivers.dell_emc.vnx import common from cinder.volume.drivers.dell_emc.vnx import replication from cinder.volume.drivers.dell_emc.vnx import taskflows as emc_taskflow from cinder.volume.drivers.dell_emc.vnx import utils -from cinder.volume import utils as vol_utils +from cinder.volume import volume_utils as vol_utils from cinder.zonemanager import utils as zm_utils storops = importutils.try_import('storops') diff --git a/cinder/volume/drivers/dell_emc/vnx/utils.py b/cinder/volume/drivers/dell_emc/vnx/utils.py index eebc70cbe..c3abe93e7 100644 --- a/cinder/volume/drivers/dell_emc/vnx/utils.py +++ b/cinder/volume/drivers/dell_emc/vnx/utils.py @@ -27,8 +27,8 @@ from cinder.i18n import _ from cinder.objects import fields from cinder.volume.drivers.dell_emc.vnx import common from cinder.volume.drivers.san.san import san_opts -from cinder.volume import utils as vol_utils from cinder.volume import volume_types +from cinder.volume import volume_utils as vol_utils storops = importutils.try_import('storops') diff --git a/cinder/volume/drivers/dell_emc/vxflexos/driver.py b/cinder/volume/drivers/dell_emc/vxflexos/driver.py index ddf940283..d59656e3c 100644 --- a/cinder/volume/drivers/dell_emc/vxflexos/driver.py +++ b/cinder/volume/drivers/dell_emc/vxflexos/driver.py @@ -47,8 +47,8 @@ from cinder.volume.drivers.dell_emc.vxflexos import options from cinder.volume.drivers.dell_emc.vxflexos import simplecache from cinder.volume.drivers.san import san from cinder.volume import qos_specs -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils CONF = cfg.CONF diff --git a/cinder/volume/drivers/dell_emc/xtremio.py b/cinder/volume/drivers/dell_emc/xtremio.py index bbcc21e18..b667a4907 100644 --- a/cinder/volume/drivers/dell_emc/xtremio.py +++ b/cinder/volume/drivers/dell_emc/xtremio.py @@ -55,7 +55,7 @@ from cinder import utils from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san -from cinder.volume import utils as vutils +from cinder.volume import volume_utils as vutils from cinder.zonemanager import utils as fczm_utils diff --git a/cinder/volume/drivers/fusionstorage/dsware.py b/cinder/volume/drivers/fusionstorage/dsware.py index a13515fa5..8a047c881 100644 --- a/cinder/volume/drivers/fusionstorage/dsware.py +++ b/cinder/volume/drivers/fusionstorage/dsware.py @@ -26,7 +26,7 @@ from cinder.volume import driver from cinder.volume.drivers.fusionstorage import fs_client from cinder.volume.drivers.fusionstorage import fs_conf from cinder.volume.drivers.san import san -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/hpe/hpe_3par_common.py b/cinder/volume/drivers/hpe/hpe_3par_common.py index e3e3d397d..adad9b309 100644 --- a/cinder/volume/drivers/hpe/hpe_3par_common.py +++ b/cinder/volume/drivers/hpe/hpe_3par_common.py @@ -58,8 +58,8 @@ from cinder.objects import fields from cinder import utils from cinder.volume import configuration from cinder.volume import qos_specs -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils import taskflow.engines from taskflow.patterns import linear_flow diff --git a/cinder/volume/drivers/hpe/hpe_3par_iscsi.py b/cinder/volume/drivers/hpe/hpe_3par_iscsi.py index 519e2ef9d..d47c82fd3 100644 --- a/cinder/volume/drivers/hpe/hpe_3par_iscsi.py +++ b/cinder/volume/drivers/hpe/hpe_3par_iscsi.py @@ -44,7 +44,7 @@ from cinder.i18n import _ from cinder import interface from cinder import utils from cinder.volume.drivers.hpe import hpe_3par_base as hpebasedriver -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py b/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py index a825a4b9c..0f7131c93 100644 --- a/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py +++ b/cinder/volume/drivers/hpe/hpe_lefthand_iscsi.py @@ -51,8 +51,8 @@ from cinder import utils as cinder_utils from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san -from cinder.volume import utils from cinder.volume import volume_types +from cinder.volume import volume_utils as utils import math import re diff --git a/cinder/volume/drivers/huawei/common.py b/cinder/volume/drivers/huawei/common.py index 0a447fe1f..3b8053430 100644 --- a/cinder/volume/drivers/huawei/common.py +++ b/cinder/volume/drivers/huawei/common.py @@ -38,8 +38,8 @@ from cinder.volume.drivers.huawei import hypermetro from cinder.volume.drivers.huawei import replication from cinder.volume.drivers.huawei import rest_client from cinder.volume.drivers.huawei import smartx -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/ibm/flashsystem_common.py b/cinder/volume/drivers/ibm/flashsystem_common.py index 4b22e2d08..af4ebe4d3 100644 --- a/cinder/volume/drivers/ibm/flashsystem_common.py +++ b/cinder/volume/drivers/ibm/flashsystem_common.py @@ -41,8 +41,8 @@ from cinder import utils from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/ibm/gpfs.py b/cinder/volume/drivers/ibm/gpfs.py index 2fedd349d..3a63f9bba 100644 --- a/cinder/volume/drivers/ibm/gpfs.py +++ b/cinder/volume/drivers/ibm/gpfs.py @@ -40,7 +40,7 @@ from cinder.volume import driver from cinder.volume.drivers import nfs from cinder.volume.drivers import remotefs from cinder.volume.drivers.san import san -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils GPFS_CLONE_MIN_RELEASE = 1200 GPFS_ENC_MIN_RELEASE = 1404 diff --git a/cinder/volume/drivers/ibm/ibm_storage/ds8k_proxy.py b/cinder/volume/drivers/ibm/ibm_storage/ds8k_proxy.py index ac374f1cf..93c9996f1 100644 --- a/cinder/volume/drivers/ibm/ibm_storage/ds8k_proxy.py +++ b/cinder/volume/drivers/ibm/ibm_storage/ds8k_proxy.py @@ -82,8 +82,8 @@ from cinder.volume.drivers.ibm.ibm_storage import ds8k_helper as helper from cinder.volume.drivers.ibm.ibm_storage import ds8k_restclient as restclient from cinder.volume.drivers.ibm.ibm_storage import proxy from cinder.volume.drivers.ibm.ibm_storage import strings -from cinder.volume import utils from cinder.volume import volume_types +from cinder.volume import volume_utils as utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/ibm/ibm_storage/xiv_proxy.py b/cinder/volume/drivers/ibm/ibm_storage/xiv_proxy.py index 80741029e..a327f0448 100644 --- a/cinder/volume/drivers/ibm/ibm_storage/xiv_proxy.py +++ b/cinder/volume/drivers/ibm/ibm_storage/xiv_proxy.py @@ -42,8 +42,8 @@ from cinder.volume.drivers.ibm.ibm_storage import strings from cinder.volume.drivers.ibm.ibm_storage import xiv_replication as repl from cinder.volume import group_types from cinder.volume import qos_specs -from cinder.volume import utils from cinder.volume import volume_types +from cinder.volume import volume_utils as utils OPENSTACK_PRODUCT_NAME = "OpenStack" diff --git a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py index 335ebf3ed..a7c052610 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py +++ b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py @@ -48,8 +48,8 @@ from cinder.volume.drivers.ibm.storwize_svc import ( from cinder.volume.drivers.ibm.storwize_svc import storwize_const from cinder.volume.drivers.san import san from cinder.volume import qos_specs -from cinder.volume import utils from cinder.volume import volume_types +from cinder.volume import volume_utils as utils INTERVAL_1_SEC = 1 diff --git a/cinder/volume/drivers/infinidat.py b/cinder/volume/drivers/infinidat.py index dca5ed84b..f26b73f4a 100644 --- a/cinder/volume/drivers/infinidat.py +++ b/cinder/volume/drivers/infinidat.py @@ -35,8 +35,8 @@ from cinder import utils from cinder import version from cinder.volume import configuration from cinder.volume.drivers.san import san -from cinder.volume import utils as vol_utils from cinder.volume import volume_types +from cinder.volume import volume_utils as vol_utils from cinder.zonemanager import utils as fczm_utils try: diff --git a/cinder/volume/drivers/infortrend/raidcmd_cli/common_cli.py b/cinder/volume/drivers/infortrend/raidcmd_cli/common_cli.py index caac42961..1061038a0 100644 --- a/cinder/volume/drivers/infortrend/raidcmd_cli/common_cli.py +++ b/cinder/volume/drivers/infortrend/raidcmd_cli/common_cli.py @@ -30,8 +30,8 @@ from cinder import exception from cinder.i18n import _ from cinder.volume.drivers.infortrend.raidcmd_cli import cli_factory as cli from cinder.volume.drivers.san import san -from cinder.volume import utils from cinder.volume import volume_types +from cinder.volume import volume_utils from cinder.zonemanager import utils as fczm_utils LOG = logging.getLogger(__name__) @@ -2612,8 +2612,9 @@ class InfortrendCommon(object): } manageable_volumes.append(volume) - return utils.paginate_entries_list(manageable_volumes, marker, limit, - offset, sort_keys, sort_dirs) + return volume_utils.paginate_entries_list(manageable_volumes, marker, + limit, offset, sort_keys, + sort_dirs) def manage_existing_snapshot(self, snapshot, existing_ref): """Brings existing backend storage object under Cinder management.""" @@ -2699,8 +2700,9 @@ class InfortrendCommon(object): manageable_snapshots.append(return_si) - return utils.paginate_entries_list(manageable_snapshots, marker, limit, - offset, sort_keys, sort_dirs) + return volume_utils.paginate_entries_list(manageable_snapshots, marker, + limit, offset, sort_keys, + sort_dirs) def unmanage_snapshot(self, snapshot): """Removes the specified snapshot from Cinder management.""" diff --git a/cinder/volume/drivers/inspur/as13000/as13000_driver.py b/cinder/volume/drivers/inspur/as13000/as13000_driver.py index 944880bef..b237b5af5 100644 --- a/cinder/volume/drivers/inspur/as13000/as13000_driver.py +++ b/cinder/volume/drivers/inspur/as13000/as13000_driver.py @@ -34,7 +34,7 @@ from cinder.i18n import _ from cinder import interface from cinder import utils from cinder.volume.drivers.san import san -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/inspur/instorage/instorage_common.py b/cinder/volume/drivers/inspur/instorage/instorage_common.py index e1c759537..d4bc227e1 100644 --- a/cinder/volume/drivers/inspur/instorage/instorage_common.py +++ b/cinder/volume/drivers/inspur/instorage/instorage_common.py @@ -44,8 +44,8 @@ from cinder.volume.drivers.inspur.instorage import ( from cinder.volume.drivers.inspur.instorage import instorage_const from cinder.volume.drivers.san import san from cinder.volume import qos_specs -from cinder.volume import utils from cinder.volume import volume_types +from cinder.volume import volume_utils INTERVAL_1_SEC = 1 DEFAULT_TIMEOUT = 20 @@ -416,7 +416,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver): opts = self._get_vdisk_params( volume.volume_type_id, volume_metadata=volume.get('volume_metadata')) - pool = utils.extract_host(volume.host, 'pool') + pool = volume_utils.extract_host(volume.host, 'pool') opts['iogrp'] = self._assistant.select_io_group(self._state, opts) self._assistant.create_vdisk(volume.name, six.text_type(volume.size), @@ -451,7 +451,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver): opts = self._get_vdisk_params( volume.volume_type_id, volume_metadata=volume.get('volume_metadata')) - pool = utils.extract_host(volume.host, 'pool') + pool = volume_utils.extract_host(volume.host, 'pool') self._assistant.create_copy(snapshot.name, volume.name, snapshot.id, self.configuration, opts, True, pool=pool) @@ -495,7 +495,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver): opts = self._get_vdisk_params( tgt_volume.volume_type_id, volume_metadata=tgt_volume.get('volume_metadata')) - pool = utils.extract_host(tgt_volume.host, 'pool') + pool = volume_utils.extract_host(tgt_volume.host, 'pool') self._assistant.create_copy(src_volume.name, tgt_volume.name, src_volume.id, self.configuration, opts, True, pool=pool) @@ -606,7 +606,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver): def create_snapshot(self, snapshot): source_vol = snapshot.volume - pool = utils.extract_host(source_vol.host, 'pool') + pool = volume_utils.extract_host(source_vol.host, 'pool') opts = self._get_vdisk_params(source_vol.volume_type_id) self._assistant.create_copy(snapshot.volume_name, snapshot.name, snapshot.volume_id, self.configuration, @@ -757,8 +757,8 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver): elif key in no_copy_keys: vdisk_changes.append(key) - if (utils.extract_host(volume.host, 'pool') != - utils.extract_host(host['host'], 'pool')): + if (volume_utils.extract_host(volume.host, 'pool') != + volume_utils.extract_host(host['host'], 'pool')): need_copy = True # Check if retype affects volume replication @@ -960,7 +960,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver): {'vdisk_iogrp': vdisk['IO_group_name'], 'opt_iogrp': opts['iogrp']}) raise exception.ManageExistingVolumeTypeMismatch(reason=msg) - pool = utils.extract_host(volume.host, 'pool') + pool = volume_utils.extract_host(volume.host, 'pool') if vdisk['mdisk_grp_name'] != pool: msg = (_("Failed to manage existing volume due to the " "pool of the volume to be managed does not " @@ -1032,7 +1032,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver): """ # now we only support consistent group - if not utils.is_group_a_cg_snapshot_type(group): + if not volume_utils.is_group_a_cg_snapshot_type(group): raise NotImplementedError() LOG.debug("Creating group.") @@ -1056,7 +1056,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver): """ # now we only support consistent group - if not utils.is_group_a_cg_snapshot_type(group): + if not volume_utils.is_group_a_cg_snapshot_type(group): raise NotImplementedError() LOG.debug('Enter: create_group_from_src.') @@ -1094,7 +1094,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver): """ # now we only support consistent group - if not utils.is_group_a_cg_snapshot_type(group): + if not volume_utils.is_group_a_cg_snapshot_type(group): raise NotImplementedError() LOG.debug("Deleting group.") @@ -1123,7 +1123,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver): remove_volumes=None): """Adds or removes volume(s) to/from an existing group.""" - if not utils.is_group_a_cg_snapshot_type(group): + if not volume_utils.is_group_a_cg_snapshot_type(group): raise NotImplementedError() LOG.debug("Updating group.") @@ -1134,7 +1134,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver): """Creates a cgsnapshot.""" # now we only support consistent group - if not utils.is_group_a_cg_snapshot_type(group_snapshot): + if not volume_utils.is_group_a_cg_snapshot_type(group_snapshot): raise NotImplementedError() # Use cgsnapshot id as cg name @@ -1156,7 +1156,7 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver): """Deletes a cgsnapshot.""" # now we only support consistent group - if not utils.is_group_a_cg_snapshot_type(group_snapshot): + if not volume_utils.is_group_a_cg_snapshot_type(group_snapshot): raise NotImplementedError() group_snapshot_id = group_snapshot.id @@ -1896,7 +1896,7 @@ class InStorageAssistant(object): def add_chap_secret_to_host(self, host_name): """Generate and store a randomly-generated CHAP secret for the host.""" - chap_secret = utils.generate_password() + chap_secret = volume_utils.generate_password() self.ssh.add_chap_secret(chap_secret, host_name) return chap_secret @@ -2700,7 +2700,7 @@ class InStorageAssistant(object): for source, target in zip(sources, targets): opts = self.get_vdisk_params(config, state, source.volume_type_id) - pool = utils.extract_host(target.host, 'pool') + pool = volume_utils.extract_host(target.host, 'pool') self.create_localcopy_to_consistgrp(source.name, target.name, lc_group, diff --git a/cinder/volume/drivers/inspur/instorage/instorage_fc.py b/cinder/volume/drivers/inspur/instorage/instorage_fc.py index ec290b065..402be46da 100644 --- a/cinder/volume/drivers/inspur/instorage/instorage_fc.py +++ b/cinder/volume/drivers/inspur/instorage/instorage_fc.py @@ -28,7 +28,7 @@ from cinder import interface from cinder import utils as cinder_utils from cinder.volume import driver from cinder.volume.drivers.inspur.instorage import instorage_common -from cinder.volume import utils +from cinder.volume import volume_utils as utils from cinder.zonemanager import utils as fczm_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/kaminario/kaminario_common.py b/cinder/volume/drivers/kaminario/kaminario_common.py index 4a84b42db..c60b4ccbc 100644 --- a/cinder/volume/drivers/kaminario/kaminario_common.py +++ b/cinder/volume/drivers/kaminario/kaminario_common.py @@ -36,7 +36,7 @@ from cinder.objects import fields from cinder import utils from cinder.volume import configuration from cinder.volume.drivers.san import san -from cinder.volume import utils as vol_utils +from cinder.volume import volume_utils as vol_utils krest = importutils.try_import("krest") diff --git a/cinder/volume/drivers/lvm.py b/cinder/volume/drivers/lvm.py index 6e50d9120..6e6c8590b 100644 --- a/cinder/volume/drivers/lvm.py +++ b/cinder/volume/drivers/lvm.py @@ -35,7 +35,7 @@ from cinder import interface from cinder import utils from cinder.volume import configuration from cinder.volume import driver -from cinder.volume import utils as volutils +from cinder.volume import volume_utils as volutils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/macrosan/driver.py b/cinder/volume/drivers/macrosan/driver.py index b2eb8175b..f26691eba 100644 --- a/cinder/volume/drivers/macrosan/driver.py +++ b/cinder/volume/drivers/macrosan/driver.py @@ -39,8 +39,8 @@ from cinder.volume.drivers.macrosan import config from cinder.volume.drivers.macrosan import devop_client from cinder.volume.drivers.san import san from cinder.volume import qos_specs -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils from cinder.zonemanager import utils as fczm_utils version = '1.0.1' diff --git a/cinder/volume/drivers/nec/volume_helper.py b/cinder/volume/drivers/nec/volume_helper.py index 8ae2d9a9f..d429bd0f3 100644 --- a/cinder/volume/drivers/nec/volume_helper.py +++ b/cinder/volume/drivers/nec/volume_helper.py @@ -26,7 +26,7 @@ from cinder import exception from cinder.i18n import _ from cinder.volume.drivers.nec import cli from cinder.volume.drivers.nec import volume_common -from cinder.volume import utils as volutils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) @@ -1607,8 +1607,8 @@ class MStorageDriver(volume_common.MStorageVolumeCommon): entries.append(ld_info) - return volutils.paginate_entries_list(entries, marker, limit, offset, - sort_keys, sort_dirs) + return volume_utils.paginate_entries_list(entries, marker, limit, + offset, sort_keys, sort_dirs) def _manage_existing_get_size(self, resource_type, volume, existing_ref): if 'source-name' not in existing_ref: diff --git a/cinder/volume/drivers/netapp/dataontap/block_base.py b/cinder/volume/drivers/netapp/dataontap/block_base.py index 76adf01a2..1bc52643a 100644 --- a/cinder/volume/drivers/netapp/dataontap/block_base.py +++ b/cinder/volume/drivers/netapp/dataontap/block_base.py @@ -43,7 +43,7 @@ from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api from cinder.volume.drivers.netapp.dataontap.utils import loopingcalls from cinder.volume.drivers.netapp import options as na_opts from cinder.volume.drivers.netapp import utils as na_utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils from cinder.zonemanager import utils as fczm_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/netapp/dataontap/block_cmode.py b/cinder/volume/drivers/netapp/dataontap/block_cmode.py index d6c46ad30..741dd4c27 100644 --- a/cinder/volume/drivers/netapp/dataontap/block_cmode.py +++ b/cinder/volume/drivers/netapp/dataontap/block_cmode.py @@ -40,7 +40,7 @@ from cinder.volume.drivers.netapp.dataontap.utils import loopingcalls from cinder.volume.drivers.netapp.dataontap.utils import utils as dot_utils from cinder.volume.drivers.netapp import options as na_opts from cinder.volume.drivers.netapp import utils as na_utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/netapp/dataontap/client/client_cmode.py b/cinder/volume/drivers/netapp/dataontap/client/client_cmode.py index b676aadd8..4fd791978 100644 --- a/cinder/volume/drivers/netapp/dataontap/client/client_cmode.py +++ b/cinder/volume/drivers/netapp/dataontap/client/client_cmode.py @@ -30,7 +30,7 @@ from cinder import utils from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api from cinder.volume.drivers.netapp.dataontap.client import client_base from cinder.volume.drivers.netapp import utils as na_utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils from oslo_utils import strutils diff --git a/cinder/volume/drivers/netapp/dataontap/nfs_base.py b/cinder/volume/drivers/netapp/dataontap/nfs_base.py index 4016c2b7f..e5c0f8aa3 100644 --- a/cinder/volume/drivers/netapp/dataontap/nfs_base.py +++ b/cinder/volume/drivers/netapp/dataontap/nfs_base.py @@ -46,7 +46,7 @@ from cinder.volume.drivers.netapp.dataontap.utils import loopingcalls from cinder.volume.drivers.netapp import options as na_opts from cinder.volume.drivers.netapp import utils as na_utils from cinder.volume.drivers import nfs -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/netapp/dataontap/nfs_cmode.py b/cinder/volume/drivers/netapp/dataontap/nfs_cmode.py index d135cb8f2..fe50eda75 100644 --- a/cinder/volume/drivers/netapp/dataontap/nfs_cmode.py +++ b/cinder/volume/drivers/netapp/dataontap/nfs_cmode.py @@ -42,7 +42,7 @@ from cinder.volume.drivers.netapp.dataontap.utils import loopingcalls from cinder.volume.drivers.netapp.dataontap.utils import utils as dot_utils from cinder.volume.drivers.netapp import options as na_opts from cinder.volume.drivers.netapp import utils as na_utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/netapp/dataontap/utils/data_motion.py b/cinder/volume/drivers/netapp/dataontap/utils/data_motion.py index e60f48ba6..d158d046d 100644 --- a/cinder/volume/drivers/netapp/dataontap/utils/data_motion.py +++ b/cinder/volume/drivers/netapp/dataontap/utils/data_motion.py @@ -30,7 +30,7 @@ from cinder import utils from cinder.volume.drivers.netapp.dataontap.client import api as netapp_api from cinder.volume.drivers.netapp.dataontap.utils import utils as config_utils from cinder.volume.drivers.netapp import utils as na_utils -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = log.getLogger(__name__) ENTRY_DOES_NOT_EXIST = "(entry doesn't exist)" diff --git a/cinder/volume/drivers/nexenta/ns5/iscsi.py b/cinder/volume/drivers/nexenta/ns5/iscsi.py index a2dbf2a49..5a45eb68f 100644 --- a/cinder/volume/drivers/nexenta/ns5/iscsi.py +++ b/cinder/volume/drivers/nexenta/ns5/iscsi.py @@ -30,7 +30,7 @@ from cinder import objects from cinder.volume import driver from cinder.volume.drivers.nexenta.ns5 import jsonrpc from cinder.volume.drivers.nexenta import options -from cinder.volume import utils +from cinder.volume import volume_utils as utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/nexenta/ns5/nfs.py b/cinder/volume/drivers/nexenta/ns5/nfs.py index 59c4d728a..de254660a 100644 --- a/cinder/volume/drivers/nexenta/ns5/nfs.py +++ b/cinder/volume/drivers/nexenta/ns5/nfs.py @@ -32,7 +32,7 @@ from cinder.privsep import fs from cinder.volume.drivers.nexenta.ns5 import jsonrpc from cinder.volume.drivers.nexenta import options from cinder.volume.drivers import nfs -from cinder.volume import utils +from cinder.volume import volume_utils as utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py index 972b0193c..287f3efb5 100644 --- a/cinder/volume/drivers/nfs.py +++ b/cinder/volume/drivers/nfs.py @@ -33,7 +33,7 @@ from cinder import interface from cinder import utils from cinder.volume import configuration from cinder.volume.drivers import remotefs -from cinder.volume import utils as vutils +from cinder.volume import volume_utils VERSION = '1.4.0' @@ -118,7 +118,7 @@ class NfsDriver(remotefs.RemoteFSSnapDriverDistributed): self._sparse_copy_volume_data = True self.reserved_percentage = self.configuration.reserved_percentage self.max_over_subscription_ratio = ( - vutils.get_max_over_subscription_ratio( + volume_utils.get_max_over_subscription_ratio( self.configuration.max_over_subscription_ratio, supports_auto=supports_auto_mosr)) diff --git a/cinder/volume/drivers/prophetstor/dplcommon.py b/cinder/volume/drivers/prophetstor/dplcommon.py index 3192749c8..4e5d59bd2 100644 --- a/cinder/volume/drivers/prophetstor/dplcommon.py +++ b/cinder/volume/drivers/prophetstor/dplcommon.py @@ -41,7 +41,7 @@ from cinder.objects import fields from cinder.volume import driver from cinder.volume.drivers.prophetstor import options from cinder.volume.drivers.san import san -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/pure.py b/cinder/volume/drivers/pure.py index 7beb4069c..5eb4d3ce5 100644 --- a/cinder/volume/drivers/pure.py +++ b/cinder/volume/drivers/pure.py @@ -42,7 +42,7 @@ from cinder import utils from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils from cinder.zonemanager import utils as fczm_utils try: diff --git a/cinder/volume/drivers/rbd.py b/cinder/volume/drivers/rbd.py index 1c3f2bae5..70adce85b 100644 --- a/cinder/volume/drivers/rbd.py +++ b/cinder/volume/drivers/rbd.py @@ -43,7 +43,7 @@ from cinder.objects import fields from cinder import utils from cinder.volume import configuration from cinder.volume import driver -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils try: import rados diff --git a/cinder/volume/drivers/remotefs.py b/cinder/volume/drivers/remotefs.py index 0cbece222..d6314511b 100644 --- a/cinder/volume/drivers/remotefs.py +++ b/cinder/volume/drivers/remotefs.py @@ -42,7 +42,7 @@ from cinder.objects import fields from cinder import utils from cinder.volume import configuration from cinder.volume import driver -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/solidfire.py b/cinder/volume/drivers/solidfire.py index 0902feafe..cc64840df 100644 --- a/cinder/volume/drivers/solidfire.py +++ b/cinder/volume/drivers/solidfire.py @@ -41,8 +41,8 @@ from cinder.volume import configuration from cinder.volume.drivers.san import san from cinder.volume import qos_specs from cinder.volume.targets import iscsi as iscsi_driver -from cinder.volume import utils as vol_utils from cinder.volume import volume_types +from cinder.volume import volume_utils as vol_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/synology/synology_common.py b/cinder/volume/drivers/synology/synology_common.py index 277b3efa6..af4584b55 100644 --- a/cinder/volume/drivers/synology/synology_common.py +++ b/cinder/volume/drivers/synology/synology_common.py @@ -43,7 +43,7 @@ from cinder.objects import snapshot from cinder.objects import volume from cinder import utils from cinder.volume import configuration -from cinder.volume import utils as volutils +from cinder.volume import volume_utils as volutils cinder_opts = [ diff --git a/cinder/volume/drivers/windows/iscsi.py b/cinder/volume/drivers/windows/iscsi.py index f15907a1b..911d6beaa 100644 --- a/cinder/volume/drivers/windows/iscsi.py +++ b/cinder/volume/drivers/windows/iscsi.py @@ -34,7 +34,7 @@ from cinder.image import image_utils from cinder import interface from cinder.volume import configuration from cinder.volume import driver -from cinder.volume import utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) @@ -230,9 +230,9 @@ class WindowsISCSIDriver(driver.ISCSIDriver): if self.configuration.use_chap_auth: chap_username = (self.configuration.chap_username or - utils.generate_username()) + volume_utils.generate_username()) chap_password = (self.configuration.chap_password or - utils.generate_password()) + volume_utils.generate_password()) self._tgt_utils.set_chap_credentials(target_name, chap_username, diff --git a/cinder/volume/drivers/zfssa/zfssaiscsi.py b/cinder/volume/drivers/zfssa/zfssaiscsi.py index 2d3fe5bc3..4dec8078d 100644 --- a/cinder/volume/drivers/zfssa/zfssaiscsi.py +++ b/cinder/volume/drivers/zfssa/zfssaiscsi.py @@ -32,8 +32,8 @@ from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.san import san from cinder.volume.drivers.zfssa import zfssarest -from cinder.volume import utils as volume_utils from cinder.volume import volume_types +from cinder.volume import volume_utils import taskflow.engines from taskflow.patterns import linear_flow as lf diff --git a/cinder/volume/drivers/zfssa/zfssanfs.py b/cinder/volume/drivers/zfssa/zfssanfs.py index e554c6f8f..f8778b610 100644 --- a/cinder/volume/drivers/zfssa/zfssanfs.py +++ b/cinder/volume/drivers/zfssa/zfssanfs.py @@ -36,7 +36,7 @@ from cinder.volume import configuration from cinder.volume.drivers import nfs from cinder.volume.drivers.san import san from cinder.volume.drivers.zfssa import zfssarest -from cinder.volume import utils as vutils +from cinder.volume import volume_utils ZFSSA_OPTS = [ @@ -114,7 +114,7 @@ class ZFSSANFSDriver(nfs.NfsDriver): def do_setup(self, context): self.configuration.max_over_subscription_ratio = ( - vutils.get_max_over_subscription_ratio( + volume_utils.get_max_over_subscription_ratio( self.configuration.max_over_subscription_ratio, supports_auto=False)) diff --git a/cinder/volume/flows/api/create_volume.py b/cinder/volume/flows/api/create_volume.py index 12569f59c..3a511e969 100644 --- a/cinder/volume/flows/api/create_volume.py +++ b/cinder/volume/flows/api/create_volume.py @@ -29,8 +29,8 @@ from cinder import quota from cinder import quota_utils from cinder import utils from cinder.volume.flows import common -from cinder.volume import utils as vol_utils from cinder.volume import volume_types +from cinder.volume import volume_utils as vol_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/flows/manager/create_volume.py b/cinder/volume/flows/manager/create_volume.py index f701c4c68..11c3d91e7 100644 --- a/cinder/volume/flows/manager/create_volume.py +++ b/cinder/volume/flows/manager/create_volume.py @@ -37,7 +37,7 @@ from cinder.objects import consistencygroup from cinder.objects import fields from cinder import utils from cinder.volume.flows import common -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/flows/manager/manage_existing_snapshot.py b/cinder/volume/flows/manager/manage_existing_snapshot.py index bc9510869..a0d34e9b4 100644 --- a/cinder/volume/flows/manager/manage_existing_snapshot.py +++ b/cinder/volume/flows/manager/manage_existing_snapshot.py @@ -26,7 +26,7 @@ from cinder.objects import fields from cinder import quota from cinder import quota_utils from cinder.volume.flows import common as flow_common -from cinder.volume import utils as volume_utils +from cinder.volume import volume_utils CONF = cfg.CONF diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 7c4b91dea..b759d3a86 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -82,9 +82,9 @@ from cinder.volume.flows.manager import manage_existing from cinder.volume.flows.manager import manage_existing_snapshot from cinder.volume import group_types from cinder.volume import rpcapi as volume_rpcapi -from cinder.volume import utils as vol_utils from cinder.volume import volume_migration from cinder.volume import volume_types +from cinder.volume import volume_utils as vol_utils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/rpcapi.py b/cinder/volume/rpcapi.py index 36f1afa18..e43a0d447 100644 --- a/cinder/volume/rpcapi.py +++ b/cinder/volume/rpcapi.py @@ -17,7 +17,7 @@ from cinder.common import constants from cinder import objects from cinder import quota from cinder import rpc -from cinder.volume import utils +from cinder.volume import volume_utils QUOTAS = quota.QUOTAS @@ -143,7 +143,7 @@ class VolumeAPI(rpc.RPCAPI): def _get_cctxt(self, host=None, version=None, **kwargs): if host: - server = utils.extract_host(host) + server = volume_utils.extract_host(host) # TODO(dulek): If we're pinned before 3.6, we should send stuff the # old way - addressing server=host@backend, topic=cinder-volume. @@ -153,7 +153,7 @@ class VolumeAPI(rpc.RPCAPI): if self.client.can_send_version('3.6'): kwargs['topic'] = '%(topic)s.%(host)s' % {'topic': self.TOPIC, 'host': server} - server = utils.extract_host(server, 'host') + server = volume_utils.extract_host(server, 'host') kwargs['server'] = server return super(VolumeAPI, self)._get_cctxt(version=version, **kwargs) diff --git a/cinder/volume/targets/iscsi.py b/cinder/volume/targets/iscsi.py index 03bf7ef7d..8faa05a4b 100644 --- a/cinder/volume/targets/iscsi.py +++ b/cinder/volume/targets/iscsi.py @@ -19,7 +19,7 @@ from cinder import exception from cinder.i18n import _ from cinder import utils from cinder.volume.targets import driver -from cinder.volume import utils as vutils +from cinder.volume import volume_utils LOG = logging.getLogger(__name__) @@ -192,8 +192,8 @@ class ISCSITarget(driver.Target): # if DNE no big deal, we'll just create it chap_auth = self._get_target_chap_auth(context, volume) if not chap_auth: - chap_auth = (vutils.generate_username(), - vutils.generate_password()) + chap_auth = (volume_utils.generate_username(), + volume_utils.generate_password()) # Get portals ips and port portals_config = self._get_portals_config() @@ -300,7 +300,8 @@ class ISCSITarget(driver.Target): def _iscsi_location(self, ip, target, iqn, lun=None, ip_secondary=None): ip_secondary = ip_secondary or [] port = self.configuration.target_port - portals = map(lambda x: "%s:%s" % (vutils.sanitize_host(x), port), + portals = map(lambda x: "%s:%s" % (volume_utils.sanitize_host(x), + port), [ip] + ip_secondary) return ("%(portals)s,%(target)s %(iqn)s %(lun)s" % ({'portals': ";".join(portals), diff --git a/cinder/volume/targets/scst.py b/cinder/volume/targets/scst.py index dcd7833f4..98542cfc4 100644 --- a/cinder/volume/targets/scst.py +++ b/cinder/volume/targets/scst.py @@ -17,7 +17,7 @@ from cinder import exception from cinder.i18n import _ import cinder.privsep.targets.scst from cinder.volume.targets import iscsi -from cinder.volume import utils as vutils +from cinder.volume import volume_utils as vutils LOG = logging.getLogger(__name__) diff --git a/cinder/volume/targets/spdknvmf.py b/cinder/volume/targets/spdknvmf.py index 6cea723c1..057d028c6 100644 --- a/cinder/volume/targets/spdknvmf.py +++ b/cinder/volume/targets/spdknvmf.py @@ -21,7 +21,7 @@ from cinder import exception from cinder.i18n import _ from cinder.volume import configuration from cinder.volume.targets import nvmeof -from cinder.volume import utils +from cinder.volume import volume_utils spdk_opts = [ cfg.StrOpt('spdk_rpc_ip', @@ -136,7 +136,7 @@ class SpdkNvmf(nvmeof.NVMeOF): nqn = '%s:cnode%s' % (subsystem_name, node) choice = string.ascii_uppercase + string.digits serial = ''.join( - utils.generate_password(length=12, symbolgroups=choice)) + volume_utils.generate_password(length=12, symbolgroups=choice)) params = { 'nqn': nqn, diff --git a/cinder/volume/utils.py b/cinder/volume/volume_utils.py index cd44511e3..cd44511e3 100644 --- a/cinder/volume/utils.py +++ b/cinder/volume/volume_utils.py |