Commit Graph

16 Commits

Author SHA1 Message Date
Gray Lutalo b7a1b5b2cf Forbid resetting state of active replicas
In a replication setup, users encountered a critical
issue where they unintentionally reset the replica_state
of an active replica while attempting to resolve errors
on a non-active replica. This led to a situation with no
active replica, causing data loss. Users expected
server-side validation to prevent such actions.

This commit implements the necessary validation in the
codebase to ensure that the reset_replica_state action
cannot be applied to active replicas, addressing the
reported issue and improving data integrity in
replication setups.

Co-Authored-By: Solly <solobarine@gmail.com>
Closes-Bug: #2015328
Change-Id: I629669476e585a834673b8c8b49ad4b0270b877f
2024-03-09 07:40:42 +01: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
Kiran Pawar ba5455cbd6 Fix tests for 'share-network' param in share replica create
Fix suggestions from
https://review.opendev.org/c/openstack/manila/+/804578

Closes-Bug: #1925486
Change-Id: I92d5ed80fb659526dff795cf474826bed45a1d19
2023-01-10 16:33:48 +00:00
kpdev b49605945a Add "share-network" option for replica create API.
Share replica create API does not allow to specify share network and
forces to use parent share's share network. This is problem for some
use-cases, e.g. migration from one share network to another share
network via replication is not possible. Fixed by allowing to pass
'share-network' option for share replica create API and make sure both
parent share-network and user provided share-network will have same
security service association.

Partial-Bug: #1925486
Change-Id: I9049dcd418fbb16d663ab8ed27b90c765fafc5d3
2022-08-15 11:01:08 +00: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
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 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 ee5ebc8462 Graduate share replication feature
From this patch, share replication feature is no longer considered
experimental. The experimental headers were removed from the share
replication APIs.

DocImpact
Partially-implements: bp graduate-share-replication-feature
Change-Id: Idf8af1c96df373fbcbb4024db490cb4dab42faf7
2020-08-24 13:27:49 +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
silvacarloss dceced6d6e Add new quota for share replicas
This patch adds new quotas for share replicas and replica sizes.
This quotas can be related to either tenants and users or tenants
and share types. Now, when creating a share replica, manila will
check if there are resources available for that specific request.

Partially-Implements: bp limit-share-replicas-per-share
Change-Id: I8ba7bc6f167c28d6c169b2187d0e1bda7cad3f69
2020-04-06 13:17:30 +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
zhongjun 6d29762f87 Delete unused test check
TrivialFix

Change-Id: Id93a5062c48e99afc22594f05cbf29cffce2494e
2018-06-09 22:34:35 +00:00
Ben Swartzlander 15b27e8fbe Only return share host for admins using shares API
Also, allow filtering by host based on policy 'list_by_host' that
defaults to 'admin only'.

Do not bump API, because it is not considered as expected behavior,
hence should not be kept for old microversions.

Co-Authored-By: Valeriy Ponomaryov <vponomaryov@mirantis.com>
APIImpact
Change-Id: I799bb7378927b6c3ee0f9fe88fd9876a03dd85b5
Closes bug: 1664370
2017-02-16 18:13:31 +00:00
Goutham Pacha Ravi c288d9020a Add Replication admin APIs and driver i/f changes
Add admin-only /share-replicas/replica-id/action APIs:

+---------------------+----------------------------------------+
| reset_state         | To reset the 'status' attribute of     |
|                     |  a replica                             |
+---------------------+----------------------------------------+
| reset_replica_state | To reset the 'replica_state' attribute |
|                     |  of a replica.                         |
+---------------------+----------------------------------------+
| force_delete        | To delete from the DB and attempt      |
|                     | to remove it from the backend.         |
+---------------------+----------------------------------------+
| resync              | To attempt update of a replica         |
+---------------------+----------------------------------------+

Modify the driver interface for create_replica, delete_replica
and update_replica to hand down more information to the driver
during replica operations.

Implements bp: share-replication-admin-actions

APIImpact
DocImpact

Change-Id: I1352f112f3627af4424eb2e3be428b1d13c1d2d5
2016-02-25 09:31:54 -05:00
Goutham Pacha Ravi e983358493 Fix Share Replica details in the API
share_server_id is an admin privileged resource and
the tenant facing /share-replicas APIs are currently
returning it.

Fix this by returning the attribute only if the request is
made with administrator context.

Also add updated_at to better reflect when Manila
last updated the replica.

APIImpact:
Please review contractual changes on API Microversion
2.11. This change does not bump up the microversion
since:
 - Server still is on 2.11
 - /share-replicas APIs are experimental

Closes-Bug: 1544813

Change-Id: I8e4d2823c0737754bddac6ac5f25755842c6d492
2016-02-12 02:17:22 +00:00
Goutham Pacha Ravi f858e537dd Share Replication API and Scheduler Support
This patch provides the scheduler support to filter share
backends matching replication capabilities reported by the
hosts and the replication_type extra_spec provided via the
share_type during share creation.

It also adds wsgi routes, API endpoints and driver entry
routines to support the actions: list, show, create, delete
and promote share replicas. It augments the ShareInstance
DB model with a 'replica_state' attribute and the Share DB
Model with 'replication_type' attribute to support these
workflows.

Replica states are periodically updated from the respective
backends that the replicas are created on.

APIImpact
Impact on existing APIs:
In Microversion 2.11, the /shares APIs return 2 additional
fields during index and show calls for each share: 'has_replicas'
and 'replication_type'. Similarly, the field 'replica_state' is
added to the API response for /share-instances.
Also, deletion of a share that has replicas is forbidden,
returning error code 403.

DocImpact

Co-Authored-By: Alex Meade <mr.alex.meade@gmail.com>

Implements: blueprint manila-share-replication

Change-Id: I10515d55b1291c34777a31d8c6a3a1954f551235
2016-02-11 19:45:37 +00:00