Commit Graph

18 Commits

Author SHA1 Message Date
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
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
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
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
zhongjun a1ba28cad3 Fix cannot deny ipv6 access rules
We cannot deny ipv6 access rules because we remove the ipv6
access rules from global delete rules, not just remove the
ipv6 access rules from driver update_access interface parameters.
So the ipv6 access rules cannot be deleted in db.
Now, changed to only remove the ipv6 access rules
from the driver update_access interface parameters(add_rules,
delete_rules, access_rules_to_be_on_share).

Closes-bug: 1707066

Depends-On: Ifea1799e1d2e3963fec7e90ce3f9cb47b9f02f4f

Change-Id: Idd0014d898d5468922625e62f9e649926dc04e35
2017-08-02 18:16:33 +00:00
zhongjun2 2b40e5618f Enable IPv6 in manila(network plugins and drivers)
Please read spec for design detail [1].

Support IPv6 in IP drivers, networks and share
type extra specs.

Co-Authored-By: TommyLikeHu(tommylikehu@gmail.com)
Co-Authored-By: Ben Swartzlander <ben@swartzlander.org>

[1] f7202a6cfe32a057f752a4e393f848f8a0211c36

DocImpact

Partial-Implements: blueprint support-ipv6-access
Change-Id: I96d3389262e9829b8b4344870cdf5c76abd22828
2017-07-27 18:28:15 +08:00
yfzhao 059fae0ed5 Remove log translations in share and share_group 4/5
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.
This is the 4/5 commit.
Old commit will be abandoned: https://review.openstack.org/#/c/447822/

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: Ia46e9dc4953c788274f5c9b763b2fed96c28d60e
Depends-On: I9fd264a443c634465b8548067f86ac14c1a51faa
Partial-Bug: #1674542
2017-03-31 10:20:11 +08:00
Ben Swartzlander a7d8363d32 Pass access rules to driver on snapshot revert
In order to revert to a snapshot in the LVM driver (and
very likely other drivers) the list of access rules is
needed, so this change modifies the driver interface to
provide this extra information.

This change requires preventing a revert to snapshot
operation while access rules on the affected share are
out of sync.

Closes bug: 1658133

Change-Id: Ia6678bb0e484f9c8f8b05d90e514801ae9baa94b
2017-02-07 11:15:27 -05:00
Goutham Pacha Ravi 0970eb6e3a Add cast_rules_to_readonly to share instances
- Add Database migration to introduce the column on the
  share instances model.
- Set the field to True if creating read-only secondary
  replicas, unset while promoting them.
- Set the field to True if drivers don't support writable access
  to migrating shares, or if using host assisted migration.
  Unset if migration fails, or is canceled.
- Expose the field via share-instances and share-replicas
  APIs to administrators.

Supporting read only-access rules is part of the minimum
driver requirements in manila.

APIImpact
DocImpact

Implements: bp fix-and-improve-access-rules

Co-Authored-By: Rodrigo Barbieri <rodrigo.barbieri@fit-tecnologia.org.br>

Change-Id: Ie8425f36f02cbcede0aaa9f3fe1f5f3cf23df8b8
2017-01-20 22:49:56 +00:00
Goutham Pacha Ravi 64a73b1419 Refactor Access Rules APIs
- Pull up policy check to beginning of the APIs.
- Avoid making access rules changes when one or
  more instances of the share are in an invalid state.
- Add back the per rule share instance access status.
  This restoration provides better visibility for which
  rules were applied successfully.
- Remove 'updating' and 'updating_multiple' as valid
  states for the share instance access rules status.
- Deprecate the access rule state 'new' in favor of
  'queued_to_apply' and the share instance access rules
  status 'out_of_sync' in favor of 'syncing'.

In a new API micro-version:
- Allow access rule changes irrespective of the share's
   access_rules_status.
- Expose new access rule states and share's
  access_rules_status values.

Access rules for each share instance now transition
from 'queued_to_apply' to 'applying' to 'active' or 'error';
and from 'active', 'queued_to_apply', 'applying' or 'error'
to 'queued_to_deny' to 'denying' to 'deleted'.

APIImpact
DocImpact

Partially-implements: bp fix-and-improve-access-rules
Co-Authored-By: Mike Rooney <rooneym@netapp.com>
Change-Id: Ic25e63215b5ba723cbc8cab7c51789c698e76f28
2017-01-19 15:02:58 -05:00
Rodrigo Barbieri ec0cda28cd Fix share writable in host-assisted migration
For drivers that implement update_access always through recovery
mode, access rules previously set to read-only were being reset
to read-write when the Data Service was adding/removing its access
rule.

Fixed it by integrating the logic that casts DB rules to read-only
into access helper class.

