Commit Graph

38 Commits

Author SHA1 Message Date
Okeke Christian 23de7b4b0c Add delete CLI helper to ShareCommands
This patch adds a delete cli command to ShareCommands
The helper CLI command checks if service if up. If service
is down, it deletes the share instance

Closes-Bug: #1867030
Change-Id: I6a0575c1ed86213010e50fe1b7a733cdf7fa1736
2024-04-05 16:08:55 +01:00
Joshua Cornutt 5d48410d0a Fixing skipped default override for CORS options
Some of the cores middleware options should have overridden default
values but the override method was not actually called so the library
defaults are still used.

Closes-Bug: #2051691
Change-Id: I8dac03c787bf729c60c2e0ecc9c03b7ba9a5b5a5
2024-01-30 22:18:43 +09:00
Takashi Kajinami cc572226cd Fix python shebang
The current shebang requires /usr/bin/python which is not available in
Ubuntu Jammy by default.

Change-Id: Ice53cc822d9a103f28f991fc8b839097f822e2d1
2023-10-17 16:01:16 +00:00
Takashi Kajinami 0e44933fdc Remove placeholder from upgrade check
The placeholder was added when the upgrade check framework was
initially added, but it should have been removed when any real check
was added.

Change-Id: Ia3658b925ec9ad7a1f8938bbcc56dc595e427f8f
2023-02-16 19:04:39 +00:00
Felipe Rodrigues 2b57d15c64 Add multiple subnets per AZ support
Manila can now configure a share network with multiple subnets
in an availability zone. Also, it can add a new subnet for an
availability that has share servers, which will triger an update
share server allocations.

Changes:
- API:
  - Bump version to 2.70.
  - setup share network with multiple subents per az.
  - Block manage server with multiple subnets.
  - Allow add subnet for in-use share servers.
  - `share_network_subnet_id` is dropped from ShareServer view
  - `share_network_subnet_ids` is added in ShareServer view
  - `network_allocation_update_support` is added to ShareServer and
    ShareNetwork views.
  - Add a check operation for share network subnet create.

- DB:
  - Remove `share_network_subnet_id` from share_servers.
  - Create mapping table `share_server_share_network_subnet_mappings`.
  - Fix queries with new db design.
  - Add migration downgrade and upgrade alembic.
  - Add `share_network_subnet_id` to the NetworkAllocations.

- Scheduler:
  - Change `AvailabilityZoneFilter` to take in account if the
    host supports the allocation required by the setup request.

- Manager:
  - Bump RPC API version.
  - `_setup_server` allocating multiple subnets.
  - Modify signature of driver `_setup_server` interface, passing a
    list of `network_info` for each subnet.
  - Share server DB creation to inform a list of subnets and
    create with `network_allocation_update_support`.
  - Implement `check_update_share_server_network_allocations` and
    `update_share_server_network_allocations`.

- Drivers:
  - For legacy compatibility, all drivers implementing `_setup_server`
    consume the first element of the `network_ino`.
  - Dummy Driver:
    - Implement `_setup_server` with new signature as multiple subnet.
    - Modify the `backend_details` to save allocations for all subnets.
    - Report update allocation and share server multiple subnet support.
    - Implement `check_update_share_server_network_allocations` and
      `update_share_server_network_allocations` interfaces.

Signed-off-by: Felipe Rodrigues <felipefuty01@gmail.com>
Co-Authored-By: Andre Beltrami <debeltrami@gmail.com>
Co-Authored-By: Fábio Oliveira <fabioaurelio1269@gmail.com>
Co-Authored-By: Nahim Alves de Souza <nahimsouza@outlook.com>
Co-Authored-By: Caique Mello <caique_mellosbo@hotmail.com>

DocImpact
APIImpact
Partially-Implements: blueprint multiple-share-network-subnets

