Commit Graph

42 Commits

Author SHA1 Message Date
Csaba Henk 6849f9e386 glusterfs*: factor out common parts
GlusterManager and a few standalone
management routines have been moved
to the newly created glusterfs/common.py;
both glusterfs and glusterfs_native drivers
import these from there. The obnoxious
import of glusterfs to glusterfs_native
has been eliminated.

Partially implements bp modular-glusterfs-share-layouts

Change-Id: I6a94f1056bd45187c0268d75fa854b127b2b562d
2015-09-04 19:24:47 +02:00
Valeriy Ponomaryov af6814f9ca Add possibility to filter back ends by snapshot support
On last midcycle meetup was decided to make snapshots optional feature.

Features:
 - Add new boolean capability 'snapshot_support' to base share driver
   so every existing share driver will inherit it. Make value of it be
   calculated from the fact of redefinition of three main driver
   methods for snapshots 'create_snapshot', 'delete_snapshot' and
   'create_share_from_snapshot'.
- Set extra spec 'snapshot_support' with share type creation by default
  to 'True'
- Restrict deletion of extra spec 'snapshot_support' that is expected
  to exist
- Allow to redefine new extra spec 'snapshot_support'
- Restrict API 'snapshot create' for share created with
  share type that has extra spec 'snapshot_support' equal to 'False'.
- Add migration where new extra spec 'snapshot_support' is added
  to all share types that do not have it yet.

Partially implements bp snapshots-optional
Change-Id: I069d9e911c7d7a708fa518b38ed10572a45e5f42
2015-08-26 23:05:37 +03:00
Valeriy Ponomaryov 554b92e458 Fix exceptions handling for py34 compatibility
Fix following cases:

    "except SomeException, e:"
    "raise exc_value, msg, exc_trace"
    "e.message"

Partially-Implements: bp py3-compatibility

Change-Id: I8c20ae725000895b6b7b7c0da7d4bfba3e4849f0
2015-08-05 17:15:46 +03:00
Csaba Henk 26ff88ca9f GlusterFS: fix retrieval of management address of GlusterFS volumes
We need the so-called management address of a GlusterFS
volume (ssh address of its management node) at a few places
for bookkeping reasons (certain data like GlusterFS version
is stored in management address-keyed dicts).

So far it was available only through ad-hoc mangling of
various attributes of a GlusterManager instance that
represents the volume. Now we make it available
directly from GlusterManager as an attribute.

Also fix an occurrence of ad-hoc mangling going wrong,
ie. where a wrongly constructed address is attempted
to be used as dict key.

Change-Id: Ic5a96bc99943dda3592372512916257d53f61b80
Closes-Bug: #1476710
2015-07-24 09:43:42 +02:00
Ramana Raja 4dbe429408 glusterfs: Edit doc and comments
Edit doc and comments to mention that the driver
- can work with NFS-Ganesha, used by the GlusterFS backend to serve
  NFS shares.
- does not provide read-only access level for shares.

And add some minor cosmetic fixes to the doc.

Change-Id: Ib0e53befbd48e5cbfea98a52876f381384beb268
2015-05-27 12:18:19 +05:30
Igor Malinovskiy 94e8c921db Remove passing DB reference to drivers in Share Manager
- Remove passing DB reference to drivers in __init__() method
- Remove db reference from Generic driver and service_instance
- Remove db reference from Netapp share driver
- Remove db reference from Glusterfs share driver
- Remove db reference from Glusterfs_Native share driver
- Remove db reference from Quobyte share driver
- Remove db reference from IBM GPFS driver
- Remove db reference from HDS_SOP driver
- Remove db reference from HDFSNative driver
- Remove db reference from fake driver
- Remove db reference from unit tests.

Change-Id: I74a636a8897caa6fc4af833c1568471fe1cb0987
2015-04-21 17:23:13 +03:00
Csaba Henk 7e75c380a6 glusterfs, glusterfs_native: perform version checks
- add gluster_version method to GlusterManager class
- gluster: check if version of the GlusterFS server is at least 3.5
- gluster_native: check if version of the GlusterFS server is at least 3.6
- gluster_native: on snaphot creation failure, interpret errno only
  for GlusterFS strictly later than 3.6

