Commit Graph

47 Commits

Author SHA1 Message Date
Zuul 4dc5f6b730 Merge "Fix the link to get the next share replica" 2024-03-20 17:46:58 +00:00
Okeke Christian c8236141f8 Fix the link to get the next share replica
The url to get the next share replica is broken when performing
pagination. The new API uses underscore to represent resource.
This fix resolves the broken link for share replicas by using alias.

Closes-bug: #2023754
Change-Id: I31e32c0bcfb60b53121da9a96df3b44ad2b3ac67
2024-03-13 11:45:11 +01:00
Youngjun 8806fbe1c2 refactoring: modify function parameters and annotations to match
- the parameter description in the parameter and annotation did not match, so this was fixed.

Change-Id: I1557b74b5a2d0b81f68aa15149490bb178a5a716
Signed-off-by: Youngjun <yj.yoo@okestro.com>
2024-03-13 09:53:04 +09:00
Takashi Kajinami b488f42332 Bump hacking
hacking 3.1.x is too old.

Change-Id: Ic5131276ac1d1a1a959d0a5b16398ae12fae0c18
2024-01-27 23:57:00 +09:00
Kiran Pawar c88aac595b [API] Validate display name/description length
In case of snapshot create/update, if display name or  description is
above max limit (fields created in db with limit 255), manila
internally throws DB exception. But the error reported to user is not
meaningful.
Fix by validating name/description length should not cross max limit.

Closes-bug: #2023964
Change-Id: I6b1a274da3692700650f84736877c0ae98d46c81
2023-08-01 08:22:32 +00:00
Felipe Rodrigues 43de2e8fb5 Metadata for Share Network Subnet Resource
This change adds metadata controller for Share Network Subnets
resource. Bumps microversion to 2.78.

The subnet metadata is passed down to the driver together
with the network_info object.

APIImpact
Partially-implements: bp/metadata-for-share-resources

Change-Id: I8d5a03eb127941a84eea5e6e9bdf76b3489f17a8
2023-02-17 15:42:45 -03:00
Ashley Rodriguez 266c8012e7 Metadata for Share Resource
This change adds metadata controller for Shares resource

APIImpact
Partially-implements: bp/metadata-for-share-resources

Change-Id: I76d26f4ddce7570463efd896b571b1e1a9222ca5
2022-03-04 20:57:48 +00:00
Felipe Rodrigues 2b57d15c64 Add multiple subnets per AZ support
Manila can now configure a share network with multiple subnets
in an availability zone. Also, it can add a new subnet for an
availability that has share servers, which will triger an update
share server allocations.

Changes:
- API:
  - Bump version to 2.70.
  - setup share network with multiple subents per az.
  - Block manage server with multiple subnets.
  - Allow add subnet for in-use share servers.
  - `share_network_subnet_id` is dropped from ShareServer view
  - `share_network_subnet_ids` is added in ShareServer view
  - `network_allocation_update_support` is added to ShareServer and
    ShareNetwork views.
  - Add a check operation for share network subnet create.

- DB:
  - Remove `share_network_subnet_id` from share_servers.
  - Create mapping table `share_server_share_network_subnet_mappings`.
  - Fix queries with new db design.
  - Add migration downgrade and upgrade alembic.
  - Add `share_network_subnet_id` to the NetworkAllocations.

- Scheduler:
  - Change `AvailabilityZoneFilter` to take in account if the
    host supports the allocation required by the setup request.

- Manager:
  - Bump RPC API version.
  - `_setup_server` allocating multiple subnets.
  - Modify signature of driver `_setup_server` interface, passing a
    list of `network_info` for each subnet.
  - Share server DB creation to inform a list of subnets and
    create with `network_allocation_update_support`.
  - Implement `check_update_share_server_network_allocations` and
    `update_share_server_network_allocations`.

- Drivers:
  - For legacy compatibility, all drivers implementing `_setup_server`
    consume the first element of the `network_ino`.
  - Dummy Driver:
    - Implement `_setup_server` with new signature as multiple subnet.
    - Modify the `backend_details` to save allocations for all subnets.
    - Report update allocation and share server multiple subnet support.
    - Implement `check_update_share_server_network_allocations` and
      `update_share_server_network_allocations` interfaces.