Change-Id: I7de9de4ae509182e9494bba604979cce03acceec
2022-03-03 02:31:11 +00:00
debeltrami 2bc27c5678 Add security service update for in-use share networks
This patch implements the update of security service's association
with in-use share networks. The following changes were added:

 - New share network APIs: `share_network_security_service_update`
 and `share_network_reset_state`.

 - A new `status` attribute was added to share network model to
 identify when it's in a modification state, called 'network_change'.
 Other supported status that were added: 'active' and 'error'.

 - New 'security_service_update_support' property was added to both
 share server and share network models, to identify when this resources
 are able to process security service update for in-use share networks.

 - New driver interface was added to support update of security service's
 configuration of a given share server.

DocImpact
APIImpact
Partially Implements: bp add-security-service-in-use-share-networks

Co-Authored-By: Carlos Eduardo <ces.eduardo98@gmail.com>
Co-Authored-By: Douglas Viroel <viroel@gmail.com>
Co-Authored-By: Andre Beltrami <debeltrami@gmail.com>

Change-Id: I129a794dfd2d179fa2b9a2fed050459d6f00b0de
2021-03-12 18:37:45 -03:00
Ghanshyam Mann 0cc7cbc36d [goal] Deprecate the JSON formatted policy file
As per the community goal of migrating the policy file
the format from JSON to YAML[1], we need to do two things:

1. Change the default value of '[oslo_policy] policy_file''
config option from 'policy.json' to 'policy.yaml' with
upgrade checks.

2. Deprecate the JSON formatted policy file on the project side
via warning in doc and releasenotes.

Also convert manila/tests/policy.json to manila/tests/policy.yaml
using oslopolicy-convert-json-to-yaml tool and replace
policy.json to policy.yaml ref from doc and tests.

[1]https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html

Change-Id: I3748313912b2527c43c9b16a6ba3e3ccd4cf5221
2020-12-13 00:05:00 +00:00
Goutham Pacha Ravi 370b15b6c6 Modify share groups w/ manila-manage's update-host
We can also condense this code a bit to allow
adding more resources who have a "host" attribute.

Closes-Bug: #1895323
Change-Id: I5b750217e019b7bc5281006f63feba8fa06db534
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2020-09-11 10:00:41 -07:00
Zuul 3b19c3ff25 Merge "add share server update to manila-manage share update_host" 2020-08-28 18:52:57 +00:00
Maurice Escher 365cfa3516
add share server update to manila-manage share update_host
Change-Id: Ifb19d926a84fae986b8d296959cfce71bf0c2e9e
Closes-Bug: #1881098
2020-07-15 11:37:30 +02:00
Maurice Escher c8a8494c78
add manila-manage service cleanup
Change-Id: I32307d5349c8ead5c0f7846f245d49f36dc3bf19
Closes-Bug: #1881112
2020-06-18 10:06:54 +02:00
Zuul a9ea4abf61 Merge "Monkey patch original current_thread _active" 2020-05-15 23:24:04 +00:00
Goutham Pacha Ravi 7e6a76067a TrivialFix: Remove unnecessary future imports
print_function is available from python 3.0.0
with_statement has been available from python 2.6

Change-Id: Idb6dd5bb4f9d57cf544e8e55d173e3c85c9da455
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2020-05-05 08:38:56 -07:00
Corey Bryant 5e9f694a5a Monkey patch original current_thread _active
Monkey patch the original current_thread to use the up-to-date _active
global variable. This solution is based on that documented at:
https://github.com/eventlet/eventlet/issues/592

Change-Id: Ifc6420d927c0ce9e04ff3b3253e81a474591e9bb
Closes-Bug: #1863021
2020-05-04 17:07:02 -04:00
Andreas Jaeger 8098045f2a Hacking: Fix E305
Fix:
E305 expected 2 blank lines after class or function definition, found 1

Fix also other problems found by hacking in these files.

Change-Id: I880afc40adf974cbb0e60f8dc5931f77d51f451b
2020-04-01 11:43:29 +02:00
Thomas Bechtold 0c177b902a Drop param2id() from cmd/manage.py
The function is not used anywhere.

