Commit Graph

60 Commits

Author SHA1 Message Date
jayaanand.borra@netapp.com ea1ac5f448 Human readable export location core implementation
Export locations are usually too difficult to memo
rize.Currently, there is no way to determine the
export location before the share is created, so
users wait until the share creation request gets
completed, and then they check the export
locations to mount the share. The generated
export locations are often not human readable
 and it is hard to memorize and control them.

Implements: bp/human-readable-export-locations
Change-Id: I72ac7e24ddd4330d76cafd5e7f78bac2b0174883
2024-03-07 17:20:30 -05:00
Manish Honap 6431b86f19 Add config option reserved_share_extend_percentage
'reserved_share_extend_percentage' backend config option allows Manila
to consider different reservation percentage for share extend
operation. With this option, under existing limit of
'reserved_share_percentage', we do not want user to create new share if
limit is hit, but allow user to extend existing share.

DocImpact

Closes-Bug: #1961087
Change-Id: I000a7f530569ff80495b1df62a91981dc5865023
2022-06-14 23:08:31 +05:30
silvacarloss a391d35c45 Migrate LVM driver to privsep
As a part of the community goal [1], we should be replacing
rootwrap in favor of privsep. This change addresses these
changes for the LVM driver. All calls that must run under
sudo are now using privsep.

[1] https://governance.openstack.org/tc/goals/selected/migrate-to-privsep.html

Partially-Implements: bp privsep-migration
Change-Id: Ia76c869f50e2884bcb2ad6e0b150b2dd8aeb2c64
2022-02-22 17:37:50 -03: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 89028725d1 Force disk wipe when running lvcreate
The LVM driver may fail while creating new volumes using the
lvcreate command. Sometimes it can say an existing ext4 filesystem
was found in the destination, but we shouldn't be worried about it.
This change modifies the behavior and forces the lvcreate command
to wipe the space if a signature was found.

Change-Id: I4c10bcdfc499452d4b05dfbee8059be35dfe5586
2022-01-20 17:42:45 +00: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
kpdev 6ca10003a9 Add config option reserved_share_from_snapshot_percentage.
This config option allows different value for reservation percentage,
mostly useful on the platforms, where shares can only be created from
the snapshot on the host where snapshot was taken. The lower value of
this config option against existing (reserved_share_percentage) allows
to create shares from the snapshot on the same host up to a higher
threshold even though non-snapshot/regular share create fails.
In case this config option is not set, the shares created from snapshot
will use reservation percentage value set in 'reserved_share_percentage'.
This will be useful for users who want to keep same reservation percentage
for both non-snapshot/regular and snapshot shares.

DocImpact

Closes-Bug: #1938060
Change-Id: I390da933fe92875e3c7ee40709eacacc030278dc
2021-08-27 19:10:36 +02:00
Goutham Pacha Ravi 8a691d8631 Retry unmount operation on the LVM driver
When a share is mounted on the same host as the manila-share
process, the kernel prevents us from destroying the
mount directory until the share has been cleanly unmounted
from the host. Kernel mounts can take a few seconds to get
unmounted fully especially when there are a lot of
linux namespaces that the mountpoint has been shared to.

Add a retry on these operations to harden the deletion
process and prevent spurious failures.

Change-Id: I3c1a2ec19d6bc18638db0875519ce60f2c89f33a
Closes-Bug: #1903773
Related-Bug: #1896672
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2020-11-11 23:27:16 -08:00
Goutham Pacha Ravi e57809fd74 Harden LVM driver deletion paths
During maintenance, administrators may decide
to unmount shares, snapshots or remove them
entirely prior to cleaning up LVM share resources
in manila. The driver should not fail on deletion
of missing resources.

Change-Id: Ieaf37ec10db9a8bdce6bb195b76335fea9b2b52f
Closes-Bug: #1888915
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2020-07-28 11:20:29 -07:00
Tom Barron c94e1deff1 Update LVM volume extend
- do *not* skip fsck when extending
- have extend resize the filesystem itself
  rather than making a separate execution
  of ``resize2fs``

Closes-bug: #1887694
Change-Id: I67ac549e790322c56d02db4424ec01a5449e6633
2020-07-21 04:47:06 +00:00
Douglas Viroel 6c47b193b0 Create share from snapshot in another pool or backend
This patch enables the creation of a share from snapshot
specifying another pool or backend. In the scheduler, a
new filter and weigher were implemented in order to consider
this operation if the backend supports it. Also, a new
field called 'progress' was added in the share and share
instance. The 'progress' field indicates the status
of the operation create share from snapshot (in percentage).
Finally, a new periodic task was added in order to constantly
check the share status.

Partially-implements: bp create-share-from-snapshot-in-another-pool-or-backend