Signed-off-by: Felipe Rodrigues <felipefuty01@gmail.com>
Co-Authored-By: Andre Beltrami <debeltrami@gmail.com>
Co-Authored-By: Fábio Oliveira <fabioaurelio1269@gmail.com>
Co-Authored-By: Nahim Alves de Souza <nahimsouza@outlook.com>
Co-Authored-By: Caique Mello <caique_mellosbo@hotmail.com>

DocImpact
APIImpact
Partially-Implements: blueprint multiple-share-network-subnets

Change-Id: I7de9de4ae509182e9494bba604979cce03acceec
2022-03-03 02:31:11 +00: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
debeltrami 2bc27c5678 Add security service update for in-use share networks
This patch implements the update of security service's association
with in-use share networks. The following changes were added:

 - New share network APIs: `share_network_security_service_update`
 and `share_network_reset_state`.

 - A new `status` attribute was added to share network model to
 identify when it's in a modification state, called 'network_change'.
 Other supported status that were added: 'active' and 'error'.

 - New 'security_service_update_support' property was added to both
 share server and share network models, to identify when this resources
 are able to process security service update for in-use share networks.

 - New driver interface was added to support update of security service's
 configuration of a given share server.

DocImpact
APIImpact
Partially Implements: bp add-security-service-in-use-share-networks

Co-Authored-By: Carlos Eduardo <ces.eduardo98@gmail.com>
Co-Authored-By: Douglas Viroel <viroel@gmail.com>
Co-Authored-By: Andre Beltrami <debeltrami@gmail.com>

Change-Id: I129a794dfd2d179fa2b9a2fed050459d6f00b0de
2021-03-12 18:37:45 -03:00
haixin 74415f6d4a Adds support min/max share size limited by share_type
Allows set min/max share size that can be created in
extra_specs for each share_type.the share size will
be checked at API level as part of share create,
extend, shrink, migration_start. when manage share,
check it after get true size of share at manager layer.
new extra_specs keys are supported for set min/max
size of share.
'provisioning:max_share_size'
'provisioning:min_share_size'

Implements: blueprint share-size-limited-by-share-type
Change-Id: I5ce0fabf59bfca5ebaf0be5ffe9986e2b0480295
2021-03-06 14:30:58 +08:00
Goutham Pacha Ravi 263d5438f0 Advertise v2 API routes without project_id
Manila APIs have had the requirement to include
project_id in the URLs since the very beginning.
This comes from an old assumption that our APIs
would be differentiated per-tenant on the cloud,
and we would allow different kinds of API endpoints
(public, admin, internal, etc). While it is possible
to set up different endpoints against the API
service, the same and complete API is exposed at
each of these endpoints.

We don't _need_ the project_id information that
we receive in the URL for any of our APIs to
function. We rather authorize tenants by gathering
information from the Identity service (Keystone)
and wrapping that into a RequestContext object
that we then rely on to ensure namespace isolation.

Removing the requirement for "project_id" simplifies
our API endpoint structure in the service catalog
as well as provides a way for system scoped users
to interact with manila without having to declare
their project.

In order to make project_id optional in urls, the
possible values of project_id have to be constrained.
This change introduces a new configuration option
so deployers may control that. This configuration
option defaults to accepting UUIDs with and without
dashes.

Since manila can be used in standalone deployments
without the need for Keystone, this change introduces
a noauth middleware that can work without project_id
in the URL paths.

The API version has been incremented to signal this
change to end users. When 2.60 is available, deployments
may drop "project_id" in the service catalog endpoint
for Manila and end users applications can stop needing
it as well (if they don't already rely on the service
catalog for this data).

APIImpact
Implements: bp remove-project-id-from-urls
Change-Id: I5127e150e8a71e621890f30dba6720b3932cf583
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2021-02-04 23:20:19 -08:00
Zuul 1edd0c39a6 Merge "Support query user message by timestamp" 2020-04-03 18:11:35 +00:00
haixin 35e82746e8 Support query user message by timestamp
Add support for querying user messages by specifying a timestamp, which
will be compared to the created_at field, and manila will return all the
messages matching to the time condition.

Partially-Implements: blueprint query-user-message-by-timestamp

Change-Id: I3d94bac4304c236f275abe7ce31432b0e2384247
2020-04-02 11:07:39 +08:00
Andreas Jaeger 8098045f2a Hacking: Fix E305
Fix:
E305 expected 2 blank lines after class or function definition, found 1

Fix also other problems found by hacking in these files.

