Commit Graph

293 Commits

Author SHA1 Message Date
Zuul b6010bb746 Merge "Add support for share/snapshot deferred deletion" 2024-03-12 21:51:10 +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
agireesh 6909a7c213 Share backups enhancement
Added new column named 'backup_type' in 'share_backups' table
and changes the share common api libs to support the dhss_true
configuration for share backup creation

Partially-implements: bp/share-backup
Change-Id: Ifb88ec096674ea8bc010c1c3f6dea1b51be3beaa
2024-03-12 15:56:38 +05:30
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
Kiran Pawar 3a2d220f8a Update Share backup APIs and add api ref
- Follow up change to fix suggestions from earlier pull request i.e.
  https://review.opendev.org/c/openstack/manila/+/343980 .
- Add API-ref docs
- Rename column availability_zone to availability_zone_id in
  share_backups table.

Implement: blueprint share-backup
Closes-bug: #2031311
Change-Id: Ice01ab7892b1eb52b3202f2c79957977f73f3aca
2023-08-25 13:15:05 +00:00
zhongjun 0b99fdaa9a Implement share backup
Add share backup feature in Data Copy Service and
Share Service. It will allow the user to create, restore
and delete backups as well as listing backups and showing
the details of a specific backup.

APIImpact
DOCImpact

Change-Id: I7d10cf47864cd21932315375d84dc728ff738f23
Implement: blueprint share-backup
2023-08-10 11:11:42 +00: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
Maurice Escher ca90c87c47
skip periodic update on replicas in 'error_deleting'
Change-Id: I737dbc5138c81e6708b9ebae7e7c11622e124a3d
Closes-Bug: #2024578
2023-06-26 13:28:22 +02: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 74ae712d58 Merge "Add 'state' column in 'services' table." 2023-02-24 23:52:59 +00:00
Zuul e5504f03c0 Merge "Fix exception in share transfer accept routine" 2023-02-24 21:07:15 +00:00
Kiran Pawar 98be6376b2 Add 'state' column in 'services' table.
When manila services are stopped or restarted via stop(), the DB
entries are not deleted, they are destroyed only in kill() method. In
cluster deployments, where multiple instances of manila services are
deployed via PODs, unique hostname is derived from node name. However
if pods are deployed again and launched on new hosts/nodes, the old
entries of manila service remains as it is.
Fix it by adding 'state' column in 'services' table and introducing
per service cleanup function. On service stop, state is changed to
'stopped' and cleanup function will delete 'stopped' services unless
they are 'up' again before cleanup periodic interval.

Closes-bug: #1990839
Change-Id: I8b71c4c27ff8fcb25616a95a5ed8362a7f4ffc61
2023-02-23 11:12:00 +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
Kiran Pawar 5f0f14a7f8 Add quiesce_wait_time option to share replica promote API.
Currently netapp_snapmirror_quiesce_timeout is an option of replica
promote that can only be set by the operator. There are scenarios where
high timeout value set by operator does not fit well e.g. disaster
stroke and user want to do an unplanned failover fast. Added new
option 'quiesce_wait_time' to share replica promote API which allows
to use specified wait_time(in seconds) instead of config option.

Closes-bug: #2000171
Change-Id: Ib02063ee8b82f7374cd89f90e7f24a845c6c7cd7
2023-02-08 16:05:28 +00:00
Zuul 031fab2c8f Merge "Fix replica quotas allocation during share migration" 2022-10-13 23:28:54 +00:00
Felipe Rodrigues 3bd8fe3cfe Fix Create From Snapshot with Server Limits
Share Server limits must be ignored in case the new share is
from a snapshot and same host as the parent, since they must
be in the same server.

Closes-bug: #1918845
Change-Id: I1c611f4a7f3590b571f75ceca17c2fc3d8f3ad7a
2022-09-14 23:31:09 -03:00
Zuul d910514004 Merge "Fix available share servers to be reused" 2022-08-30 00:08:10 +00: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
haixin 7f2b25332a remove usage of six library
remove usage of six library from the following directory:
1:share
2:volume
and some files.

Change-Id: If5bb2976bc54887c74649a00deaeaa71e296aaaa
2022-02-10 02:46:34 +00:00
silvacarloss 8c25a0b297 Fix note in the share manager
Addresses a comment that was added regarding a NOTE introduced by
change [1]

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

Change-Id: Ib4a03db65552bcfce0b21acd7499d0e1ed88db3e
2022-01-13 19:22:01 -03:00
Zuul 5b6197821b Merge "Force share server selection on nondisruptive migration" 2022-01-13 18:47:28 +00: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
Zuul 5ff97f51a2 Merge "early return for _share_replica_update() if there is no active replica" 2021-12-09 00:09:13 +00:00
Zuul 1856bf632c Merge "Follow up for share server migration enhancements" 2021-12-08 21:18:28 +00:00
Maurice Escher 7b7d18e142 early return for _share_replica_update() if there is no active replica
If the parent share of the replica has no active replica,
this is an error situation where _share_replica_update() simply
returns and logs a warning if the replica being acted on has not
been already in error state itself before.

Change-Id: I9bdbbaafba413fa4b2a783130fd58a4b6c2cea4b
Partial-Bug: #1924230
2021-12-03 15:49:55 +00:00
Zuul 2287838bde Merge "Don't run periodic_share_replica_update() on active replicas" 2021-09-16 20:24:58 +00:00
silvacarloss a94016c8bc Follow up for share server migration enhancements
Adds a note to the code explaining the need to create new network
allocations when a share back end supports reusing the share
server.

Change-Id: Ic373f7643f7435ecef40e6b5494498ab8967b2ff
2021-09-08 19:26:53 -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
Tom Barron 5af3b8e68b Remove deprecated config and auth
Remove manila configuration options
and auth classes that were deprecated
before the Ussuri release.

Change-Id: I148225926cd249a0dd8d1f8c02b22ed06487f405
2021-04-26 11:53:58 -04:00
Maurice Escher 5ba3117f20
Don't run periodic_share_replica_update() on active replicas
Similarly to periodic_share_replica_snapshot_update() skip active
replicas and do what the comment above says.

Change-Id: I719c670416c06f8eb9228a3537034285ae3733b4
Partial-Bug: #1924230
2021-04-16 15:08:53 +02:00
Zuul 36672dcec6 Merge "Add exception for insufficient privileges when using security services" 2021-03-26 01:25:19 +00:00
Zuul a556e640eb Merge "Remove unused model properties and increase unit test coverage" 2021-03-26 01:03:42 +00:00