DOCImpact
Change-Id: Iab13a0961eb4a387a502246e5d4b79bc9046e04b
Co-authored-by: carloss <ces.eduardo98@gmail.com>
Co-authored-by: dviroel <viroel@gmail.com>
2020-04-09 11:15:22 -03:00
Andreas Jaeger 3fdd9983e0 Hacking: Fix W605
Fix:
W605 invalid escape sequence

This is the final change I plan for hacking, the remaining problems
need further investigation by manila team and decision whether and how
to solve them.

Change-Id: I73d73e044eaaf412bf7ace358a3f07c8d269d6cf
2020-04-01 14:38:14 +02:00
Goutham Pacha Ravi 8e1343c9cd Remove support for "lvm_share_export_ip"
The LVM driver accepts a "lvm_share_export_ips"
option instead of "lvm_share_export_ip" since
the Pike release [1]. Let's drop support for this
option and cleanup compatibility code.

[1] Ib3594aa5d7751c829820fce830d87f6ceea6b049

Change-Id: Ifdeb470438c204cc6cc370517833cb2cab5b7822
2019-07-30 16:57:35 -07:00
Goutham Pacha Ravi 817cce347a [LVM] Run filesystem check before assigning UUID
We assign a random UUID with tune2fs to snapshots
and shares created from snapshots so that they
don't conflict with the parent shares/snapshots
when both of them are being mounted.

tune2fs requires that a filesystem check be
performed "recently" before UUID assignments.
So, perform a filesystem check right away to
allow tune2fs to assign a random UUID.

Change-Id: I858a318f7a83e033cc3f2699859e38b6b74c8d24
Related-Bug: #1645751
Closes-Bug: #1798219
2018-10-16 16:52:04 -07:00
Zuul c72557266b Merge "Change ensure share to make startup faster" 2017-12-21 23:39:12 +00:00
zhongjun e351f3b98f Change ensure share to make startup faster
This driver interface is currently being used wrong and needs a rewrite.
This patch adds the ability to solve the potential problem of slow start
up, and deal with non-user-initiated state changes to shares.

Implement BP ensure-share
Change-Id: I704591446cd5f6ad2293c5a18eccf5412d488baf
2017-12-15 08:48:42 +00:00
Ben Swartzlander 42db1e34a7 Simplify the way drivers report support for ipv6
Driver shouldn't have to report support for ipv6 in two
places. Drivers that assert ipv6_implemented=True just
need to implement get_configured_ip_versions. Likewise
ipv4 support is computed by the same method.

Closes-bug: #1734127

Change-Id: I382767918a65b91e99ac1e604304ad01fac332e6
2017-12-06 15:21:53 +00:00
junboli fb17422c86 Enable some off-by-default checks
Some of the available checks are disabled by default, like:
[H106] Don't put vim configuration in source files
[H203] Use assertIs(Not)None to check for None
[H904] Use ',' instead of '%', String interpolation should be
       delayed to be handled by the logging code, rather than
       being done at the point of the logging call.

Change-Id: Ie985fcf78997a86d41e40eacbb4a5ace8592a348
2017-08-03 16:13:32 +08:00
Ben Swartzlander 5cb87d5dc3 Fix multiple issues with revert to snapshot in LVM
Reverts with the LVM driver were happening asynchronously
which resulted in unreliable behavior. This change makes
the reverts synchronous.

Also, the driver now unexports and unmounts both the share and
the snapshot during the revert (required to make the operation
synchronous) which requires changing the driver interface to
include the snapshot access rules in addition to the share access
rules.

Closes-bug: #1707943

Change-Id: Ifea1799e1d2e3963fec7e90ce3f9cb47b9f02f4f
2017-08-02 16:48:40 -04: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
Jenkins 1ef7e47147 Merge "Add share usage size tracking" 2017-07-26 16:01:03 +00:00
zhongjun f68c1a4080 Add share usage size tracking
We need to have a way to gather information about actual share storage
usages, so cloud operators could use this information for billing,
health checks and/or other purposes.

Change-Id: Iaca1bb541a34af862b938e17e4a56d53de7a9cc4
Implement-Blueprint: share-usage-size
2017-07-26 04:09:48 +00:00
Ben Swartzlander 3755978ef7 Allow 2 or more export IPs for LVM driver
Supporting dual IPv4/IPv6 backends will eventually require
multi-IP support in the first party backends. This change
enables multi-IP support (IPv4-only currently) in the LVM
driver.