Change-Id: I880afc40adf974cbb0e60f8dc5931f77d51f451b
2020-04-01 11:43:29 +02:00
Zuul b6b2eb5cf3 Merge "Fix pagination does not speed up queries bug" 2019-09-26 16:50:53 +00:00
silvacarloss 57edcbd1da Fix pagination does not speed up queries bug
This patch modifies the database api layer to fix the pagination
slowness bug, which causes a delay while the administrator tries
to list shares using the `--limit` option.
This change was tested in a very busy environment with 800 shares.
Before the change, the operation took about 25 seconds to be
finished. Now, the operation takes about 3 seconds in the same
environment.

Change-Id: I89659452b0e033631f1318a2eabb7e120c9e5743
Closes-bug: #1795463
2019-09-25 23:59:59 -03:00
silvacarloss 14d3e268a0 Add share network with multiple subnets
This patch adds the possibility to create share networks with
multiple subnets in Manila. It also updates the share server api
to receive "share_network_subnet_id" instead of "share_network_id".

Each share network subnet must be associated with only one
availability zone. Each share network must have a single default
share network subnet.

DocImpact
APIImpact
Depends-On: I13bb48e7c03e16c26946ccf9d48e80592391a3d1
Partially-implements: bp share-network-multiple-subnets
Change-Id: Id8814a8b26c9b9dcb1fe71d0d7e9b79e8b8a9210
Closes-Bug: #1588144
Co-Authored-By: lseki <luciomitsuru.seki@fit-tecnologia.org.br>
Co-Authored-By: dviroel <viroel@gmail.com>
2019-09-13 11:27:18 -03:00
Victoria Martinez de la Cruz 6d970b7375 Extend remove_version_from_href support
Improve remove_version_from_href so that it supports URLs for which
the version does not directly trail the hostname

Given: 'http://manila.example.com/share/v1.1/123'
Returns: 'http://manila.example.com/share/123'

Based on I8ccc449116ff164aacc0aefca3a0ec2ac8f73aa8

Change-Id: I13010d3ee0a83a67204145837503abe7126263cd
Closes-Bug: #1815038
2019-02-24 18:40:53 +00:00
Goutham Pacha Ravi 2289cdd9e7 Add policy to create/update public shares
Public shares are visible across all keystone
projects and are "accessible" by all projects
within a multi-tenant cloud. More often than not,
only privileged users can create and manage shares
that EVERYONE on the cloud can really mount and use.

Manila deployers want a way to disable
unprivileged users from create public shares. Feedback
from deployers has been that public shares created on one
private tenant network (DHSS=True scenario) cannot
be used within another private tenant network belonging
to a different project. So, if users unintentionally create
public shares, they end up pollute the dashboards of users
in other projects. So, we need to make public share
creation a "privileged" feature. This can be achieved by
introducing a manila API policy that defaults to
only allowing the "admin" role. So, this commit will:
- Introduce two new policies:
    - share:create_public_share and
    - share:set_public_share
- Set the default check string for these policies
  to rule:admin_api. They will accept the default
  rule temporarily, and log a deprecation warning
  message.
- Remove some redundant policy checks in code
  and move the policy check up in the API so we
  can fail unauthorized requests faster.

When making an API change that potentially changes
the return code from being "successful" (HTTP 2xx)
to returning failure (in this case: HTTP 403,
NotAuthorized), we typically maintain API backwards
compatibility by failing the requests ONLY with newer
API microversions. Following this pattern for API
policy changes will introduce a security hole, i.e.,
users can always create public shares with previous
versions even when an administrator explicitly
sets up policy to disable the action. This is why
this change will not maintain API backwards
compatibility.

APIImpact
Closes-Bug: #1801763
Change-Id: Ib4fc9a82b6a3e5f8e50f0bc8a89d0445eecab028
2019-02-18 12:56:12 -08:00
kedy fb613b93cd Fix allow the use of blank in user group name to access the share
Allows the use of blank in user group name, manila client also need to fix

Change-Id: I636e485992185ed8a766eddb6cba89daff0bd00e
Partial-Bug: #1733494
2018-04-17 11:42:58 +08:00
junboli b51c86973c Delete limited_by_marker from api/common.py
The function limited_by_marker seems unused, untested and hasn't been
edited in a significant manner. This patch removes it.

Change-Id: If24f2b831299d20babd2f4e181e95618bf30c670
2017-10-17 14:06:23 +08:00
Daniel Russell bc67b22413 Allows the use of dollar sign in usernames
Change-Id: I12c41a46140b07f76565d8934e0326480477c636
Closes-Bug: 1715768
2017-09-11 20:32:32 +10:00
zhongjun 031dd4b335 Enable IPv6 in manila(allow access)
Please read spec for design detail [1].