Change-Id: Ife35dcdb99dffa2f266b5c2f6a68fe163da7edd3
Closes-bug: #1626523
2016-11-29 16:55:32 -02:00
zzxwill fb44a0a49e Put all imports from manila.i18n in one line
Put '_', '_LW', '_LI', '_LE' from manila.i18n in one line
to make it beautify. Nova, neutron and many other projects
follow this rule. Like
bc5035343d/nova/virt/disk/mount/nbd.py
ee42af1011/neutron/cmd/ipset_cleanup.py
(added more files)

Change-Id: If7ed442ebe946b32b3234ce37b38ee3a5ccbcb39
2016-09-14 06:07:33 +00:00
Ramana Raja 0d4f2ee4e0 add access_key to share_access_map
For backends with internal authentication system,
e.g. Ceph, that return ``access_key`` (credential) for
client identities that are granted share access:

* Retrieve ``access_key`` as return value of driver's
  update_access()

* Store ``access_key`` in ShareAccessMapping model

* Expose it in access_list API

APIImpact

DocImpact

Partially implements bp auth-access-keys

Co-Authored-By: John Spray <jspray@redhat.com>

Change-Id: I486064f117cf3001dba7735ca92a7d89aee3ce5b
2016-08-22 20:41:19 +05:30
Valeriy Ponomaryov d878826cf3 Fix concurrent usage of update_access method for share instances
In mitaka, update_access merged with a known concurrency issue.
This concurrency has been randomly failing in our CIs. This change
adds a lock mechanism to prevent that, while rules are being removed
by a thread, a parallel thread adds back or handle the same rules
that are being removed.

Also, a late mitaka update_access patch [1] broke share migration access
rules consistency, thus leaving stale access rule data on share server
that hosted the share prior to its migration. This patch addresses this
by preventing the refresh mechanism from adding back rules
that are removed.

[1] I0f863cbae4d8af0660114161deda7bf7aa60d71d

Change-Id: Ief3b15eefc0fc325a2a5418fc7ac2724c315cc21
Co-Authored-By: Rodrigo Barbieri <rodrigo.barbieri2010@gmail.com>
Co-Authored-By: Goutham Pacha Ravi <gouthamr@netapp.com>
Closes-Bug: #1566815
Closes-Bug: #1609414
2016-08-08 20:10:57 -03:00
Ramana Raja 8da0cb6f2f share/access: allow maintenance mode to be triggered
... by preserving the error state of the share
instance's ``access_rules_status``.

Closes-Bug: #1605203

Change-Id: Ib0b01ee4b52e6c05d36484bdf3faa1b4db4b849a
2016-07-25 22:19:02 +05:30
tpsilva 70f59f7b7c Fix update_access concurrency issue
With the new update_access interface, concurrent requests to allow
access might get lost when the driver takes a long time to process
the new rules. This patch fixes this issue by verifying for the
existence of new unprocessed rules at the end of the update_access
method.

APIImpact
access_allow action on shares with access_rules_status 'out_of_sync'
was previously disallowed with HTTPBadRequest. Now, the action is
disallowed only for shares with access_rules_status set to 'error'.

Change-Id: I0f863cbae4d8af0660114161deda7bf7aa60d71d
Closes-bug: #1550295
2016-03-18 16:02:21 -03:00
Rodrigo Barbieri 51d9649a48 Fix delete when share not found in update_access
Whenever drivers throw exceptions during update_access,
share cannot be deleted, not even with force-delete.
Some drivers already do not throw exception in delete_share
in such cases, but update_access should still throw exception
if share is not found when allow_access or deny_access
are called.
This patch adds possibility for driver throwing a
ShareResourceNotFound exception to let the manager
know share does not exist in backend anymore.
Drivers that already handle this case in delete_share
(by not throwing exception) only need to change update_access.
Additionally, adding possibility of share being completely
deletable if force-delete is specified in API call.

Closes-bug: #1550377
Change-Id: Iccce421f60234bc031f01370319a8918104b099b
2016-03-14 17:43:29 -03:00
Igor Malinovskiy b1b723ad0b Add update_access() method to driver interface
- Add update_access() method to driver interface
- Move all code related to access operations to ShareInstanceAccess
class
- Statuses from individual access rules are now mapped to
share_instance's access_rules_status
- Add 'access_rules_status' field to share instance, which indicates
current status of applying access rules

APIImpact
Co-Authored-By: Rodrigo Barbieri <rodrigo.barbieri@fit-tecnologia.org.br>
Co-Authored-By: Tiago Pasqualini da Silva <tiago.pasqualini@gmail.com>
Implements: bp new-share-access-driver-interface

Change-Id: Iff1ec2e3176a46e9f6bd383b38ffc5d838aa8bb8
2016-02-05 10:41:51 -02:00