Commit Graph

18 Commits

Author SHA1 Message Date
Goutham Pacha Ravi 04e06968fd Handle service client authorization errors
Authorization errors when connecting
to nova/glance/neutron/cinder can be raised as
BadConfigurationExceptions in the logs. We shouldn't
be raising exceptions derived from the service client
libraries.

Change-Id: I2d47dbb1251dfa8d529f813724fb7fd97d7d3a0b
Closes-Bug: #1921927
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2021-06-24 15:45:04 +00:00
Goutham Pacha Ravi 598223985a Use unittest.mock instead of third party lib
mock was adopted into standard python
in version 3.3 [1]. Since manila no longer
supports python2.7, we can use the inbuilt
mock package rather than the third party
lib.

Fix some issues with imports that weren't
following our import conventions of grouping
imports [3]

Add a hacking test to ensure we don't regress
on this.

[1] https://docs.python.org/3/library/unittest.mock.html
[2] http://lists.openstack.org/pipermail/openstack-discuss/2020-March/013281.html
[3] https://docs.openstack.org/hacking/latest/user/hacking.html#imports

Co-Authored-By: Sean McGinnis <sean.mcginnis@gmail.com>
Change-Id: If857a49fbf526983e712282a25d7e8bef5093533
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2020-04-17 16:24:27 -07:00
Goutham Pacha Ravi 198bea78ac Deprecate old keystone session config opts
In the past, the options ca_certificates_file,
nova_ca_certificates_file, cinder_ca_certificates_file,
api_insecure, nova_api_insecure, cinder_api_insecure
were supplied to instantiate nova, neutron and cinder
clients. These options have now been subsumed in a more
generic way into the Keystone session logic as 'cafile'
and 'insecure'. Deprecate the older options in Stein so
that we can remove them in a future release.

This deprecation began many releases ago when we switched
to using keystone sessions [1]. However, we were still
overriding the values of "insecure" and "cafile" if provided,
forcing users to continue using deprecated parameters
"api_insecure" and "ca_certificates_file". So despite
this fix originating in the Stein release, it would be
prudent to backport it to all maintained releases and
remove support for these older options in/beyond Train
release (9.0.0).

[1] Ic211a11308a3295409467efd88bff413482ee58d
Change-Id: I148e9079c7c1ab119f519f727d4ad97758473325
Related-Bug: #1802393
Closes-Bug: #1809318
2018-12-20 17:29:40 -08:00
junboli 1ad8682614 Use v3 cinder client for share volume
Since cinder has been deprecated v2 api since Pike, So the
v3 cinder client should be used here to create share volume.
Also remove previously deprecated cinder client options.


Change-Id: I314f36637ab45faa638732238c438bf00cc641ea
Closes-Bug: #1733786
2017-11-30 16:20:31 +00:00
zhongjun 341161eead Use parenthesis instead of backslashes in tests folder
Use parenthesis instead of backslashes in tests folder

TrivialFix
Change-Id: I6c2ea07b0bfc5852b28e44989406cc10eb972e53
2017-06-19 17:56:01 +08:00
Tom Barron 4e25ce5a0c Remove usage of parameter enforce_type
oslo.config has deprecated the enforce_type parameter to
set_override() and set its default value to True [1],
so remove this usage from our codebase.  Also remove
explict str() cast of mock.sentinel_password in
Windows driver since it should no longer be expected.

[1] Ifa552de0a994e40388cbc9f7dbaa55700ca276b0

Change-Id: Ic02cbb37c6dbf30cacb1e6e290bfb0986f54d5f3
2017-04-16 10:39:01 -04:00
Valeriy Ponomaryov 11b38f3188 Add support of endpoint_type and region_name to clients manila uses
Since change [1] it is impossible to set endpoint_type and region_name
for nova, cinder and neutron clients that are used by manila in some
cases.
So, to fix it, add additional options called 'endpoint_type' and
'region_name' for each of config groups related to these clients.
These options can be defined in appropriate config group as following:

[nova]
endpoint_type = publicURL
region_name = SomeRegionName

[cinder]
endpoint_type = internalURL
region_name = SomeRegionName

[neutron]
endpoint_type = adminURL
region_name = SomeRegionName

[1] Ic211a11308a3295409467efd88bff413482ee58d

Change-Id: I6be0e77bbc0e4b1e9905eba7a7b48ff540e9e377
Closes-Bug: #1633454
2016-11-02 18:14:04 +02:00
nidhimittalhada c8ff803531 Test: make enforce_type=True in CONF.set_override
Each config option has limitation for type and value. If we use
method CONF.set_override without parameter enforce_type=True, we
may pass wrong type to config option.

This commit makes sure calling method CONF.set_override with
enforce_type=True.

