Commit Graph

16 Commits

Author SHA1 Message Date
silvacarloss 51bc158305 Fix InvalidInput wrong message
When performing some operations, there is a chance that the API
will raise a InvalidInput exception. However, sometimes we are
treating this exception alongside others, and expecting these
exceptions to inherit from the same base. The exceptions could
have different attributes to store the message though.

This change modifies the message treatment to stringify the
exception instead of trying to use specific attributes.

Change-Id: I1f54f6be46c5a1e997c8bf589503a5e62a71d644
2022-07-26 17:32:11 -03:00
haixin 3831e5500f remove usage of six library from unit tests
Replace six with Python 3 style code.

Change-Id: I5077e71663f6b60bd774f30fcf64b36d4078cf8e
2021-01-28 10:47:40 +08: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
silvacarloss 3e51ea34e3 Remove experimental flag from share groups feature
This patch updates the share groups APIs to be no longer considered
as experimental. It is done by removing the experimental flag from
the share groups, share group snapshots, share group extra specs
and share group types requests.

DocImpact
Partially-Implements: bp graduate-share-groups-feature
Change-Id: I080683541d527657f01008d43529fc53c19a09cd
2020-04-09 21:13:54 +00:00
Goutham Pacha Ravi 0d8310ec7a Fix version selector when for proxy-style URLs
When manila API is served behind a proxy, the
"script_name" in the request can have the proxy
component in it. So, this patch fixes the version
selection logic by looking for the version in the
script name string instead of equivalence.

In addition, this patch adds some missing unit
tests and fixes tests that invoke a mocked
wsgi app for testing request context.

Change-Id: I0363d7174f3d7ddefa8ced59b182faed665e9c36
Partial-Bug: #1815038
Closes-Bug: #1818081
2019-03-11 16:42:25 +00:00
Goutham Pacha Ravi 4249e94c6b Allow configuring availability_zones in share types
Administrators configure share types and make them
available to projects within an OpenStack cloud.
These share types will define capabilities to match
back-end storage pools that manila provisions shares
within. Administrators may want to limit share types
to specific Availability zones, given they may have
different classes of storage in different availability
zones in the cloud. A major use case of this is edge
computing, where, provisioning can be driven to specific
edge locations with the help of share types.

This commit will:

- Introduce 'availability_zones' as a new common share type
  extra spec that is user visible when configured.
- In and beyond microversion 2.48, validate that the AZ
  chosen in the POST /shares API is supported by the configured
  availability zones for the share type being used.
- Share types can be filtered by AZs through extra-specs:

  $ manila type-list --extra-specs availability_zone=nova

  now gives you all types that explicitly (and implicitly)
  are supported within the AZ 'nova'.

- Improve experimental APIs:
  - Add validation of AZ to POST /share-replicas
  - Add validation of AZ to POST /share-groups
  - Add validation of AZ to
    POST /shares/id {'action': 'migration_start'}

- Also fix old unit tests by using a helper method to
  generate appropriate mock values.

DocImpact
Change-Id: Idf274cd73e3b1b33f49668fca768ae676ca30164
Implements: bp share-type-supported-azs
2019-02-13 17:39:48 +00:00
Goutham Pacha Ravi a07c51e8b0 Make coverage non-voting and fix use of rpc_backend
rpc_backend was an old oslo_messaging option
that was deprecated in stable/newton and removed
in master/stein [2], so stop using it in our
unit tests.

The coverage job in manila was always non-voting,
however, a773e31420
added a common coverage job-template from the
openstack-zuul-jobs repository. This change
inadvertently made the non-voting cover job a
voting job.

Our coverage script isn't perfect, it is known
to fail erroneously on non-code changes, and
some genuine failures are just an indication
to developers and reviewers to make the best
effort to adhere to the script's strict
checks [3].

These changes are unrelated, but must be fixed
together to pass the gate, since we have a
chicken-and-egg problem with both failures
preventing separate fixes from merging
separately.

[1] https://review.openstack.org/#/c/317285/
[2] https://review.openstack.org/#/c/580910/
[3] http://git.openstack.org/cgit/openstack/manila/tree/tools/cover.sh