Change-Id: Ib3594aa5d7751c829820fce830d87f6ceea6b049
Partial-Implements: blueprint support-ipv6-access
2017-07-18 16:05:27 -04:00
Tom Barron 840b7293a6 Fix pep8 M325 error with python 3.5
Change-Id: I576bfae6c5b9361ebffb81c97c05f88914f9209e
Closes-Bug: #1694714
2017-06-01 10:11:20 -04:00
rajat29 9932c83c64 Replaced exc.message with str(exc)
For logging the exception message: exc.message has been
deprecated. The preferred way is to call str(exc).
More details: https://www.python.org/dev/peps/pep-0352/

Change-Id: I222352b0383d357fec057cb7631ff7b65e0e973c
2017-05-07 11:20:27 +05:30
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
tpsilva 1f1932eb92 Add mountable snapshots support to HNAS driver
This patch adds Mountable Snapshots support in HNAS driver. Also,
updates feature table in share_back_ends_feature_support_mapping.rst
adding mountable snapshot column.

Implements: bp hnas-mountable-snapshots
Change-Id: I5e2294d218595a7ef28261333ab34d8bcde94ff1
2017-01-25 15:19:34 -02: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
Alex Meade d25f101ab4 Manila Share Groups
Remove the experimental consistency group APIs and
replace them with the experimental Share Group APIs.

DocImpact
APIImpact
Partially-implements-blueprint: manila-share-groups

Change-Id: I79a80a62ae4e0015d6161edc2b93fd1f9ba69537
2017-01-23 21:29:12 +02:00
Clinton Knight d4a379d083 Implement share revert to snapshot
This commit adds the ability for Manila to revert a
share to the latest available snapshot.

The feature is implemented in the LVM driver, for
testing purposes.

APIImpact
DocImpact
Co-Authored-By: Ben Swartzlander <ben@swartzlander.org>
Co-Authored-By: Andrew Kerr <andrew.kerr@netapp.com>
Implements: blueprint manila-share-revert-to-snapshot
Change-Id: Id497e13070e0003db2db951526a52de6c2182cca
2017-01-17 15:06:01 -05:00
Clinton Knight 0d6db3588c Add create_share_from_snapshot_support extra spec
The snapshot_support extra spec has always meant two
things: a driver can take snapshots and create shares
from snapshots. As we add alternate snapshot semantics,
it is likely that some drivers will want to support
snapshots and some of the new semantics while being
unable to create new shares from snapshots.

This work adds a new extra spec,
create_share_from_snapshot_support, that removes the
overloading on snapshot_support. It also makes the
existing snapshot_support extra spec optional,
allowing admins to create types without setting
snapshot_support; shares created with such types
will not support snapshots.

APIImpact
DocImpact

Co-Authored-By: Goutham Pacha Ravi <gouthamr@netapp.com>
Implements: blueprint add-create-share-from-snapshot-extra-spec
Change-Id: Ib0ad5fbfdf6297665c208149b08c8d21b3c232be
2016-12-21 09:57:08 -05:00
Valeriy Ponomaryov c162c45404 [Generic driver] Fix generation of admin export location
For managed and created from snapshot shares.

Change-Id: I6e7eca54725d1aef994d617f253e73909a9d8303
Closes-Bug: #1646097
2016-12-12 15:33:23 +03:00
Valeriy Ponomaryov c93e812a58 [LVM,Generic drivers] Fix relationships between parent and child shares
Reportedly [1], the kernel-nfs-server has a bug where we have overlap of
filesystem identifiers using LVM volumes and their snapshots.

We face this bug in manila LVM driver and Generic driver when we use
cinder LVM driver. So, fix it generating unique UUID for all
snapshots (only for LVM, because we cannot do it in Generic driver
while we do not have "mount-snapshot" feature support there) and
child volumes that will be exported as child shares.