Change-Id: I242ea83c3a31670eb6a13c11e39d0c2228170c50
Closes-Bug: #1417352
2015-04-09 17:20:53 +02:00
Csaba Henk 482d304e38 glusterfs_native: negotiate volumes with glusterd
So far glusterfs_native was able to create shares
from volumes listed in 'glusterfs_targets' config
option.

New behavior: a regexp pattern is to be provided
through the glusterfs_volume_pattern config option.
Upon share creation, grep gluster server's volumes
with this pattern and create the new share from
one among those.

Change-Id: I12ba0dbad0b1174c57e94acd5e7f6653f5bfaae8
Closes-Bug: #1437176
2015-04-07 19:25:48 +02:00
Csaba Henk d3b499b9ac glusterfs: add NFS-Ganesha based service backend
Partially implements blueprint gateway-mediated-with-ganesha

Change-Id: I92da2117086ed25f304e8da9db7ca8c686c6463c
2015-02-20 10:01:52 +01:00
Jenkins c65fbe533a Merge "unify some messages" 2015-02-09 17:07:17 +00:00
Valeriy Ponomaryov 63a0504c21 Use oslo_log lib
Module 'log' from oslo-incubator was removed after release of oslo_log library.
So, start using oslo_log, but keep oslo-incubator code yet other common modules
within Manila codebase use it.

Implements bp use-oslo-log-lib

Change-Id: I88224f7c2bd99adb78140dfc3fa73cea437f29cd
2015-02-08 10:42:40 +00:00
Danny Al-Gaaf a6bd0340d2 unify some messages
Unify identical messages by adding '.' or remove/adding
spaces if the content of the message is identical to reduce
translation effort.

Change-Id: Ie611b75fd8891a583fab9e0971a80f329a6793ac
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2015-02-08 10:50:53 +01:00
Thomas Bechtold 071d0b59c1 Switch to using oslo_* instead of oslo.*
The oslo team is recommending everyone to switch to the
non-namespaced versions of libraries. Updating the hacking
rule to include a check to prevent oslo.* import from
creeping back in.
oslo.messaging is the only exception because this package doesn't
currently support non-namespaced imports.

Change-Id: I3987e651bc880c8ffa7c0105df0298679dcd3a43
2015-01-27 09:19:50 +01:00
Ramana Raja ca294a7449 glusterfs: add infrastructure to accommodate NAS helpers
- Refactor the main driver class, GlusterFSShareDriver, to make it
  pluggable with different NAS helpers.

   - Add GlusterNFS helper class to manage shares served by Gluster-NFS
     server. The management of these share was earlier done within the
     main driver class.

- Enhance the methods of the GlusterAddress class that would be used
  by the main driver class and the helper classes. Rename the
  GlusterAddress class to GlusterManager class. This class would
  contain the methods to interface with the backend GlusterFS volumes.

   - Retire GlusterAddress.make_gluster_args() in favor of
     GlusterManager.make_gluster_call(). The make_gluster_call() method
     implements a more correct approach to remote execution. It's
     remote execution is based on processutils.ssh_execute. The
     make_gluster_args() method that it replaces facilitated remote
     execution by prefixing arguments with 'ssh'.

   - Move the interface used to fetch the value of an option set on a
     GlusterFS volume, from the main driver class to the GlusterManager
     class.

Partially implements blueprint gateway-mediated-with-ganesha

Change-Id: I3cbeb49c26f5f24152b42b649ce3bc75451964ef
2015-01-23 01:59:10 +01:00
Valeriy Ponomaryov b719d0ffa6 Replace string driver modes with boolean value
Due to unclear meanings of existing names for share drivers modes it was
decided to replace string driver modes with boolean value, since we have only
two possible values that will clearly say what it used for by name of opt.

