Commit Graph

190 Commits

Author SHA1 Message Date
Kiran Pawar a0bcf312f3 Add more tests for share/snapshot deferred deletion
Partially-implements: bp/deferred-deletion
Change-Id: I49c7916d4823c691f3fffe6797a779b086589188
2024-03-13 12:35:28 +00:00
Kiran Pawar 558288e00a Add support for share/snapshot deferred deletion
Implements: bp/deferred-deletion
Change-Id: I9e55e1706fc0c3d9f65f73e13ba2a20f355c74f4
2024-03-12 14:22:25 +00:00
silvacarloss 3429717601 Add a new config option to specify admin metadata
- A new config option named ``admin_metadata_keys`` was introduced
and we expect it to be set in the DEFAULT section of the manila
configuration file. It is expected that administrators will provide
a list of metadata keys that can only be updated by administrators
through this configuration option.

- Drivers will be able to set metadata while creating shares
through the `get_optional_share_creation_data` driver interface.

Closes-Bug: #2050010
Change-Id: I6412710c7db89747d23033e1a5a6be9de5886b0b
2024-02-22 14:31:44 -03:00
Takashi Kajinami b488f42332 Bump hacking
hacking 3.1.x is too old.

Change-Id: Ic5131276ac1d1a1a959d0a5b16398ae12fae0c18
2024-01-27 23:57:00 +09:00
Stephen Finucane 8b148ebd41 db: Rename 'share_export_location_*' to 'export_location_*'
This better aligns with 'export_location_metadata_*' APIs. The plural
'export_locations_get*' APIs are renamed to 'export_location_get_all*'.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I14f2b834e7ac2d8be86f9d7e381706cadbb79eb8
2023-09-27 16:31:07 +01:00
Stephen Finucane 204215722e db: Rename 'share_instances_*' to 'share_instance_*'
Rename a number of APIs to use singular, rather than plural, like every
other API uses:

- share_instances_status_update ->
    share_instance_status_update
- share_instances_get_all ->
    share_instance_get_all
- share_instances_get_all_by_host ->
    share_instance_get_all_by_host
- share_instances_get_all_by_share_network ->
    share_instance_get_all_by_share_network
- share_instances_get_all_by_share_server ->
    share_instance_get_all_by_share_server
- share_instances_get_all_by_share ->
    share_instance_get_all_by_share
- share_instances_get_all_by_share_group_id ->
    share_instance_get_all_by_share_group_id

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ic48fe0d1631a6e1a8ee9a50741cc1b31c9187c37
2023-09-27 16:20:17 +01:00
Stephen Finucane 2a3bbe9be8 db: Rename some methods
Rename a number of APIs for consistency purposes:

- get_all_expired_transfers ->
    transfer_get_all_expired
- get_all_expired_shares ->
    share_get_all_expired
- get_shares_in_recycle_bin_by_share_server ->
    share_get_all_soft_deleted
- get_shares_in_recycle_bin_by_network ->
    share_get_all_soft_deleted_by_network
- share_transfer_get ->
    transfer_get

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I805ed06feefd189768cf4b0fec9b8ff011694216
2023-09-27 16:14:29 +01:00
Zuul 2f7ca1cd5a Merge "Support reapplying rules during ensuring" 2023-09-14 19:42:43 +00:00
Goutham Pacha Ravi 389a2ea1e5 Support reapplying rules during ensuring
This is an internal change in the share manager's
"ensure_driver_resources" method, and isn't invoked
by any code path yet. The idea is to allow drivers
to opt into running "update_access" on shares that
they are ensuring.

Only drivers that implement "ensure_shares" can
take advantage of this feature.

Change-Id: Ieb7b0dedd98dc02b593078d08d4c0bdf4a1af2bf
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2023-09-07 18:15:04 -07:00
Mariusz Adamski 94b71a5faf Include share_type information in notifications
For the purposes of billing, it's useful to provide the information
about share type in oslo.messaging notifications.

Different share types can have different quality of service, limits,
quotas or even be backed by entirely different backends, so it makes
sense to bill shares of different types differently. For example,
a customer may want to choose to create a share with higher performace
via an appropriate share type and thus be charged more for such a share.

Change-Id: I4b8e9344c36aa874b95fce3e0989d34b690159d6
Signed-off-by: Mariusz Adamski <mariusz.adamski@ovhcloud.com>
2023-08-18 08:53:56 +02:00
Maurice Escher 945579aefc Handle access rules on share replicas.
Currently rules that are copied from source share would hang in
'queued_to_apply' forever. To fix this check access_rule_status of
the created replica and accordingly update access rule and state.