Change-Id: I799e73992faa387e56a793d60cc599039d268f81
2019-01-03 14:10:01 +01:00
whoami-rajat e7ebfa1079 Remove i18n.enable_lazy() translation
Lazy translation of messages is not used in OpenStack [1].
This causes problems for commands which use translatable messages.
The lazy translation effort was abandoned several years ago.

[1] http://lists.openstack.org/pipermail/openstack-dev/2018-November/136289.html

Change-Id: I25a9ec0a96b7c57f8a6928c0537bf133f6b6931c
2018-11-14 14:09:08 +05:30
whoami-rajat 1f005beb58 Add manila-status upgrade check command framework
This adds basic framework for manila-status upgrade
check commands. For now it has only "check_placeholder"
check implemented.
Real checks can be added to this tool in the future.

Change-Id: Id809535d0a01617916a8e29f151ca4e61f738fad
Story: 2003657
Task: 26139
2018-10-19 12:53:03 +05:30
Goutham Pacha Ravi dbf97098e1 Add command to update share instance hosts
usage: manila-manage share update_host --currenthost CURRENTHOST
                                       --newhost NEWHOST
                                        [--force FORCE]
  --currenthost CURRENTHOST  Current share host name.
  --newhost NEWHOST     New share host name.
  --force FORCE         Ignore validations.

A fully qualified host string is of the format
'HostA@BackendB#PoolC'. The command allows making
substring modifications to update the host or the
host and backend. To avoid making gratuitous changes,
the complete host string must be specified.

Change-Id: I0f30ab6135c8c438860341cc68b512311e9c4711
2018-08-23 21:04:35 +00:00
Iswarya_Vakati 0d4438368f Don't attempt to escalate manila-manage privileges
Remove code which allowed manila-manage to attempt to escalate
privileges so that configuration files can be read by users who
normally wouldn't have access, but do have sudo access.

Change-Id: Ie3bf9a81ee8d723cd8618643fa9d7382462aae42
Closes-Bug:#1611171
2017-10-20 11:21:29 +00:00
Jan Provaznik c547604ed1 Add user messages periodic cleanup task
Adds a task to manila-scheduler service which periodically (once per day
by default) cleans up expired user messages. In user messages spec I
preferred doing this cleanup by a "manila-manage" command invoked by
user. But because it would mean another task management for admin and
because cinder uses periodic task too, I diverged from the spec.

Change-Id: If0ba2383d4d7eaca4dee8a0d39f39c5481bfbfdd
Partially-Implements: bp user-messages
2017-07-17 07:53:19 +02:00
luqitao 2a6d9fa832 Add support for Guru Meditation Reports for manila
Oslo_reports enables OpenStack projects to dump Guru Meditation
Reports with useful debugging information to files or stderr.
By default it will genarate report to stdout stream.
To configure GMR you have to add the following section
to manila.conf:

[oslo_reports]
log_dir = '/path/to/logs/dir'

Implements: blueprint guru-meditation-report

Change-Id: Ia730d56374764231e5ec88f0b71ff8e23361fa6a
2017-06-22 23:27:04 -04:00
Tom Barron 226c6fb0a3 Remove deprecated manila-all command
Change [1] deprecated this command in newton and
promised to remove it in ocata.

[1] I0ac0c699071324b218f63422354a871b7fa3b81e

Depends-On: I3aa1d145d21d587355af538a3569adf0b4ca715f

Change-Id: I589e6c0f2f44f3e5e54ee9d9368dfa2423dec1d3
2017-03-28 14:04:16 -04:00
Jenkins c8ee9fba72 Merge "Tooz integration" 2017-01-20 00:04:56 +00:00
Goutham Pacha Ravi 02ab18c5df Tooz integration
Manila currently uses file locks from oslo_concurrency to
coordinate operations racing with each other to perform a
particular action. In many situations, deployers may need a
distributed lock to a local file lock (or even a file lock living on
a shared file system). This need is accentuated if they were running
Manila services in HA or if they were using Share Replication across
AZs where manila-share services were running off different controllers
that would not be able to share a common oslo_concurrency
file lock or be protected against service/lock management failures.

