Commit Graph

19 Commits

Author SHA1 Message Date
Felipe Rodrigues a65dffc0c7 Fix Manila API error message
Some Manila error messages were wrongly returning the string marker
"%s" instead of the string content. This patch fixes them.

Closes-Bug: #2007060
Change-Id: Ib68f71e19f2ec1190cc431f029d996193008d557
2023-02-12 23:49:00 -03:00
haixin 03fea855d9 remove usage of six library in api layer
Replace six with Python 3 style code.

Change-Id: I091a45c04686ac8d036107618945fea65fb4a2cf
2021-12-22 10:08:11 +08:00
Victoria Martinez de la Cruz 3a1e23801f Support group specs search for share group type API
Add support for group_specs filter search in share group type list API.

Implements: blueprint support-group-spec-search-share-group-type-api
Change-Id: I10caed1d524614a74a75e8f856b0579ab11dc4b5
2021-12-09 17:26:11 +00:00
Ghanshyam Mann ffd3f1e760 [goal] Migrate tox based testing to ubuntu focal
As per victoria cycle testing runtime and community goal[1]
we need to migrate upstream CI/CD to Ubuntu Focal(20.04).

Fixing:
- bug#1886298
Bump the lower constraints for required deps which added python3.8 support
in their later version.

Story: #2007865
Task: #40194
Depends-On: https://review.opendev.org/#/c/738328/

Closes-Bug: #1886298

Change-Id: Ib0f84e8c3815be48bca0ae8d4fe15a56b5256c20
2020-09-09 13:19:39 -05:00
haixin 01e89ae26b Add update share-type API to Share Types
Currently, only the name and description and public access of share-type
is set when the share-type is created, and not allowed to be edited
after the share-type is created. We can only set extra spec for share-type.
But not name or description or public access for share-type.

Co-Authored-By: Brin Zhang <zhangbailin@inspur.com>
APIImpact

Implements: blueprint update-share-type-name-or-description
Change-Id: I4c7bdd601d48b40c01639b5089d4bff259a7b3af
2019-09-10 14:43:07 -07:00
Goutham Pacha Ravi 3e855d5f60 [pylint] Fix/ignore pylint errors in non-test modules
Pylint does not play very well with dynamic object
manipulation in python This creates a lot of
false-positives in the code-base which affects
contributors looking for genuine failures.

So, this change
- adds pylint ignore statements where appropriate
  to disable testing these lines of code and failing.
- replaces all the pylint error codes (they are
  hard to remember/relate to) with error names
  which are easier to understand when reading the
  code.
- initializes sqlalchemy model objects as dictionaries
  which is a valid representation over None.
- removes ignore directives on six.moves which
  is globally ignored in our pylintrc.
- adds alembic.op to the ignored
  modules list since they are not supported by
  pylint and have known issues.

This patch is the beginning of a series of
commits to use pylint in a sane way on manila code.

Change-Id: I44616821c5311d6f14986697efbbe5624de364a5
2019-02-25 17:23:15 +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 4435deb48f Address trivial TODOs
- Add share type access to type view builder
- Remove unnecessary docstring TODO

TrivialFix

Change-Id: I856a3318f498800eab5932b7ad250621ccf4292f
2018-06-18 09:31:25 -07: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
Zuul fdd6f34599 Merge "Support filter search for share type API" 2018-04-21 10:12:28 +00:00
junboli d80596b508 Support filter search for share type API
Add support for extra_specs filter search in type list API.

Change-Id: I43fbef2a32489f2064586a3674eb34329f3503c4
Implements: blueprint support-filter-search-for-share-type
2018-03-25 18:19:38 +08:00
wangqi 896c88d6b7 use http code constant instead of int
Change-Id: I71f3271bd0cfaac61f8e86e8fa373257ce22681e
2018-03-20 09:26:59 +00:00
junboli 6af780c1e4 Fix default and detailed share type result not correct
When request default share type and show share type detailed,
the share type results is not correct, because the values of
attribute required_extra_specs is always empty.

