Commit Graph

20 Commits

Author SHA1 Message Date
Kiran Pawar 98be6376b2 Add 'state' column in 'services' table.
When manila services are stopped or restarted via stop(), the DB
entries are not deleted, they are destroyed only in kill() method. In
cluster deployments, where multiple instances of manila services are
deployed via PODs, unique hostname is derived from node name. However
if pods are deployed again and launched on new hosts/nodes, the old
entries of manila service remains as it is.
Fix it by adding 'state' column in 'services' table and introducing
per service cleanup function. On service stop, state is changed to
'stopped' and cleanup function will delete 'stopped' services unless
they are 'up' again before cleanup periodic interval.

Closes-bug: #1990839
Change-Id: I8b71c4c27ff8fcb25616a95a5ed8362a7f4ffc61
2023-02-23 11:12:00 +00:00
Maurice Escher 0339802a5d init_host should be called before RPC consumer is created
This change adds a new hook to Manager class called init_host_with_rpc()
to allow services like scheduler to do something once RPC is ready.

Copied from cinder 65fa80c361
and 60c563f72d

Change-Id: Iac6507a6e395c55f0fec453650009f08c2bb6563
Closes-Bug: #1271568
2021-06-17 07:22:44 -04:00
haixin a8e25b858d Put ensure_share into thread pool to speed up the startup of share service
when we need to start or restart manila share service, will call
init_host().
and call ensure_driver_resources() in init_host(),
will call self.driver.ensure_shares or self.driver.ensure_share to
update all share instances in that host. Currently, only NetApp and LVM
implement self.driver.ensure_shares, Other manufacturers are using
self.driver.ensure_share.
   in large-scale environment, there are lot of share instances in one
host. this will lead to take much time to ensure_share.
   so we can put this operation into the thread pool to speed up the
startup of the service.

Closes-Bug: #1909847
Change-Id: I295d0de0958ebfedd89441f1a2c1b447b74693a0
2021-03-20 11:49:23 +00:00
haixin 37a9e5388d Don't send heartbeats if driver not initializing correctly
This commit adds is_service_ready method to base Manager class that can be
used to indicate that service is not ready or initialzed success. This is
used to block refreshing Service heartbeats if manager will return false
from is_service_ready.

Closes-Bug:#1853940

Change-Id: Ib85468c703dfa51b03d1838bd422c9b2669bc747
2020-01-15 11:34:08 +08:00
Goutham Pacha Ravi a75fe3d7cc Allow configuration of a back end specific availability zone
"storage_availability_zone" in the [DEFAULT] section of
manila's configuration file has allowed deployers to configure
and manage both service (scheduler, share manager) and storage
system availability. However, quite often manila's services
(api, scheduler, share and data managers) are run on a dedicated
control plane that is a different failure domain from that of
the storage that manila manages.

Also, when using share replication, deployers would need to
run multiple manila share manager services with different
configuration files, each with their own
"storage_availability_zone".

To allow flexibility of separating service and storage
availability zones, we introduce a new configuration option
"backend_availability_zone" within the share driver/backend
section. When this option is used, it will override the value
of the "storage_availability_zone" from the [DEFAULT] section.

Change-Id: Ice99a880dd7be7af94dea86b31a6db88be3d7d9b
Implements: bp per-backend-availability-zones
2019-01-23 17:13:24 +00:00
Valeriy Ponomaryov 48221b0f4c Reuse 'periodic_task' from oslo_service
Remove Manila code related to 'periodic_tasks' and reuse it from 'oslo_service'
library.

Also, add call of parent's '__init__' method for 'manila.db.base.Base' class.
It is required for proper work of multiple inheritance where this class is
inherited. And remove it from inheritance by 'manila.network.neutron.api.API'
class as redundant.

Change-Id: I138fc2f475f8858788a9ab00f84ab9ee167a95c5
2015-07-20 19:38:19 +03:00
Doug Hellmann bb69046db5 Drop use of 'oslo' namespace package
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: I75e6e15d50ef9830d0581efd4cbcceb3e626f7b7
2015-04-29 16:51:33 +03:00
Igor Malinovskiy f69664b1fd Add basic manage/unmanage share functionality
Manage share functionality adds possibility to add existing
shares to manila. On other hand unmanage functionality adds
possibility to remove shares from manila, but without physical
removal from share backend.

Due to high implementation complexity and risks it was
decided to implement  manage/unmanage methods only for
driver_manage_share_servers=False driver's and implement
this functionality for other cases in future. Also administrator
can't unmanage shares that were created with a share_server.