Add support to validate IPv6 based addresses
in allow access API when access type is IP.

[1] f7202a6cfe32a057f752a4e393f848f8a0211c36

APIImpact
DocImpact

Change-Id: Ica242007e77a7e21b2151e5fc32401b501d961b2
Partial-Implements: blueprint support-ipv6-access
2017-07-17 09:44:41 +08:00
zhongjun 5887f25883 change user access name limit from 32 to 255 characters
Currently, The user access name is limited to 32 characters in manila API service,
but actually the user access name is longer than 32 characters. so we need
to change user access name limit from 32 to 255 characters

APIImpact

Closes-bug: 1674908
Change-Id: I68d8afabcd3fef57e472b4067ea8949e0aa8f53a
2017-03-24 09:54:05 +08:00
tpsilva 8d71932c69 Add mountable snapshots support
This new feature gives the user the ability to allow and
deny access to the snapshots, so that they could be mounted in
read-only mode to retrieve files.

APIImpact
DocImpact

Co-Authored-By: Rodrigo Barbieri <rodrigo.barbieri@fit-tecnologia.org.br>
Co-Authored-By: Alyson Rosa <alyson.rosa@fit-tecnologia.org.br>
Co-Authored-By: Miriam Yumi <miriam.peixoto@fit-tecnologia.org.br>

Partially-implements: blueprint manila-mountable-snapshots
Change-Id: I65f398a05f82eef31ec317d70dfa101483b44b30
2017-01-24 17:26:45 -02:00
Goutham Pacha Ravi adc958f253 Pass context down to ViewBuilder method
The versioned_method decorator helps add/remove fields in
API responses.

The method reads the request object but does not pass down
the context to the called methods.

The context would be helpful to make decisions regarding
whether the fields are specific to an administrator context
or owner/tenant context.

Change-Id: Ic2e2df305362fa3f353fa2dfd75203afc38afb82
Closes-Bug: #1589516
2016-06-08 10:48:37 -04:00
daiki kato ad6cdb6e10 Fix typos
This patch fixes several typos.

TrivialFix

Change-Id: I169e15a0fdfbbcbeb1f87e3022b01fbb9353df01
2016-03-23 15:55:35 +09:00
ting.wang 2bc625399f Using dict.items() is better than six.iteritems(dict)
Replacing dict.iteritems()/.itervalues() with
six.iteritems(dict)/six.itervalues(dict) was preferred in the past,
but there was a discussion suggesting to avoid six for this[1].
The overhead of creating a temporary list on Python 2 is negligible.

[1]http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Partially-implements blueprint py3-compatibility

Change-Id: Ia2298733188b3d964d43a547504ede2ebeaba9bd
2016-01-19 22:22:48 +08:00
Alex Meade 680fd50d3e Add Consistency Groups API
This patch adds the /consistency-groups and /cgsnapshots
endpoints as well as AdminActions for both.

Partially implements bp manila-consistency-groups

APIImpact

Change-Id: I5fd0d3341766fdba4d92f4a43c3d1186e7a4b38e
2015-09-05 18:21:17 -04:00
Igor Malinovskiy a26824818f Remove Limited XML API Support from Manila
Remove the broken XML support presently available in Manila
in order to comply with the general direction among other
OpenStack projects to support JSON only.

Change-Id: Ibb542fa223f7f7d1bf95f3d1f568987ef839cd12
Closes-Bug: #1440782
2015-04-13 15:43:47 +03:00
vponomaryov d3cfecca83 Move definition of couple of config opts to proper module
Define config options 'osapi_max_limit' and 'osapi_share_base_URL' in proper
module to be able to run module "manila.api.common" without import of
module "manila.common.config". Without it all unit test modules that import
"manila.api.common" fail due to not defined mentioned config opts.

Change-Id: I725ab6cc7d777b3384bdd9095c72ecd65079e6cf
Closes-Bug: #1194315
2015-02-16 17:10:55 +02:00
Valeriy Ponomaryov 63a0504c21 Use oslo_log lib
Module 'log' from oslo-incubator was removed after release of oslo_log library.
So, start using oslo_log, but keep oslo-incubator code yet other common modules
within Manila codebase use it.

Implements bp use-oslo-log-lib