This replacement includes following changes:
- String opt 'share_driver_mode' is replaced with
bool opt 'driver_handles_share_servers'. New bool opt does not have
default value and should be defined explicitly.
- Class ShareDriver (parent class for share drivers) now expects additional
argument 'driver_handles_share_servers' which is mandatory and should be
provided by child classes. Expected values are boolean or tuple/list/set of
booleans that says what modes are supported. Above new config opt will be
compared to these.
- Update interfaces 'setup_server' and 'teardown_server' of class ShareDriver.
These interfaces now consider driver modes and call new additional private
methods only when driver is enabled to mode with share servers handling.
These new private methods are '_setup_server' and '_teardown_server', they
should be redefined by child classes when share servers should be handled by
Manila.
- To get know current driver mode within child classes just call property
'driver_handles_share_servers'. It can not be changed by child classes and
returns value that is set by config opt with same name.
- Remove methods 'setup_server' and 'teardown_server' from all share drivers,
that do not support handling of share servers.
- Rename methods 'setup_server' and 'teardown_server' to appropriate
private methods for drivers that do support handling of share servers.
- Update unit tests related to all changed places.
- Make Devstack set new mandatory bool opt.

Implements bp rename-driver-modes

Change-Id: I33402959bc4bbc34cfd4d7308ad0a7bcff3669b5
2015-01-22 10:47:40 +00:00
Ponomaryov Valeriy a9c25274ab Add driver mode attr definition for all drivers
Driver mode functionality was implemented to be able to specify how
driver should work and filter backends scheduling share creation based on this.
Add to all drivers update of attr 'mode' based on its current behavior.

Set 'share_driver_mode' extra spec to volume/share type with one of available
values. Scheduler will use it for host filtering.

Implements blueprint driver-modes-for-scheduler

Change-Id: Ida644f630ee07c51c02aea5d6280980b5d704c2f
2015-01-05 18:40:30 +00:00
Jenkins 7b588c86da Merge "Move networking from share manager to driver interface" 2014-12-17 23:12:12 +00:00
Valeriy Ponomaryov 36db3f3917 Move networking from share manager to driver interface
Several things are implemented:
- Allocation/deallocation now handled by drivers instead of share manager.
It provides flexibility for drivers.
- Network plugin interface was updated to support new approach for
configuration options setting.

Config opts for network plugin can be defined via three sources:
a) using separate config group
b) using config group of back end
c) using DEFAULT config group
Variants (a) and (b) are mutually exclusive, there are switched by
opt 'network_config_group' that belongs to share driver interface.

Implements bp network-helper

Change-Id: I3b05369f01777675c1b834af5ee076d8b7219a0f
2014-12-16 17:32:24 +02:00
Ramana Raja e6f0f88999 glusterfs: create share of specific size
Currently, glusterfs driver creates shares, subdirectories within
GlusterFS volume, ignoring the share size argument. Use GlusterFS's
ability to set hard-limit quota on subdirectories (shares) to enable
creation of shares of specific size.

Change-Id: I28b4787e0ada4f6505d929f8d417218a0dc4d0b4
Closes-Bug: #1401000
2014-12-16 11:10:38 +05:30
Andreas Jaeger 15641fba88 Convert files to use _LE and friends
LOG.warn etc. should be translated separately and thus messages need to
be marked with _LW for LOG.warn, _LI for LOG.info and _LE for LOG.errors
and LOG.exception.

Mark all LOG invocations with proper translation marker.

Use ',' instead of '%' when adding variables to log messages to allow
lazy evaluation.

Add new hacking checks for these.

Change-Id: I31d3ee50f30c63d7d647b1c2b1eae50bf96f0c74
2014-10-31 09:47:59 +01:00
Andreas Jaeger 7b659fc4e0 Use oslo.i18n
oslo.i18n provides the i18n function that were provided by
oslo-incubator's gettextutils module

Import _ where needed, oslo.i18n deprecated the builtin method.