Integrate Tooz library with helper methods to create a locking
coordinator and allow deployers to make the choice between file
and distributed locks.

Start the manila share service with Tooz backed coordination.

Replace the locks used for Share Replication work-flows in the
share manager to use Tooz based locks.

Co-Authored-By: Goutham Pacha Ravi <gouthampravi@gmail.com>
Co-Authored-By: Szymon Wroblewski <szymon.wroblewski@intel.com>
Co-Authored-By: Tom Barron <tpb@dyncloud.net>

Related-Bug: #1585241
Partially-implements: bp distributed-locking-with-tooz
Change-Id: I710e86bd42034fa3b93b87ff77fa48ada8661168
2017-01-19 14:29:31 -05:00
zhongjun beed2f210c Add manila-manage db purge command
Cloud admins delete lots of DB records manually that were
"soft-deleted" in Manila. They do it to reduce size of DB
and increase response speed. Therefore, add "manila-manage
db purge" command that will make cloud admins life easier
allowing them to purge such DB records in one click.

Examples of usage:
$ manila-manage db purge 5

Partially-implements: blueprint clean-deleted-row-in-db
Depends-on: 0ec71e29b2
Change-Id: I4fd83d44f4a1b6b7633a60249ba775f6d86d1cdc
2017-01-18 11:06:55 +08:00
Tom Barron 1c2ec9b8cf Detect addition of executable files
When running pep8 checks, fail if executable
files have accidentally been added.

Co-Authored-By: Eric Harney <eharney@redhat.com>

Closes-Bug: 1566328
Change-Id: I7280c0403cd473cd4b88cfc021d4f605a7bb35f2
2016-04-08 14:28:42 +00:00
Tom Barron 1807485976 Deprecate manila-all command
/usr/local/bin/manila-all purports to start all the manila
services within a single process.  We should deprecate this
command since to do this in production would be a very bad
idea - completely un-"cloudy" - and we don't even do it in
devstack.

Implements blueprint deprecate-manila-all

Change-Id: I0ac0c699071324b218f63422354a871b7fa3b81e
2016-04-07 13:54:07 -04:00
daiki kato ad6cdb6e10 Fix typos
This patch fixes several typos.

TrivialFix

Change-Id: I169e15a0fdfbbcbeb1f87e3022b01fbb9353df01
2016-03-23 15:55:35 +09:00
Tin Lam 75d85aab3c Moved CORS middleware configuration into oslo-config-generator
The default values needed for manila's implementation of cors
middleware have been moved from paste.ini into the configuration
hooks provided by oslo.config. Furthermore, these values have been
added to the default initialization procedure. This ensures
that if a value remains unset in the configuration file, it will
fallback to using sane defaults. It also ensures that an operator
modifying the configuration will be presented with that same
set of defaults.

Change-Id: Ie4adc39866a4ee6132eab6a111660218b3e6e5bd
Closes-Bug: #1551836
2016-03-03 16:13:20 +00:00
Rodrigo Barbieri eaaa86f1f4 Introduced Data Service
Added a new service defined as data, whose purpose is to
receive requests, process data operations such as copying,
migration, backup, and send back the response after operation
has been completed.

In this patch the service has no methods, it is empty, the
operation it should perform will be added in subsequent patches.

Implements: blueprint data-copy-service
Change-Id: I31365c8ac4197541af175c82f8f18a3d11740a99
2016-03-01 17:13:51 -03:00
ting.wang 2bc625399f Using dict.items() is better than six.iteritems(dict)
Replacing dict.iteritems()/.itervalues() with
six.iteritems(dict)/six.itervalues(dict) was preferred in the past,
but there was a discussion suggesting to avoid six for this[1].
The overhead of creating a temporary list on Python 2 is negligible.

[1]http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Partially-implements blueprint py3-compatibility

Change-Id: Ia2298733188b3d964d43a547504ede2ebeaba9bd
2016-01-19 22:22:48 +08:00
Valeriy Ponomaryov aa7c55ad07 Fix display of availability-zone for manila-manage command
Commands "manila-manage service list" and "manila-manage host list"
were displaying availability zone instance instead of its name.

