Commit Graph

21 Commits

Author SHA1 Message Date
Elias Wimmer 2586252606 Fix generic share resize with 0.0.0.0/24 access
Add missing quotes to exportfs command to protect <world> being
interpreted as file redirect

Closes-Bug: #1911695
Change-Id: Ie95a476e9a81c58df998c3f44da137b023b53cc6
2021-03-19 13:18:38 +01: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
Jan Vondra 2c9fbc7505 CIFS extension failing because of volume in use
Unmouting of the volume from service instance sometimes fails because
Windows clients tends to check the availability of shares even if not
mounted and the volume is in use then.

Fix finds out processes via smbstatus and kill them before unmounting.

Closes-Bug: 1703581
Change-Id: I2cbf959d7cb849d3ead1655b1a0932fd428a9e9f
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2020-05-27 21:44:58 +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
haobing1 7498954506 Cannot remove user rule for NFS share
Use generic driver create share, then add user type access failed.
We can not use 'manila access-deny' to delete the user rule
in a NFS share db.
This path fix this issue.

Change-Id: I9375c4be9361d593102a382eb9c14c2d776bb1aa
Closes-Bug:#1591357
2018-06-22 08:44:47 +08:00
Rodrigo Barbieri 73ef94d38f Fix LVM driver not handling IPv6 in recovery mode
Recovery mode is currently used by host-assisted share
migration to bulk remove and add back rules while casting
them to read only.

Unfortunately, it is not handling IPv6 addresses when removing
the rules in this code path. This patch adds a call to a function
that handles the IPv6 addresses, adding brackets around them.

Change-Id: Icba4b22ad87ccfabcc02078648b1abc6410e5353
Closes-bug: #1746723
2018-02-07 15:16:10 -02:00
Ben Swartzlander 8429b9e4d5 Always disable root-squash
Initially, root squashing was only disabled for rw
shares, but it should also be disabled for ro shares.

Closes bug: #1735832

Change-Id: I916e8c6a8fb553350a977795cb1c4ab4ef817b98
2018-01-05 18:39:19 +00:00
Ben Swartzlander e3b6f4a40e Fix NFSHelper 0-length netmask bug
Add special case handling of 0-length netmasks in NFS helper.
This is required because nfs-utils on Linux support CIDR style
network access unless the netmask is length 0.

Also split out utility function for wrapping IPv6 addresses with
square brackets.

Closes-bug: #1707946

Change-Id: Id907478837099b250a6c88b6b5ff50c214bcdbb2
2017-08-03 14:07:46 +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
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
zhongjun 341161eead Use parenthesis instead of backslashes in tests folder
Use parenthesis instead of backslashes in tests folder

TrivialFix
Change-Id: I6c2ea07b0bfc5852b28e44989406cc10eb972e53
2017-06-19 17:56:01 +08:00
wlhc 7a7c182e35 Fix ``exportfs -u`` usage in generic driver.
When the generic driver extends or shrinks a share it disables access
to the share by removing its export.  Currently it uses the command
``exportfs -u local_path`` to do so, but this fails with current nfs
packages.

Fix the error by calling ``exportfs -u host:local_path`` instead.

Change-Id: Ic489a1607bf82964bf2859e89b3da1f572436d17
Closes-Bug: #1649782
2017-01-17 22:42:40 -05:00
Mark Sturdevant 9157b8afb2 GPFS KNFS: Fix deny access to succeed when possible
Use looser error code checking and add a verify
after deny access so that the call will succeed
whenever it can be confirmed that the access no
longer exists.

This fixes a variety of situations where previously
a return code of 1 while attempting to remove access
would cause the manila access rule to get stuck while
the actual client access export was removed or never
existed.

Change-Id: Ie058a6185e3f5d91fb1cf232301eb0ac6ddcea7e
Closes-Bug: #1651587
2016-12-23 01:17:20 +00: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
Alexey Ovchinnikov 49856dc9c8 Bring remote and local executors into accord
It appears that remote executor (processutils.ssh_execute)
and local executor (processutils.execute) have different
expectations for command keywords containing spaces. This
difference manifests itself in helper failures either for
one executor type or for another. This change adds command
preprocessing to generic driver which seems to be the only
active user of both remote executor and failing helpers.

Change-Id: I26eaca3ca652171fbf20d7580f90eef4f935332e
Closes-Bug: 1621033
2016-09-22 09:18:35 +03:00
Thomas Bechtold 7bf936b901 Fix generic and LVM driver access rules for CIDRs
Linux 'exportfs' utility does not provide access when short forms of
CIDRs are used, as following:

1.2.3.0/24

It provides access only using long forms as following:

1.2.3.0/255.255.255.0

So, parse short forms into long ones in NFSHelper to
fix NFS exporting.

Change-Id: Ib9432d8123c6be395d3c7bdda347ae676431802c
Closes-Bug: #1552526
2016-03-17 17:30:14 +01: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
Rodrigo Barbieri 93ddac3dea Fix NFS helper root squashing in RW access level
Root squashing should be disabled in NFS helper when adding
RW access rules to fix permission denied issues while different
users are creating files and folders in the same share.

Change-Id: I36d1cab62fcc1a2279454096f9d0ad65c96e7b9b
Closes-bug: #1551422
2016-03-01 11:22:15 -03: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
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