Change-Id: I68fc4e2ba30bbd87b5417fe48688edd96cbcee5d
Closes-Bug: #1733742
2017-12-22 14:49:07 +00:00
zhongjun 125651d566 Add 'description' in share type APIs
This fix add attr 'description' in list/create share
type APIs.

Change-Id: I39705acbfca812b66d74fbd2fee228a7a85bc2d8
Closes-Bug: #1724183
2017-11-22 13:28:41 -05:00
zhongjun cffbc0d5ac Use parenthesis instead of backslashes in API folder
Use parenthesis instead of backslashes in API folder

TrivialFix
Change-Id: I6c2ea07b0bfc5852b28e44989406cc10eb972e28
2017-06-15 17:23:05 +08:00
Clinton Knight 0d6db3588c Add create_share_from_snapshot_support extra spec
The snapshot_support extra spec has always meant two
things: a driver can take snapshots and create shares
from snapshots. As we add alternate snapshot semantics,
it is likely that some drivers will want to support
snapshots and some of the new semantics while being
unable to create new shares from snapshots.

This work adds a new extra spec,
create_share_from_snapshot_support, that removes the
overloading on snapshot_support. It also makes the
existing snapshot_support extra spec optional,
allowing admins to create types without setting
snapshot_support; shares created with such types
will not support snapshots.

APIImpact
DocImpact

Co-Authored-By: Goutham Pacha Ravi <gouthamr@netapp.com>
Implements: blueprint add-create-share-from-snapshot-extra-spec
Change-Id: Ib0ad5fbfdf6297665c208149b08c8d21b3c232be
2016-12-21 09:57:08 -05:00
ting.wang 21b3cb445b Remove `None` as a redundant argument to dict.get()
`dict.get()` returns `None` by default, if a key wasn't found.
Removing `None` as second argument to avoid redundancy.

Change-Id: I92fe515c0f920a324ac7dd85577d7ee25a6f20a0
2016-02-17 00:06:14 +08:00
zhongjun f041606cb4 Do not allow to modify access for public share type
Now public share type can be removed project access, but when
listing access, manila returns 'Access list not available for public
share types'. It's weird for users experience.

We should check if a type is public and do not allow public share type
to modify project access.

APIImpact
When modifying access for public share type, API will return 409 and message:
"Invalid share type: Type access modification is not applicable to public
share type."

Change-Id: I94f580eeb7eef4263c631227cc3710eeae2b9706
Closes-Bug: #1490912
2015-12-08 17:07:50 +08:00
Valeriy Ponomaryov 2467ccf223 Add new URLs for APIs ported from extensions
After port of extensions to core API we need to rename their URLs.

So, rename URLs and bump microversion for it.
Make new URLs work only with new microversion(s) 2.7+
and old with old microversions 1.0-2.6.
Add separate API router for v2 API as now we should split v1 and v2
logic.
Also, move updated APIs under v2 directory that will be used by both
API routers - v1 and v2.

List of updated collections is following:
 - os-availability-zone -> availability-zones
 - os-services -> services
 - os-quota-sets -> quota-sets
 - os-quota-class-sets -> quota-class-sets
 - os-share-manage -> shares/manage
 - os-share-unmanage -> shares/%s/action

List of updated member actions is following:
 - os-share-unmanage/%(share_id)s/unmanage -> shares/%(share_id)s/action
 - types/%(id)s/os-share-type-access -> types/%(id)s/share_type_access

List of updated action names is following:
 - os-access_allow -> access_allow
 - os-access_deny -> access_deny
 - os-access_list -> access_list
 - os-reset_status -> reset_status
 - os-force_delete -> force_delete
 - os-migrate_share -> migrate_share
 - os-extend -> extend
 - os-shrink -> shrink

List of updated attribute names is following:
 - os-share-type-access -> share-type-access

Partially implements bp ext-to-core

Change-Id: I82f00114db985b4b3bf4db0a64191559508ac600
2015-12-01 12:15:06 +02:00