Change-Id: Ie7ddd9f631510ba97e92a1eb0eb9a5d944ec1b3b
Closes-Bug: #2000253
2023-07-10 15:44:19 +00:00
Kiran Pawar a372e53098 Report PortLimitExceeded error to customer
When share creation fails due to missing ports quota (
'manila.exception.PortLimitExceeded: Maximum number of ports
exceeded.'), error message propogated to user is not useful.
Improve user message in this scenario.

Closes-bug: #2019846
Change-Id: I1f010c4ff9faf837bd50b6c2823cbc526f3a42df
2023-05-21 16:02:52 +05:30
Zuul e5504f03c0 Merge "Fix exception in share transfer accept routine" 2023-02-24 21:07:15 +00:00
Goutham Pacha Ravi ef111c59ea Fix exception in share transfer accept routine
The exception being handled has a typo and our pylint
job's failing. While we're fixing it up, it's worth adding
some unit tests for the exception handling.

Change-Id: Ia12f85686ddb69ebecf502955f1ce9f1956627d4
Closes-Bug: #2007881
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2023-02-21 15:51:53 -08: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
haixin b4a0fd9af0 Update micversion to 2.77, support share transfer between project
user can create a transfer for a share. will return transfer id
and auth_key. another user can use transfer_id and auth_key to
accept this share. salt of transfer and auth_key compute crypt_hash
by sha1. then compare with crypt_hash in db.

APIImpact
DocImpact

Partially-Implements: blueprint transfer-share-between-project

Change-Id: I8facf9112a6b09e6b7aed9956c0a87fb5f1fc31f
2023-02-17 16:05:01 +08:00
Kiran Pawar 858939c190 Add 'default_ad_site' field to security service object
Allows to configure optional field 'default_ad_site' from version 2.76.
Restrict to make sure either server or 'default_at_site' provided, but
not both.

APIImpact
Relates-bug: #1988146

Change-Id: I8e21e9170eace134a51efed84de1ccc58eb7eaaa
2023-02-16 09:28:28 +00:00
Zuul 031fab2c8f Merge "Fix replica quotas allocation during share migration" 2022-10-13 23:28:54 +00:00
Zuul d910514004 Merge "Fix available share servers to be reused" 2022-08-30 00:08:10 +00:00
Zuul 45cbd7a0d6 Merge "Fix KeyError exceptions in Manila unit tests" 2022-08-24 09:14:28 +00:00
Alex Deiter 6669330d92 Fix KeyError exceptions in Manila unit tests
Added missed 'service' and 'reason' keywords for Manila exceptions unit tests.

Closes-bug: #1966473
Change-Id: I70533951f46cddd171b1979ed57a59a5448a4557
2022-08-21 19:09:58 +03:00
Zuul 7269f2a9e4 Merge "share recycle bin, Fix follow-up suggestions" 2022-07-14 21:53:29 +00:00
Felipe Rodrigues 8dc6235b5f Fix available share servers to be reused
The change [1] modified the function
`share_server_get_all_by_host_and_share_subnet_valid` adding the
status option. However, it removed the actual filter from the query
wrongly. As result, the method is returning all share servers without
taking the status in account.

This patch reverts that change and also creating a new one for
collecting all share servers no matter their states.

[1] https://review.opendev.org/c/openstack/manila/+/825110

Closes-Bug: #1978962
Change-Id: I8d9437eafde67407ba5e337dd495fdb74eefec70
2022-06-16 12:11:27 -03:00
silvacarloss 6a6aa0f146 Fix replica quotas allocation during share migration
Fixed the issue in the share migration where the replica quotas
were not being accounted. Manila now tries to allocate share
replica quotas for the migrated share if the destination share type
has a `replication_type`.
If the migration fails or get cancelled, the quotas will be
reverted.

Change-Id: Ie0a08a61c79dc8ea2a7a240363e94b26a80e64a4
Closes-Bug: 1910752
2022-03-09 19:44:31 -03: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 4e3f53c590 share recycle bin, Fix follow-up suggestions
Change-Id: I34b316f85af2cee3aa22d9111764e2c8af1bbde8
2022-02-25 22:57:02 +08:00
haixin d51eb05c05 Update micversion to API2.69, Manila share support Recycle Bin
Add support share Recycle Bin, the end user can soft delete
share to Recycle Bin, and can restore the share within 7 days,
otherwise the share will be deleted automatically.

DocImpact
APIImpact
Partially-Implements: blueprint manila-share-support-recycle-bin

Change-Id: Ic838eec5fea890be6513514053329b1d2d86b3ba
2022-02-19 02:02:06 +08:00
silvacarloss af3513d2b0 Force share server selection on nondisruptive migration
While performing nondisruptive migrations, share servers can not
change, because such thing will cause the migration to be
disruptive, since share servers have different network allocations
and it will cause the destination share to change its export
locations.
This change fixes an issue that allowed manila/the share driver
to chose where a share instance is going to land in case of a
nondisruptive migration. Now, when such migration is required,
manila will automatically place the destination share instance in
the same share server that the source instance is located at.

Closes-Bug: #1920942
Change-Id: I16110ec46c25be65760b15d7fbed67cd005f3873
2021-12-17 11:12:03 -03:00
silvacarloss 04a3db2f9a Share server migration enhancements
A series of enhancements can be performed in the share server
migration operation, and share backends might support
nondisruptive share server migrations, which was not covered
in the previous approach.

-  Skip the destination share server network allocation if the
driver is capable of reusing the source share server allocation.
Manila will switch the allocations in the migration complete phase.

- Allow share backends to reuse the share servers in case they
are able to do so in a share server migration scenario.

- Nondisruptive migration is now feasible depending on whether the
share driver supports it and if the share network parameters have
not changed.

- Share servers will be always deleted whe the share server
migration complete operation is finished.

Depends-On: I43bd3fdafea02eb8e853114a57bfb863a441f3ed
Co-Authored-By: Fabio Oliveira <fabioaurelio1269@gmail.com>
Change-Id: I48bafd92fe7a4d4ae0bafd5bf1961dace56b6005
2021-09-07 09:21:32 -03:00
Zuul 45f98a7d0a Merge "Replace retrying with tenacity" 2021-09-03 17:07:51 +00:00
ashrod98 903aab1920 Replace retrying with tenacity
We are replacing all usages of the 'retrying' package with
'tenacity' as the author of retrying is not actively maintaining
the project. Tenacity is a fork of retrying, but has improved the
interface and extensibility (see [1] for more details). Our end
goal here is removing the retrying package from our requirements.

Tenacity provides the same functionality as retrying, but has the
following major differences to account for:
- Tenacity uses seconds rather than ms as retrying did
  (the retry interface in manila exposed time in seconds as well)
- Tenacity has different kwargs for the decorator and
Retrying class itself.
- Tenacity has a different approach for retrying args by
using classes for its stop/wait/retry kwargs.
- By default tenacity raises a RetryError if a retried callable
times out; retrying raises the last exception from the callable.
Tenacity provides backwards compatibility here by offering
the 'reraise' kwarg - we are going to set this in the retry interface
by default.
- For retries that check a result, tenacity will raise if the
retried function raises, whereas retrying retried on all
exceptions - we haven't exposed this in the retry interface.

This patch updates all usages of retrying with tenacity.
Unit tests are added where applicable.

[1] https://github.com/jd/tenacity

Co-Authored-By: boden <bodenvmw@gmail.com>
Co-Authored-By: Goutham Pacha Ravi <gouthampravi@gmail.com>
Closes-Bug: #1635393
Change-Id: Ia0c3fa5cd82356a33becbf57444f3db5ffbb0dd0
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2021-09-01 18:31:38 -07:00
Maurice Escher 68e3783522 handle replica state on migration complete
Set share instance replica_state to 'active' after successful migration
if the share is involved in a replication setup.

Change-Id: I6cf8a08379b2f2b0fd1bcada4cd20c39adc01f47
Closes-Bug: #1927060
2021-08-12 23:06:22 +00:00
kpdev 18668d2465 Early validate for CIFS without security service.
To create a share with protocol CIFS it is mandatory to add a security
service to the share network beforehand. If this is forgotten the share
ends up in error. Validate the security service association based on
share protocol from given driver. Raise invalid request exception if
needed association between share_network and security_service is
missing for given driver e.g. ONTAP.

DocImpact

Closes-Bug: #1900752
Change-Id: Ib7e9850e6439ee5d04f826d129afb1ab06950ce7
2021-08-05 22:44:55 +02:00
Zuul a556e640eb Merge "Remove unused model properties and increase unit test coverage" 2021-03-26 01:03:42 +00:00
Zuul 4f41f86ad1 Merge "fix unmange share with manage_error status will lead to quota error" 2021-03-25 03:04:59 +00:00
Douglas Viroel 75acc51489 Remove unused model properties and increase unit test coverage
This is a follow up patch for [1] which removes some unused model
properties and add more unit tests to increase coverage.

[1] https://review.opendev.org/c/openstack/manila/+/774728

Change-Id: I10af132203cb07cea62839014925c7e4c99499e4
Signed-off-by: Douglas Viroel <viroel@gmail.com>
2021-03-23 09:27:48 -03:00
haixin 73d0a74f3b fix unmange share with manage_error status will lead to quota error
if we failed to manage a share, we don't need to commit the quota usages. so
we should skip quota usages cuts when delete or unmange the share with
status of "error_manage". and the size of error_manage share should be
zero.

Closes-Bug:#1883506

Change-Id: I5c81dd6780890c55c8c6a92491c3f4f507531fdb
2021-03-20 10:45:23 +08: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
Zuul e83517b662 Merge "Add share server limits" 2021-03-12 02:59:45 +00:00
silvacarloss 2fb871cb89 Add share server limits
Add two new capabilities to manila. It is possible to set limits
to share server size and share instances in a share server by
setting `max_share_server_size` and `max_shares_per_share_server`
in a backend stanza.

Change-Id: I3170478d3aa2d09cb2adc32233dc57bc59029a56
Partially-Implements: bp new-share-server-limits
DocImpact
2021-03-08 21:35:06 -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
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
silvacarloss 346cebcbbb Follow up change for share server migration
Addresses few observed issues in the share server migration
core change.

Change-Id: Ib20faed6d8597f1b7a645f5674f5797e3d3e5ded
2020-09-22 11:14:51 +00:00
silvacarloss 413e5e6d08 Fix manila OverQuota issue while managing shares
Fixes the OverQuota issue while managing shares. Now, when a share
manage request is received and there is no available quota to this
resource, manila will allow the quotas to be exceeded and the
administrator will need to adjust it.

Change-Id: If6edfa79965f1a0e6959b436c53a714217d23f7d
Closes-Bug: #1863298
2020-09-18 21:28:11 +00:00
Douglas Viroel 39efc2bde8 Add share server migration
This patch adds support for migration of share servers. This
migration is performed using a two-phase approach. Administrators
are now able to request the migration of a share server within and
across backends, with the possibility of chooosing a different share
network for the destination share server.

- A new field called `task_state` was added to the share server
  model in order to help the administrator to track the share server
  migration steps. A new field called `source_share_server_id` was
  added to link destination and source share servers.

- A new periodic task was added to track migration of share servers
  and its resources.

- Two new states were added: `server_migrating` and
  `server_migrating_to` to represent that share migration is in
  progress.

- When performing the server migration, manila will not go to the
  scheduler, instead it will provide a request spec to drivers
  during migration check driver call. It'll be up to the driver
  validate if there is free space to handle the share server.

- A new API called `share-server-migration-check' was added to
  check the feasibility of a migration, before actually triggering
  the start operation.

APIImpact
DocImpact
Partially Implements: bp share-server-migration

Co-Authored-By: Andre Beltrami <debeltrami@gmail.com>
Co-Authored-By: Carlos Eduardo <ces.eduardo98@gmail.com>
Co-Authored-By: Felipe Rodrigues <felipefuty01@gmail.com>

Change-Id: Ic0751027d2c3f1ef7ab0f7836baff3070a230cfd
Signed-off-by: Douglas Viroel <viroel@gmail.com>
2020-09-10 08:52:08 -03:00
Felipe Rodrigues a9ce0520f4 Add the share-type for the server setup metadata
The driver setup server step may require the share-type that has
originated the server creation. The type is accessible by the
method that choose whether reusing or creating a server, so it
should be accessible when creating (setup server).
It bumps the share RPC version to 1.20.

Partially-implements: bp netapp-share-server-nfs-modify
Change-Id: I8daf919a764075998be95c5845807bec37104c78
2020-08-21 17:30:39 -03:00
maaritamm 853d4fbceb Add user message when share shrinking fails at the driver
Not all drivers support share shrinking.
This patch adds a user message when shrinking fails due to operation
not being supported.

Change-Id: I5137cd972ec7737d70865038d7b82cfe13b9566c
Closes-Bug: #1802424
2020-05-29 14:54:21 +00:00
Douglas Viroel 9fbde73868 Fix pep8 issues
Fixing pep8 issues for flake8 release 3.8.0:
 - E741 (ambiguous variable name)
 - E225 (missing whitespace around operator)

Change-Id: I23c8a07d6ab8745bd3d32922b24920bde2f9eeb8
2020-05-12 11:20:20 -03:00
danielarthurt 7aeed39ba9 Update share-manager behavior for shrink share operation
This patch updates the share-manager to handle with the
"ShareShrinkingPossibleDataLoss" driver exception in an appropriate way
by setting the status to "available", and sending to the user an error
message warning that the shrink operation was not completed.

Change-Id: Ie1e7fcbf116d3fd831e550aa70f02a3aa60291b8
Related-Bug: #1858328
Depends-On: Idf34a149e5a975d5fbced0ec78d102c5d90b87c6
2020-04-22 15:30:08 +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