[1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1071733

Change-Id: Ib93bfb0d4184da1e70ecece6fde6931e44d05a30
Closes-Bug: #1645751
2016-12-09 20:23:26 +03:00
zhangyanxian eabe8276b2 LOG marker mismatch in the code
For example:
in lvm.py "LOG.warning(_LI" should be "LOG.warning(_LW"

Change-Id: I3a4a95e6d3f2ba3cc9322d5924613827497f202c
Closes-Bug: #1645166
2016-11-30 06:58:09 +00: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
Alexey Ovchinnikov 9a9bc9caec Fix for incorrect LVMMixin exception message
In case when lvm_share_export_ip option is not specified in
the config LVMMixin throws an exception which reports that
share_export_ip option is not specified. This change fixes
confusing message.

TrivialFix

Change-Id: I87fd1794ed43115e206c188e0a752ad3ed6edbb3
2016-03-18 12:59:01 +03:00
tpsilva 02a9a2c3e2 Remove default values for update_access()
update_access method has None as default values for add_rules and
delete_rules. These parameters should always be iterables, so this
should be removed. This patch removes the default values for this
method on the base class and on all implemented classes.

Change-Id: I86f4ccc9d496ec6183bd0fa5be9a77c3451378d5
Closes-bug: #1555294
2016-03-14 15:24:41 -03:00
vponomaryov e49324f671 Fix lock decorator usage for LVM and Generic drivers
DHSS=False mode of LVM and Generic drivers uses not safe locking
for NFS helper. So, several instances of same driver may suffer
from race conditions for modification of NFS config files.

So, make this lock external (inter-process) and add possibility to
set up "lock_name", that is useful in case of LVM driver. Also,
make Generic driver use "instance_id" instead of IP address.
In those both cases we avoid race conditions.

Change-Id: I0687b1080cb6a0e1d3bf7c87066fa46c06977181
Closes-Bug: #1550378
2016-03-14 15:01:04 +02:00
Julia Varlamova fbfd65b338 Implement update_access() in generic driver + LVM
Add update_access() method to generic and LVM drivers,
to NFSHelper and CIFSHelper.

Remove allow_access() and deny_access() from helpers.

Partially implements bp new-share-access-driver-interface

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

Change-Id: Ie34c92f8b9dc95d6af5cb150427503bf66543ab6
2016-02-28 14:44:26 -03:00
Ben Swartzlander 29020b47f7 Change sudo to run_as_root in LVM driver
The LVM driver was using sudo for one command instead
of proper rootwrap usage. This caused failures when the
user running manila-share didn't have passwordless sudo
access.

Depends-On: Ib1896997f2e7a505b5bf8ec0c9e5ee35942f79a6
Change-Id: I48ea946c2b8de2ebf0e067ef4829b81cabd1464f
Closes-Bug: 1550121
2016-02-26 09:24:49 -05:00
Daniel Stelter-Gliese a88c93ba2c LVM driver: Pass '--units g' to vgs invocation
This fixes an issue where "large" volume groups are reported with a VSize
in 't' units and thus throw an IndexError in the applied regex match.

Change-Id: If8d7ced15e9739baeb2aed280d3e8ff3503b16fe
Closes-Bug: 1542054
2016-02-07 16:44:18 +01:00
Julia Varlamova 401c8d982e Add LVM driver
Reuse code of old LVM share driver.

LVM Driver is 1st party Manila driver with NFS and CIFS support
and no share server support.

LVM Driver doesn't rely on Neutron, Nova, or Cinder. As such, it
is ideal for testing purposes and, after a period of maturation,
it should be useful in production environments.

Move generic driver's helpers to manila/share/drivers/helpers.py
and reuse them in LVM driver.

Implement 'ro' access, user access, extend_share function for
LVM driver.

Implements bp lvm-driver

Change-Id: Ia46c51ed400dbb0f1d87a758fb165ca711ed3d7c
2016-01-20 17:15:30 -05:00
vponomaryov dd4bd5c487 Remove LVM driver
Support of LVM driver is planned to be dropped as it is duplicates
functionality from Cinder. Default driver is Generic driver, that uses Cinder.

Changes:
- removed LVM driver
- removed related stuff to LVM driver

Partially implements blueprint remove-lvm-driver
Change-Id: If2df592db082fdc5d609a5ce644106fee7d0583d
2014-08-19 12:05:12 +03:00
Dirk Mueller c4b022524b Fix E265 block comment should start with '# '
Address the new pep8 warning that block comments should
start with the sequence '# '.

Change-Id: I52ca5d63b1ca9a465ba36dc9254928f858f2a094
2014-07-14 10:17:10 +02:00
Christian Berendt 942503d8ed Enabled hacking check H403
* [H403] Multi line docstrings should end on a new line.

Change-Id: Idd2d40c6304a0f75b192dbbe88c1d81b59dfa957
2014-07-10 16:53:41 +02:00
Pete Zaitcev ad2fa5f534 Fix typo in error message for share_export_ip
Change-Id: I031ad0f213bb5ba6eb12db9ebbe66b1a39b1a405
2014-07-07 20:38:46 -06:00
Yulia Portnova e41faa875b Removed redundant methods from singletenant drivers
setup_network,get_network_allocations methods
are not called by manager in singletenant drivers.
So we do not need to define them.

Partially-implements bp setup-teardown-server-enhancements

Change-Id: I17d1f26dfc1e322738991f65aac8beb216e47a98
2014-07-02 13:37:11 +00:00
vponomaryov 3f0ab888d3 Fix lvm driver to be compatible with share manager
After last changes to share manager, LVM driver became incompatible.

Change-Id: I335afd8ba7f4d0e73c7f179290608b2b873651c7
2014-06-17 15:42:56 +03:00