From: Thomas Goirand Date: Tue, 23 Dec 2014 08:21:08 +0000 (+0800) Subject: Removed difference with upstream tag. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=4cd6f84e1c04b6d43c11c085bfaeac149ab7130c;p=openstack-build%2Fcinder-build.git Removed difference with upstream tag. --- diff --git a/.gitreview b/.gitreview index 36eccf55e..eecf93944 100644 --- a/.gitreview +++ b/.gitreview @@ -2,4 +2,3 @@ host=review.openstack.org port=29418 project=openstack/cinder.git -defaultbranch=stable/juno diff --git a/cinder/brick/iscsi/iscsi.py b/cinder/brick/iscsi/iscsi.py index af0e3efd4..c5afa617c 100644 --- a/cinder/brick/iscsi/iscsi.py +++ b/cinder/brick/iscsi/iscsi.py @@ -61,10 +61,6 @@ class TargetAdmin(executor.Executor): """Get the current chap auth username and password.""" return None - def _get_target_chap_auth(self, volume_id): - """Get the current chap auth username and password.""" - return None - def create_iscsi_target(self, name, tid, lun, path, chap_auth=None, **kwargs): """Create an iSCSI target and logical unit.""" diff --git a/cinder/locale/cinder.pot b/cinder/locale/cinder.pot index b0f6f20f7..8175fbccc 100644 --- a/cinder/locale/cinder.pot +++ b/cinder/locale/cinder.pot @@ -7329,14 +7329,6 @@ msgstr "" msgid "Error running SSH command: %s" msgstr "" -#: cinder/volume/drivers/san/san.py:151 -#: cinder/zonemanager/drivers/brocade/brcd_fc_zone_client_cli.py:417 -#: cinder/zonemanager/drivers/cisco/cisco_fc_san_lookup_service.py:271 -#: cinder/zonemanager/drivers/cisco/cisco_fc_zone_client_cli.py:397 -#, python-format -msgid "Error running SSH command: %s" -msgstr "" - #: cinder/volume/drivers/san/san.py:171 msgid "Specify san_password or san_private_key" msgstr "" @@ -7698,20 +7690,6 @@ msgstr "" msgid "Error: unknown lease state %s." msgstr "" -#: cinder/volume/drivers/vmware/datastore.py:61 -#, python-format -msgid "Storage profile: %s cannot be found in vCenter." -msgstr "" - -#: cinder/volume/drivers/vmware/datastore.py:212 -msgid "Error occurred while selecting datastore." -msgstr "" - -#: cinder/volume/drivers/vmware/datastore.py:217 -#, python-format -msgid "Unable to fetch datastores connected to host %s." -msgstr "" - #: cinder/volume/drivers/vmware/error_util.py:64 msgid "VMware VMDK driver exception." msgstr "" @@ -8133,9 +8111,7 @@ msgstr "" #: cinder/volume/drivers/vmware/vmdk.py:1953 #, python-format -msgid "" -"There are no datastores matching volume requirements; can't relocate " -"volume: %s." +msgid "Relocating volume: %(backing)s to %(ds)s and %(rp)s." msgstr "" #: cinder/volume/drivers/vmware/vmdk.py:2001 diff --git a/cinder/tests/brick/test_brick_connector.py b/cinder/tests/brick/test_brick_connector.py index 62a3efafc..357c51191 100644 --- a/cinder/tests/brick/test_brick_connector.py +++ b/cinder/tests/brick/test_brick_connector.py @@ -841,4 +841,4 @@ class HuaweiStorHyperConnectorTestCase(ConnectorTestCase): ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f'] LOG.debug("self.cmds = %s." % self.cmds) - LOG.debug("expected = %s." % expected_commands) + LOG.debug("expected = %s." % expected_commands) \ No newline at end of file diff --git a/cinder/tests/volume/drivers/netapp/test_iscsi.py b/cinder/tests/volume/drivers/netapp/test_iscsi.py deleted file mode 100644 index 836a9e08b..000000000 --- a/cinder/tests/volume/drivers/netapp/test_iscsi.py +++ /dev/null @@ -1,401 +0,0 @@ -# Copyright (c) 2014 NetApp, Inc. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -""" -Mock unit tests for the NetApp iSCSI driver -""" - -import uuid - -import mock - -from cinder import exception -from cinder import test -from cinder.tests.test_netapp import create_configuration -import cinder.volume.drivers.netapp.api as ntapi -import cinder.volume.drivers.netapp.iscsi as ntap_iscsi -from cinder.volume.drivers.netapp.iscsi import NetAppDirect7modeISCSIDriver \ - as iscsi7modeDriver -from cinder.volume.drivers.netapp.iscsi import NetAppDirectCmodeISCSIDriver \ - as iscsiCmodeDriver -from cinder.volume.drivers.netapp.iscsi import NetAppDirectISCSIDriver \ - as iscsiDriver -import cinder.volume.drivers.netapp.ssc_utils as ssc_utils -import cinder.volume.drivers.netapp.utils as na_utils - - -class NetAppDirectISCSIDriverTestCase(test.TestCase): - - def setUp(self): - super(NetAppDirectISCSIDriverTestCase, self).setUp() - configuration = self._set_config(create_configuration()) - self.driver = ntap_iscsi.NetAppDirectISCSIDriver( - configuration=configuration) - self.driver.client = mock.Mock() - self.fake_volume = str(uuid.uuid4()) - self.fake_lun = str(uuid.uuid4()) - self.fake_size = '1024' - self.fake_metadata = {'OsType': 'linux', 'SpaceReserved': 'true'} - self.mock_request = mock.Mock() - - def _set_config(self, configuration): - configuration.netapp_storage_protocol = 'iscsi' - configuration.netapp_login = 'admin' - configuration.netapp_password = 'pass' - configuration.netapp_server_hostname = '127.0.0.1' - configuration.netapp_transport_type = 'http' - configuration.netapp_server_port = '80' - return configuration - - def tearDown(self): - super(NetAppDirectISCSIDriverTestCase, self).tearDown() - - @mock.patch.object(iscsiDriver, '_get_lun_attr', - mock.Mock(return_value={'Volume': 'vol1'})) - def test_get_pool(self): - pool = self.driver.get_pool({'name': 'volume-fake-uuid'}) - self.assertEqual(pool, 'vol1') - - @mock.patch.object(iscsiDriver, '_get_lun_attr', - mock.Mock(return_value=None)) - def test_get_pool_no_metadata(self): - pool = self.driver.get_pool({'name': 'volume-fake-uuid'}) - self.assertEqual(pool, None) - - @mock.patch.object(iscsiDriver, '_get_lun_attr', - mock.Mock(return_value=dict())) - def test_get_pool_volume_unknown(self): - pool = self.driver.get_pool({'name': 'volume-fake-uuid'}) - self.assertEqual(pool, None) - - @mock.patch.object(iscsiDriver, 'create_lun', mock.Mock()) - @mock.patch.object(iscsiDriver, '_create_lun_handle', mock.Mock()) - @mock.patch.object(iscsiDriver, '_add_lun_to_table', mock.Mock()) - @mock.patch.object(ntap_iscsi, 'LOG', mock.Mock()) - @mock.patch.object(ntap_iscsi, 'get_volume_extra_specs', - mock.Mock(return_value=None)) - def test_create_volume(self): - self.driver.create_volume({'name': 'lun1', 'size': 100, - 'id': uuid.uuid4(), - 'host': 'hostname@backend#vol1'}) - self.driver.create_lun.assert_called_once_with( - 'vol1', 'lun1', 107374182400, mock.ANY, None) - self.assertEqual(0, ntap_iscsi.LOG.warn.call_count) - - def test_create_volume_no_pool_provided_by_scheduler(self): - self.assertRaises(exception.InvalidHost, self.driver.create_volume, - {'name': 'lun1', 'size': 100, - 'id': uuid.uuid4(), - 'host': 'hostname@backend'}) # missing pool - - @mock.patch.object(iscsiDriver, 'create_lun', mock.Mock()) - @mock.patch.object(iscsiDriver, '_create_lun_handle', mock.Mock()) - @mock.patch.object(iscsiDriver, '_add_lun_to_table', mock.Mock()) - @mock.patch.object(na_utils, 'LOG', mock.Mock()) - @mock.patch.object(ntap_iscsi, 'get_volume_extra_specs', - mock.Mock(return_value={'netapp:raid_type': 'raid4'})) - def test_create_volume_obsolete_extra_spec(self): - - self.driver.create_volume({'name': 'lun1', 'size': 100, - 'id': uuid.uuid4(), - 'host': 'hostname@backend#vol1'}) - warn_msg = 'Extra spec netapp:raid_type is obsolete. ' \ - 'Use netapp_raid_type instead.' - na_utils.LOG.warn.assert_called_once_with(warn_msg) - - @mock.patch.object(iscsiDriver, 'create_lun', mock.Mock()) - @mock.patch.object(iscsiDriver, '_create_lun_handle', mock.Mock()) - @mock.patch.object(iscsiDriver, '_add_lun_to_table', mock.Mock()) - @mock.patch.object(na_utils, 'LOG', mock.Mock()) - @mock.patch.object(ntap_iscsi, 'get_volume_extra_specs', - mock.Mock(return_value={'netapp_thick_provisioned': - 'true'})) - def test_create_volume_deprecated_extra_spec(self): - - self.driver.create_volume({'name': 'lun1', 'size': 100, - 'id': uuid.uuid4(), - 'host': 'hostname@backend#vol1'}) - warn_msg = 'Extra spec netapp_thick_provisioned is deprecated. ' \ - 'Use netapp_thin_provisioned instead.' - na_utils.LOG.warn.assert_called_once_with(warn_msg) - - def test_create_lun(self): - expected_path = '/vol/%s/%s' % (self.fake_volume, self.fake_lun) - - with mock.patch.object(ntapi.NaElement, 'create_node_with_children', - return_value=self.mock_request - ) as mock_create_node: - self.driver.create_lun(self.fake_volume, - self.fake_lun, - self.fake_size, - self.fake_metadata) - - mock_create_node.assert_called_once_with( - 'lun-create-by-size', - **{'path': expected_path, - 'size': self.fake_size, - 'ostype': self.fake_metadata['OsType'], - 'space-reservation-enabled': - self.fake_metadata['SpaceReserved']}) - self.driver.client.invoke_successfully.assert_called_once_with( - mock.ANY, True) - - def test_create_lun_with_qos_policy_group(self): - expected_path = '/vol/%s/%s' % (self.fake_volume, self.fake_lun) - expected_qos_group = 'qos_1' - - with mock.patch.object(ntapi.NaElement, 'create_node_with_children', - return_value=self.mock_request - ) as mock_create_node: - self.driver.create_lun(self.fake_volume, - self.fake_lun, - self.fake_size, - self.fake_metadata, - qos_policy_group=expected_qos_group) - - mock_create_node.assert_called_once_with( - 'lun-create-by-size', - **{'path': expected_path, 'size': self.fake_size, - 'ostype': self.fake_metadata['OsType'], - 'space-reservation-enabled': - self.fake_metadata['SpaceReserved']}) - self.mock_request.add_new_child.assert_called_once_with( - 'qos-policy-group', expected_qos_group) - self.driver.client.invoke_successfully.assert_called_once_with( - mock.ANY, True) - - def test_create_lun_raises_on_failure(self): - self.driver.client.invoke_successfully = mock.Mock( - side_effect=ntapi.NaApiError) - self.assertRaises(ntapi.NaApiError, - self.driver.create_lun, - self.fake_volume, - self.fake_lun, - self.fake_size, - self.fake_metadata) - - def test_update_volume_stats_is_abstract(self): - self.assertRaises(NotImplementedError, - self.driver._update_volume_stats) - - -class NetAppiSCSICModeTestCase(test.TestCase): - """Test case for NetApp's C-Mode iSCSI driver.""" - - def setUp(self): - super(NetAppiSCSICModeTestCase, self).setUp() - self.driver = ntap_iscsi.NetAppDirectCmodeISCSIDriver( - configuration=mock.Mock()) - self.driver.client = mock.Mock() - self.driver.vserver = mock.Mock() - self.driver.ssc_vols = None - - def tearDown(self): - super(NetAppiSCSICModeTestCase, self).tearDown() - - def test_clone_lun_multiple_zapi_calls(self): - """Test for when lun clone requires more than one zapi call.""" - - # Max block-ranges per call = 32, max blocks per range = 2^24 - # Force 2 calls - bc = 2 ** 24 * 32 * 2 - self.driver._get_lun_attr = mock.Mock(return_value={'Volume': - 'fakeLUN'}) - self.driver.client.invoke_successfully = mock.Mock() - lun = ntapi.NaElement.create_node_with_children( - 'lun-info', - **{'alignment': 'indeterminate', - 'block-size': '512', - 'comment': '', - 'creation-timestamp': '1354536362', - 'is-space-alloc-enabled': 'false', - 'is-space-reservation-enabled': 'true', - 'mapped': 'false', - 'multiprotocol-type': 'linux', - 'online': 'true', - 'path': '/vol/fakeLUN/lun1', - 'prefix-size': '0', - 'qtree': '', - 'read-only': 'false', - 'serial-number': '2FfGI$APyN68', - 'share-state': 'none', - 'size': '20971520', - 'size-used': '0', - 'staging': 'false', - 'suffix-size': '0', - 'uuid': 'cec1f3d7-3d41-11e2-9cf4-123478563412', - 'volume': 'fakeLUN', - 'vserver': 'fake_vserver'}) - self.driver._get_lun_by_args = mock.Mock(return_value=[lun]) - self.driver._add_lun_to_table = mock.Mock() - self.driver._update_stale_vols = mock.Mock() - - self.driver._clone_lun('fakeLUN', 'newFakeLUN', block_count=bc) - - self.assertEqual(2, self.driver.client.invoke_successfully.call_count) - - def test_clone_lun_zero_block_count(self): - """Test for when clone lun is not passed a block count.""" - - self.driver._get_lun_attr = mock.Mock(return_value={'Volume': - 'fakeLUN'}) - self.driver.client.invoke_successfully = mock.Mock() - lun = ntapi.NaElement.create_node_with_children( - 'lun-info', - **{'alignment': 'indeterminate', - 'block-size': '512', - 'comment': '', - 'creation-timestamp': '1354536362', - 'is-space-alloc-enabled': 'false', - 'is-space-reservation-enabled': 'true', - 'mapped': 'false', - 'multiprotocol-type': 'linux', - 'online': 'true', - 'path': '/vol/fakeLUN/lun1', - 'prefix-size': '0', - 'qtree': '', - 'read-only': 'false', - 'serial-number': '2FfGI$APyN68', - 'share-state': 'none', - 'size': '20971520', - 'size-used': '0', - 'staging': 'false', - 'suffix-size': '0', - 'uuid': 'cec1f3d7-3d41-11e2-9cf4-123478563412', - 'volume': 'fakeLUN', - 'vserver': 'fake_vserver'}) - self.driver._get_lun_by_args = mock.Mock(return_value=[lun]) - self.driver._add_lun_to_table = mock.Mock() - self.driver._update_stale_vols = mock.Mock() - - self.driver._clone_lun('fakeLUN', 'newFakeLUN') - - self.assertEqual(1, self.driver.client.invoke_successfully.call_count) - - @mock.patch.object(ssc_utils, 'refresh_cluster_ssc', mock.Mock()) - @mock.patch.object(iscsiCmodeDriver, '_get_pool_stats', mock.Mock()) - @mock.patch.object(na_utils, 'provide_ems', mock.Mock()) - def test_vol_stats_calls_provide_ems(self): - self.driver.get_volume_stats(refresh=True) - self.assertEqual(na_utils.provide_ems.call_count, 1) - - -class NetAppiSCSI7ModeTestCase(test.TestCase): - """Test case for NetApp's 7-Mode iSCSI driver.""" - - def setUp(self): - super(NetAppiSCSI7ModeTestCase, self).setUp() - self.driver = ntap_iscsi.NetAppDirect7modeISCSIDriver( - configuration=mock.Mock()) - self.driver.client = mock.Mock() - self.driver.vfiler = mock.Mock() - - def tearDown(self): - super(NetAppiSCSI7ModeTestCase, self).tearDown() - - def test_clone_lun_multiple_zapi_calls(self): - """Test for when lun clone requires more than one zapi call.""" - - # Max block-ranges per call = 32, max blocks per range = 2^24 - # Force 2 calls - bc = 2 ** 24 * 32 * 2 - self.driver._get_lun_attr = mock.Mock(return_value={'Volume': - 'fakeLUN', - 'Path': - '/vol/fake/lun1'}) - self.driver.client.invoke_successfully = mock.Mock( - return_value=mock.MagicMock()) - lun = ntapi.NaElement.create_node_with_children( - 'lun-info', - **{'alignment': 'indeterminate', - 'block-size': '512', - 'comment': '', - 'creation-timestamp': '1354536362', - 'is-space-alloc-enabled': 'false', - 'is-space-reservation-enabled': 'true', - 'mapped': 'false', - 'multiprotocol-type': 'linux', - 'online': 'true', - 'path': '/vol/fakeLUN/lun1', - 'prefix-size': '0', - 'qtree': '', - 'read-only': 'false', - 'serial-number': '2FfGI$APyN68', - 'share-state': 'none', - 'size': '20971520', - 'size-used': '0', - 'staging': 'false', - 'suffix-size': '0', - 'uuid': 'cec1f3d7-3d41-11e2-9cf4-123478563412', - 'volume': 'fakeLUN', - 'vserver': 'fake_vserver'}) - self.driver._get_lun_by_args = mock.Mock(return_value=[lun]) - self.driver._add_lun_to_table = mock.Mock() - self.driver._update_stale_vols = mock.Mock() - self.driver._check_clone_status = mock.Mock() - self.driver._set_space_reserve = mock.Mock() - - self.driver._clone_lun('fakeLUN', 'newFakeLUN', block_count=bc) - - self.assertEqual(2, self.driver.client.invoke_successfully.call_count) - - def test_clone_lun_zero_block_count(self): - """Test for when clone lun is not passed a block count.""" - - self.driver._get_lun_attr = mock.Mock(return_value={'Volume': - 'fakeLUN', - 'Path': - '/vol/fake/lun1'}) - self.driver.client.invoke_successfully = mock.Mock( - return_value=mock.MagicMock()) - lun = ntapi.NaElement.create_node_with_children( - 'lun-info', - **{'alignment': 'indeterminate', - 'block-size': '512', - 'comment': '', - 'creation-timestamp': '1354536362', - 'is-space-alloc-enabled': 'false', - 'is-space-reservation-enabled': 'true', - 'mapped': 'false', - 'multiprotocol-type': 'linux', - 'online': 'true', - 'path': '/vol/fakeLUN/lun1', - 'prefix-size': '0', - 'qtree': '', - 'read-only': 'false', - 'serial-number': '2FfGI$APyN68', - 'share-state': 'none', - 'size': '20971520', - 'size-used': '0', - 'staging': 'false', - 'suffix-size': '0', - 'uuid': 'cec1f3d7-3d41-11e2-9cf4-123478563412', - 'volume': 'fakeLUN', - 'vserver': 'fake_vserver'}) - self.driver._get_lun_by_args = mock.Mock(return_value=[lun]) - self.driver._add_lun_to_table = mock.Mock() - self.driver._update_stale_vols = mock.Mock() - self.driver._check_clone_status = mock.Mock() - self.driver._set_space_reserve = mock.Mock() - - self.driver._clone_lun('fakeLUN', 'newFakeLUN') - - self.assertEqual(1, self.driver.client.invoke_successfully.call_count) - - @mock.patch.object(iscsi7modeDriver, '_refresh_volume_info', mock.Mock()) - @mock.patch.object(iscsi7modeDriver, '_get_pool_stats', mock.Mock()) - @mock.patch.object(na_utils, 'provide_ems', mock.Mock()) - def test_vol_stats_calls_provide_ems(self): - self.driver.get_volume_stats(refresh=True) - self.assertEqual(na_utils.provide_ems.call_count, 1)