Closes-Bug: #1796759
Related-Bug: #1797512
Change-Id: Ie349c3866d51ea4e706369ad67bc1155f62f2651
2018-10-11 23:23:37 -07:00
Zuul 199c9cbee7 Merge "Delete unused test check" 2018-06-12 17:29:55 +00:00
zhongjun 6d29762f87 Delete unused test check
TrivialFix

Change-Id: Id93a5062c48e99afc22594f05cbf29cffce2494e
2018-06-09 22:34:35 +00:00
Goutham Pacha Ravi fd23a6387c Use class name in invocation of super
Fix pylint E103 warning raised by usage of
self.__class__ to refer to the derived class
in super() methods.

self.__class__ is a reasonable first argument
to super() in any method of a class, as long
as the method is not going to be invoked in
derived classes.

Python3 removes this ambiguity by not requiring
arguments for the super() method.

[1] https://docs.pylint.org/en/1.6.0/features.html#id33

Change-Id: I6071b6cfd8cff2be3853d739f71b94da990cda97
2018-06-06 17:47:18 -07:00
zhongjun c96df66823 Add like filter
Add like filter support in ``shares``, ``snapshots``,
``share-networks``, ``share-groups`` list APIs.

APIImpact

Implements BP like-filter
Change-Id: I5fdf6d89d0b6c7fa182ddfaac60979bc6c0fc2a5
2017-07-10 14:55:41 +08:00
Valeriy Ponomaryov f95e5d90b6 [Share Groups] Add two new fields to SG API object
Previous change [1] added logic for handling of availability zones with
share groups and [2] for scheduling with share group capability
to create consistent snapshots. Those two added two new DB fields
for 'share_groups' DB model, but not to API response that requires
microversion bump. So, add these fields to API and bump microversion.

Following two new fields will be available with new microversion:
- 'availability_zone_id'
- 'consistent_snapshot_support'

Also, add tempest tests to these API changes.

[1] I000adeb53fe8435465cbedc3c539e6aaae6503c5
[2] I05553c308ae40c4ddc2c6469ff1c1a3da36a87da

Partially-Implements BP manila-share-groups
Change-Id: I343d0c6f3a5c7b58d88e95dba4af984fae738954
2017-06-06 10:13:36 +00:00
Valeriy Ponomaryov 283e13384a [Share Groups] Add availability zone support
'Share groups' feature was not finished completely in Ocata timeframe.
There was absent possibility to specify 'availability zone' for
creation of a share group. So, implement it.
The fact of its implementation fixes mentioned bug below.

Closes-Bug: #1662944
Partially-Implements BP manila-share-groups

Change-Id: I000adeb53fe8435465cbedc3c539e6aaae6503c5
2017-06-06 10:13:00 +00:00
Béla Vancsics aa45b4e0ec Use more specific asserts in tests
Instead of assertTrue and assertFalse use more specific asserts.
They are compatible with Python 2.7[1] and 3.4[2]

[1]: https://docs.python.org/2.7/library/unittest.html
[2]: https://docs.python.org/3.4/library/unittest.html

Change-Id: I2dae60fe786a99344fc12dd4aeaea9c79c9811c5
2017-02-09 06:47:38 +01:00
Alex Meade d25f101ab4 Manila Share Groups
Remove the experimental consistency group APIs and
replace them with the experimental Share Group APIs.

DocImpact
APIImpact
Partially-implements-blueprint: manila-share-groups

Change-Id: I79a80a62ae4e0015d6161edc2b93fd1f9ba69537
2017-01-23 21:29:12 +02:00
Valeriy Ponomaryov 3e37cd2e5a Rename consistency group modules to share groups
Port of consistency groups to share groups consists of not only
change of logic but also renames of several modules. So, rename
modules first to reduce amount of changes that will be done
in scope of main change.

Partially-Implements BP manila-share-groups

Change-Id: Ie93fa5680c29e2c208ca77f871817abb4cbd9f72
2017-01-23 10:35:13 +00:00