- Add manage() and unmanage() methods in admin API
- Add manage_share() and unmanage_share() methods to share rpcapi
and share manager
- Update share rpcapi version to 1.1
- Add manage_existing(), unmanage() methods
to share driver
- Add appropriate unit tests.

Partially implements bp manage-shares

Change-Id: Iedfd85cb6bdfade67c04f62c04756ac192db6b66
2015-03-13 11:02:17 +02: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
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
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
Andreas Jaeger 24cb089fee Fix some LOG.debug invocations
LOG.debug("Hello %s" % xyz) should be LOG.debug("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.

Change-Id: Ie0c91cd940017fd80d1d84b0e56780a1da980858
2014-09-16 08:04:09 +02:00
Andreas Jaeger baad6f7894 Further pep8 fixes
Fix the following issues in some files:
F401 'XXX' imported but unused
E123 closing bracket does not match indentation of opening bracket's
line
E126 continuation line over-indented for hanging indent
E128 continuation line under-indented for visual indent
E129 visually indented line with same indent as next logical line
H904  Wrap long lines in parentheses instead of a backslash

Partial-Bug: #1333290
Change-Id: Ic9b3a1e47fd24d2835f35f2ef71c4519908ff049
2014-08-15 15:41:56 +02:00
vponomaryov 85fee205ef Fix metaclasses assignment
'metaclass' with 'six' module should be added only using decorator for 'target'-class,
instead of attr assignment else 'target'-class won't see our custom metaclass.

this is fix after merged following commit:
8c1a574de3

Also added basic unittests.

Change-Id: I27cdddf32ec81c72a5f71ce8dca04f643a425b67
Closes-Bug: #1343207
2014-07-17 20:36:47 +03:00
Christian Berendt 8c1a574de3 Enable hacking check H236
* [H236] Use six.add_metaclass instead of __metaclass__

Change-Id: I4b943ff57be26c7ca0e7161114c2ef56a6a12df8
2014-07-16 19:12:04 +02:00
Valeriy Ponomaryov 8e5da48361 Migrate to oslo.messaging instead of commom/rpc
Manila uses oslo-incubator/rpc as an RPC library.
During Havana, oslo/rpc was cleaned up and moved into
oslo.messaging with a more stable and well-defined API.

oslo-incubator/rpc considered as deprecated and should be
replaced with oslo.messaging in Manila.

Sum changes:

* New dependency oslo.messaging>=1.3.0 is required

* The new rpc module has init() and cleanup() methods which manage the
global oslo.messaging transport state. The TRANSPORT and NOTIFIER
globals are conceptually similar to the current RPCIMPL global,
except we're free to create and use alternate Transport objects.

* The rpc.get_{client,server,notifier}() methods are just helpers
which wrap the global messaging state, specifiy serializers and
specify the use of the eventlet executor.

* In oslo.messaging, a request context is expected to be a dict, so
RequestContextSerializer was added which can serialize to and from
dicts using RequestContext.{to,from}_dict()

* The allowed_rpc_exception_modules configuration option is replaced
by an allowed_remote_exmods get_transport() parameter. This is not
something that users ever need to configure, but it is something
each project using oslo.messaging needs to be able to customize.

* We maintain a global NOTIFIER object and create specializations of
it with specific publisher IDs in order to avoid notification driver
loading overhead.

* rpc.py contains transport aliases for backwards compatibility
purposes. setup.cfg also contains notification driver aliases for
backwards compat.

* messaging.ConfFixture is used in tests to override oslo.messaging
config options, rather than making assumptions about the options
registered by the library.

Partially-implements bp oslo-messaging

Change-Id: I42cd582f3e1ff96c8f6e8957122b8e9176b1771d
2014-07-03 18:59:33 +03:00
Christian Berendt 79cd06323c debug level logs should not be translated
According to the OpenStack translation policy available at
https://wiki.openstack.org/wiki/LoggingStandards debug messages
should not be translated. Like mentioned in several changes in
Nova by garyk this is to help prioritize log translation.

Change-Id: Idd917acd97481d6b644e307adb002354b37f34a1
2014-05-13 14:13:53 +02:00
Andrei V. Ostapenko 3f24fee218 Removing deprecated using of flags module from project
Moving file flags.py to manila/common/config.py,
replacing FLAGS by CONF. Rename modules fake_flags to conf_fixture,
test_flags to test_conf, declare_flags to declare_conf,
runtime_flags to runtime_conf like it was done in cinder, nova, glance etc.

Implement bp: use-oslo-conf

Change-Id: I38d869123e5e706d3b06f1844b97ead05e22668f
2013-10-07 13:17:27 +03:00
Yulia Portnova dc4ce932ed Renamed cinder to manila.
Fixed setup.py, fixed bin scripts.
2013-09-02 09:59:07 +03:00