Commit Graph

33 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
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
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
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
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
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
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 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
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
Tom Barron b85248bce6 Use assertTrue rather than assertEqual(True, ...)
Manila unit tests contain several occurences of
assertEqual(True, ...) instead of assertTrue(...).

Fix these occurences and add hacking check so new
occurences don't creep into the codebase.

Closes-Bug: #1584948

Change-Id: Ib586590b9efcb5253e8c09ee735a8ffb62b44d74
2016-05-23 19:07:54 -04: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
Jenkins 0a354c7c6e Merge "Change sudo to run_as_root in LVM driver" 2016-02-27 03:39:52 +00: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
Béla Vancsics ecbc7f7fd2 Use assertIsNone instead of assertEqual(None, ***)
Instead of using assertEqual(None, ***), developers should
use assertIsNone(***).

TrivialFix

Change-Id: I9c7a7569e50bb87f50e48a54cfbf03d19727de4b
2016-02-25 08:22:35 +01: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