Closes-Bug: #1382187
Change-Id: I12aa1c725aa4bb52a9aa46e9c3d2b303839de48b
2014-10-19 19:21:03 +02:00
Marc Koderer ecf603bc05 Remove vim headers
As discussed in [1] remove all vim headers from manila files.

[1]: http://lists.openstack.org/pipermail/openstack-dev/2013-October/017353.html

Change-Id: I341486c66ffe4dad7db8608fdc66868ceb7ad95a
Closes-Bug: #1229324
2014-10-06 15:00:27 +02:00
Ramana Raja 2ab3e7da43 glusterfs: edit config option specifying volume
glusterfs driver has an option to specify the GlusterFS volume to be
mounted on the Manila host. The GlusterFS volume to be mounted is
presently specified in a file, whose path is the config option
glusterfs_volumes_config. Instead have a string valued config option
in manila.conf that directly takes the same input.

Change-Id: I3f8734174db71ef232620c55d4ecdd2b5d0192ad
Closes-Bug: #1365941
2014-09-17 07:34:38 +00:00
Jenkins 1b6b37c5c6 Merge "Fix some LOG invocations and messages" 2014-09-04 21:48:04 +00:00
Jenkins eaf53abad6 Merge "glusterfs: Fix docstring" 2014-09-03 16:53:58 +00:00
Deepak C Shetty e2fdc03b02 Add support for glusterfs native protocol driver
This patch adds basic support for glusterfs native protocol driver
that uses cert based access type.

A Manila share is a GlusterFS volume. Unlike the generic driver, this
does not use service VM approach. Instances directly talk with the
GlusterFS backend storage pool. Instance use the 'glusterfs' protocol
to mount the GlusterFS share. Access to the share is allowed via
SSL Certificates. Only the share which has the SSL trust established
with the GlusterFS backend can mount and hence use the share.

Establishing the SSL trust between the instance and backend is done
out of band of Manila.

Partially-implements blueprint cert-based-access-type

Change-Id: I229d481086478317f1c43635304a16794372f09d
2014-09-03 11:05:07 +00:00
Andreas Jaeger 5b76212da4 Fix some LOG invocations and messages
LOG.xxx("Hello %s" % xyz) should be LOG.xxx("Hello %s", xyz).
This allows the logging package to skip creating the
formatted log message if the message is not going to be emitted because
of the current log level.

The change touches error, warning and info LOG messages.

Adjust test suite for the above change since LOG now uses two parameters
instead of one.

Fix grammar, add missing "." to log messages in some places.

Change-Id: I86404c34502f07ed6dbda1c82b13db888c60f074
2014-09-03 07:03:00 +02:00
Ramana Raja 7bb119bebc glusterfs: Fix docstring
It is more appropriate to refer to the driver as a flat network
type than as a single tenant.

Change-Id: I3886d74efc38c5ad6a199cd17612b7eb02ffb449
2014-08-29 14:36:40 +05:30
Jenkins 948aa13e7b Merge "Improve help strings" 2014-08-29 06:07:27 +00:00
Andreas Jaeger ab61d9bad4 Improve help strings
Make help strings consistent:
* Add missing spaces between words
* Capitalize first word of help
* Add "." at end of string
* Improve wording and capitalization

This follows the oslo.config style guide:
http://docs.openstack.org/developer/oslo.config/styleguide.html

Change-Id: I8243909249423b6b58ccda0d800856f46b0953c5
2014-08-28 06:56:59 +02:00
Valeriy Ponomaryov e089a1bc6f Remove hash seed dependency for unittests
latest tox has random hash seed enabled, that causes
unstable unittests errors.

Change-Id: I0e24304ca045c5347aa9fd97ee28ac3be774fa31
Closes-Bug: #1359982
2014-08-27 18:59:20 +03:00
Andreas Jaeger ab96ccb1ef Flake8: Fix H302
Fix H302 and enable the test:
H302  import only modules.'from X import Y' does not import a module

Fix also in the touched files the following:
E128 continuation line under-indented for visual indent