Such bug appeared after implementation of Availability zone model.
So, fix it by providing 'name' field of availability zone model.

Change-Id: I14c3451380df01853183aed265344b1783c95939
Closes-Bug: #1499677
2015-10-01 09:44:53 +00:00
venkatamahesh 9b566a1471 Fix the typo "version"
In manila-manage.rst version is misspelled
it is corrected. In manage.py according to
help option I changed revision to version

Change-Id: Icc83b3dcfc31104a015c9e6929335daed5a8bb8b
Closes-Bug: #1487249
2015-09-02 23:15:21 +05:30
Valeriy Ponomaryov aea3edc229 Enable multi-process for API service
Due to the limit of Python interpreter, API service of Manila can't
really utilize underlying multi-core architecture even libraries
like eventlet has been used. To make API service much more scalable,
we'd adopt multi-process (worker) mode that has been used for long
in Glance/Swift/Nova/Cinder.

The default behavior isn't changed with this patch, Manila API
service will still run in one process (default value of
osapi_volume_workers is None).

Implementation wise, a good portion of manila/service.py has been
removed because those content has been merged in Oslo version of
service module.  manila/wsgi.py is also updated to adopt the change
for multiple WSGI servers running in separate processes.

DocImpact: 'New config option osapi_share_workers is used to specify
number of API service workers (OS processes) to launch for Manila
API service.  Setting this config option to a proper value (e.g.
osapi_share_workers = # of CPU cores/threads of the machine) can
greatly improve the total throughput of API service [# of API
requests can be handled per second].'

Also removed out-dated comments in manila/cmd/api.py due to the fact
that this bug [1] has been fixed in eventlet 0.9.13

This commit is port from two Cinder changes - [2] and [3].

[1] https://bitbucket.org/eventlet/eventlet/issue/92/eventletgreen-override-of-oswaitpid
[2] I8361d0dc0d43040e48634ff1aee1324e5e0af466
[3] Iab32a3fe230a11692a8cad274304214247d6c2c6
Implement bp: multi-process-api-service

Change-Id: I1cb98c938fd4e1dabe75c78a7ef392d6d7387dab
2015-07-23 10:22:24 +00:00
Valeriy Ponomaryov 94face22ea Sync oslo-incubator code
Sync common code from oslo-incubator. The main reason for it is removal
of usage 'log' module from incubator in manila codebase. Because we already
use another 'log' from library 'oslo_log'.

Head of oslo-incubator code that was used for 'sync' operation was at
following commit:

commit f5646edc61b9653d7ff71ed0177ed77811bbdcd0
Author: Elena Ezhova <eezhova@mirantis.com>
Date:   Tue Apr 7 17:46:16 2015 +0300

Additional changes:
- Added explicit registration of 'oslo_log.log' options to all manila scripts
- Module 'manila.openstack.common.log' removed as unused

Change-Id: I5b98d3863329227531fdb94ad7dbf5b3e5c51141
2015-04-22 11:20:25 +03:00
Julia Varlamova a4a60b1328 Use oslo_policy lib instead of oslo-incubator code
Code from manila/openstack/common/policy.py duplicates code
from oslo_policy, so we remove this module and use oslo_policy instead.

Implements bp use-oslo-policy-lib

Change-Id: I289221a1e96f6c705deef4070be113d69c57f6e0
2015-04-21 13:05:42 +03:00
Julia Varlamova b6ab3167dc Use entry_points for manila scripts
Manila scripts located in bin/* should be covered with unit tests.
In order to add unit tests for bin/* scripts:
- all
- api
- manage
- scheduler
- share
we move them into manila/cmd and use pbr to setup console scripts
which will call the respective main function of each script under manila/cmd.
It will allow us to import from manila.cmd and individually test each 'main' function.

Add unit tests for manila/cmd/* scripts.

Implements bp unit-tests-for-manila-scripts

Change-Id: I9be6b948a6de7ba76405411e98d7531cf225b57e
2015-04-14 21:04:01 +03:00