Change-Id: I700dcd21941c6399c51e11bef2282e1e4565e85a
Closes-Bug: #1517839
2016-05-12 11:27:30 +05:30
Marc Koderer 7fc492ea79 Fix keystone v3 issues for all clients
This fix basically ports nova fix https://review.openstack.org/#/c/136931/
plus additional bug fixing to Manila. It creates a common class to get
used for all clients (neutron, nova, cinder).

Idea is to create an auth session and pass this to the client object
instead of let the client do that. The auth session will be created by
a config group which means the configuration for the clients needed to be
heavily reworked. Patch is also backward compatible with old options but
flag them as deprecated.

DocImpact

Change-Id: Ic211a11308a3295409467efd88bff413482ee58d
Closes-bug: #1555093
2016-03-18 14:42:33 +01:00
Yusuke Hayashi d24048aff4 Fix order of arguments in assertEqual
Fix incorrect order assertEqual(observed, expected) as below.
  assertEqual(observed, expected) => assertEqual(expected, observed)

Target of this patch:
  manila/tests/scheduler/*
  manila/tests/volume/*
  and all others

Change-Id: I063d35c01835ed6a5c62f016274b02e29333aade
Closes-Bug: #1280522
2015-10-04 11:15:07 +09:00
Valeriy Ponomaryov 554b92e458 Fix exceptions handling for py34 compatibility
Fix following cases:

    "except SomeException, e:"
    "raise exc_value, msg, exc_trace"
    "e.message"

Partially-Implements: bp py3-compatibility

Change-Id: I8c20ae725000895b6b7b7c0da7d4bfba3e4849f0
2015-08-05 17:15:46 +03:00
Igor Malinovskiy e1746d7137 Implement manage/unmanage support in generic driver
Add implementation of manage_existing() to Generic driver.
Generic driver accepts only one driver_option 'volume_id'.
If an administrator provides this option, then this Cinder
volume will be managed by Manila as well.

Partially implements bp manage-shares

Change-Id: I8767a7af75d575c57e8708563fa4a6bf2f4aa8ad
2015-03-18 20:43:51 +02:00
Clinton Knight 65d1158526 Replace legacy StubOutForTesting class
The Manila test module uses a class called StubOutForTesting, which
is an awkward holdover from when the unit tests were using Mox.
Alex wrote a more elegant and capable mocker method,
manila.test.TestCase.mock_object, in the Cinder project which we
have now added to Manila. So to remove the duplicate functionality
and legacy code, all references to self.stubs.Set() in the Manila
tests should be replaced with self.mock_object() and any related
dead code should be removed.

Resolves-bug: #1415602
Change-Id: Ie5f203c0b2cb57ad00d9ec8db0529075b6fef261
2015-02-03 14:31:17 +00:00
Vladimir Vechkanov a7a517dec9 Add support for volume types with Generic driver
Add configuration option cinder_volume_type which can be used
to set volume type for cinder. If that option is not None then
cinder volumes will be created with type from that option.

Implements blueprint cinder-volume-types-with-generic-driver

Change-Id: Ica171410bfdfa001da5188450a0c3740b4b8eb65
2014-12-03 08:22:15 -05:00
Marc Koderer ecf603bc05 Remove vim headers
As discussed in [1] remove all vim headers from manila files.

[1]: http://lists.openstack.org/pipermail/openstack-dev/2013-October/017353.html

Change-Id: I341486c66ffe4dad7db8608fdc66868ceb7ad95a
Closes-Bug: #1229324
2014-10-06 15:00:27 +02:00
Andreas Jaeger 9154f3e55b Flake8: Fix E126 and E127
Fix these issues and enable E126 and E127:
E126 continuation line over-indented for hanging indent
E127 continuation line over-indented for visual indent

Also fix a few occurences in the touched files of:
E128 continuation line under-indented for visual indent
H405  multi line docstring summary not separated with an empty line

Partial-Bug: #1333290
Change-Id: If822401fc7e1db49d595a0736a0dff8e00dfd217
2014-08-23 08:43:02 +00:00
Christian Berendt 799319baab Enabled hacking checks H305 and H307
* H305  imports not grouped correctly
* H307  like imports should be grouped together

Change-Id: I9dc5f995ea07d7c319d944e847a9d1c126937240
2014-07-20 18:48:31 +02:00
Andrei V. Ostapenko fbde9ae88f Adds cinder api needed for generic driver implementation
Generic driver will use cinder volumes as back-end for shares,
so this patch adds a module for interacting with cinder.

Partially implements: bp generic-driver
Change-Id: Ide3d98efa8cf38994548934ad445f3561f5e3106
2014-02-10 10:10:29 +02:00