Change-Id: I3116c030a5dc0b5be2b4413beaa460e483215774
Partial-Bug: #1333290
2014-08-26 12:50:59 +02:00
Andreas Jaeger 9154f3e55b Flake8: Fix E126 and E127
Fix these issues and enable E126 and E127:
E126 continuation line over-indented for hanging indent
E127 continuation line over-indented for visual indent

Also fix a few occurences in the touched files of:
E128 continuation line under-indented for visual indent
H405  multi line docstring summary not separated with an empty line

Partial-Bug: #1333290
Change-Id: If822401fc7e1db49d595a0736a0dff8e00dfd217
2014-08-23 08:43:02 +00:00
Andreas Jaeger 290769f087 Flake8: Fix F401
Fix:
F401 'XXX' imported but unused
Add noqa where needed, remove extra imports otherwise.

Remove F401 from ignore list.

Partial-Bug: #1333290
Change-Id: Ib71f0dd001c4e4899200b5e60b3a38e4a6c40555
2014-08-23 08:42:36 +00:00
Andreas Jaeger 28ecd93b54 Fix pep8 F821
Fix these issues:
./manila/tests/windows/windowsutils.py:29:1: F821 undefined name 'cfg'
./manila/share/drivers/glusterfs.py:165:1: F821 undefined name 'config'

glusterfs.py: It should be config_file, adjust the message as well.

windowsutils.py: Add import for cfg.

Closes-Bug: #1351959

Change-Id: I9fa5087d2be6ecc262f9581d372f70f96373a387
2014-08-03 19:50:05 +02:00
Ramana Raja d5b611a244 glusterfs: Edit comments and docstrings
- update comments and docstrings.
- format comments and docstrings.

Change-Id: I7f0c3becd96f6b8818d1a8d91f6dd26e23969690
2014-07-31 05:01:08 +00:00
Ramana Raja ad4eab1b94 glusterfs: Modify interface methods
- Modify interface methods to comply with changes to the share manager.
  The changes were in the following commit,
4c8a658d95

Change-Id: I6fde3e6d351f18878dc55fb3535f1dd0b811c352
2014-07-31 10:23:55 +05:30
Csaba Henk ee54dd906c glusterfs: Implement methods to update share stats
Implement get_share_stats, and _update_share_stats methods.

Change-Id: Id6e9aa130c40561c7fe24e86019751c67580c9e1
2014-07-09 16:22:34 +05:30
Csaba Henk 99857a4983 glusterfs: Fix issues in backend instrumentation
- allow share or sub-directory access to more than one guest/ip address
  by modifying the GlusterFS volume configuration options that change
  the Gluster-NFS server settings.

  `nfs.export-dir` option does not interpret a spec of
  '/dir(host1),/dir(host2)'as we expected, ie. two independent access
  specifiers -- instead, it just discards the latter. The required
  format looks as follows: '/dir(host1|host2)'. Update the export-dir
  generating routines accordingly.

- properly remove the last share or sub-directory access setting in a
  GlusterFS volume when needed by an API request to changes access
  rules of shares.

  `volume set` option in GlusterFS volume settings cannot take empty
  value, use instead `volume reset` to go back to defaults

- GlusterFS volume contains all the shares. It has a default setting
  that allows NFS access to its entire contents. So turn off this
  setting as a part of the initial driver setup.

  turn off `nfs.export-volumes` setting.

Change-Id: I652a13d4d34d1b4c5ee3d31af40143a098c38074
2014-07-09 16:22:34 +05:30
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
Andrei V. Ostapenko b92c6f4595 Adds network creation to ShareManager
Partially implements: bp join-tenant-network

Change-Id: I85a69e882ad299b059e40bfea850a169e6e4660d
2014-01-23 13:19:47 +02:00
Ram Raja 419ef809ef glusterfs: Add GlusterFS driver
Added class GlusterfsShareDriver,
derived from manila.share.driver.ShareDriver,
implementing create and delete share capabilities
and access control.

Change-Id: I909ad28d316d071dd1a4790843eae25ade4a9c95
2014-01-07 16:28:34 +01:00