Change-Id: I88224f7c2bd99adb78140dfc3fa73cea437f29cd
2015-02-08 10:42:40 +00:00
Thomas Bechtold 071d0b59c1 Switch to using oslo_* instead of oslo.*
The oslo team is recommending everyone to switch to the
non-namespaced versions of libraries. Updating the hacking
rule to include a check to prevent oslo.* import from
creeping back in.
oslo.messaging is the only exception because this package doesn't
currently support non-namespaced imports.

Change-Id: I3987e651bc880c8ffa7c0105df0298679dcd3a43
2015-01-27 09:19:50 +01:00
chen-li a6a76d6821 py3: use six.moves.urllib.parse instead of urlparse
six is the canonical compatibility library for supporting
Python 2 and 3 in a single codebase.

The urlparse module  was removed in Python 3 and we should
use 'six.moves.urllib.parse' instead of 'urlparse' to make
code compatible with py 2 and 3 as well.

Partially-implements blueprint py3-compatibility

Change-Id: Ib27244d0583e81e307d5e4236cbf85d29566dde9
2014-12-27 08:51:32 +08:00
Andreas Jaeger 7b659fc4e0 Use oslo.i18n
oslo.i18n provides the i18n function that were provided by
oslo-incubator's gettextutils module

Import _ where needed, oslo.i18n deprecated the builtin method.

Closes-Bug: #1382187
Change-Id: I12aa1c725aa4bb52a9aa46e9c3d2b303839de48b
2014-10-19 19:21:03 +02:00
Andreas Jaeger 24cb089fee Fix some LOG.debug invocations
LOG.debug("Hello %s" % xyz) should be LOG.debug("Hello %s", xyz).
This allows the logging package to skip creating the
formatted log message if the message is not going to be emitted because
of the current log level.

Change-Id: Ie0c91cd940017fd80d1d84b0e56780a1da980858
2014-09-16 08:04:09 +02:00
Andreas Jaeger 1ee54a3144 Flake8: Fix H501
Fix all occurences of:
H501  Do not use locals() for string formatting

Change-Id: Id221d257975659d31b29ed696345f96525c3b459
Partial-Bug: #1333290
2014-08-27 10:47:56 +00:00
Andreas Jaeger 43aeceff2f Fix H402 hacking rules
Fix and enable hacking test:
H402: one line docstring needs punctuation.

Fix testsuite, the change for manila/tests/api/extensions/foxinsocks.py
needs corresponding changes.

Change-Id: I587cd6771787ca56b1410f86a6ec13380bcc206b
2014-08-19 17:04:54 +02:00
Valeriy Ponomaryov ed197a5f10 py33: use six.iteritems for item iterations (part1)
Partially-implements blueprint py3-compatibility

Change-Id: I0c3356cbaefeb77b6543711d79c370b3f1032683
2014-07-07 12:30:30 -04:00
Christian Berendt 79cd06323c debug level logs should not be translated
According to the OpenStack translation policy available at
https://wiki.openstack.org/wiki/LoggingStandards debug messages
should not be translated. Like mentioned in several changes in
Nova by garyk this is to help prioritize log translation.

Change-Id: Idd917acd97481d6b644e307adb002354b37f34a1
2014-05-13 14:13:53 +02:00
Yulia Portnova dd4cbb9096 Added API to manage volume types
Partially-implements bp volume-type-support

Change-Id: I1a58cf82c659b49e5258a563788cb8e5b05bfb8a
2014-04-29 05:12:02 -04:00
Yulia Portnova d68efa454c Security service API
Added security service controller to
Manila v1 API.

Partially implements bp: join-tenant-network
Change-Id: Ic11feb44547bf438d925261b587edc828eac31c1
2014-01-13 15:34:48 +00:00
Andrei V. Ostapenko 3f24fee218 Removing deprecated using of flags module from project
Moving file flags.py to manila/common/config.py,
replacing FLAGS by CONF. Rename modules fake_flags to conf_fixture,
test_flags to test_conf, declare_flags to declare_conf,
runtime_flags to runtime_conf like it was done in cinder, nova, glance etc.

Implement bp: use-oslo-conf

Change-Id: I38d869123e5e706d3b06f1844b97ead05e22668f
2013-10-07 13:17:27 +03:00
Yulia Portnova c67fc2da7a osapi_volume to osapi_share 2013-09-05 11:02:21 +03:00
Yulia Portnova dc4ce932ed Renamed cinder to manila.
Fixed setup.py, fixed bin scripts.
2013-09-02 09:59:07 +03:00