61 Commits

Author SHA1 Message Date
vponomaryov
e2b825cc69 Fix backwards compatibility for v1 API imports
All python modules in "manilaclient/v1" override v2 modules with v2 modules
and v1 modules do not provide APIs at all. So, fix those imports and add
test coverage.

Change-Id: I24835745d028fa50252207cb02304e73657696e5
Closes-Bug: #1535692
2016-01-19 14:41:08 +02:00
cFouts
c34e3b7d2c Nova Style API Version Support for Client
The Manila client needs the following changes to support microversions:

*   Maintain backwards compatibility with Kilo. When the client detects
    that the server doesn't support microversions it will fall back to
    using the v1 API.
*   The --os-share-api-version option supports overriding the version.
*   If 1.0 is specified as the version the client will load the v1
    client and use the server's v1 API.
*   The client will send a request for the server's API version and
    determine if the client's supported versions and the server's
    supported versions overlap. If not the client will display an error
    and quit. See diagram 1 below.
*   The client supports the @wraps annotation. The annotation is used
    with the v2/shell.py commands and any class that inherits from
    the Manager class in manilaclient/base.py.
*   If an appropriate command version isn't found for commands using
    @wraps then the client will display an error and quit.

following commit: ab49d645befd04c84272f0d24e1b604012d191dd.

Diagram 1:
  Client:
         2.5           2.8
          |-------------|

  Server1:
     2.0           2.5
      |-------------|
     Client uses version 2.5

  Server2:
               2.7           2.10
                |-------------|
               Client uses version 2.8

  Server3:
                  2.9           2.12
                   |-------------|
                  Client displays error and quits

  Server4:
     1.0 (Kilo Server)
      |-|
     Client detects pre-microversion server and loads v1 client

Example usage of wraps annotation:
*   Support 2.0 - 2.4: @api_versions.wraps("2.0", "2.4")
*   Support 2.5 - latest: @api_versions.wraps("2.5")

Implements: blueprint manila-client-advanced-microversion-support

Change-Id: I3733fe85424e39566addc070d42609e508259f19
2015-11-16 19:03:55 +00:00
nidhimittalhada
47b519106a Manila list shows one export location not multiple
"Export Locations" is a plural field. As discussed,
"list" operation should not show "export locations" anymore.
Hence, removed displaying of it in default mode of list operation.
Still, it can be displayed, if specified explicitly, with --columns,
wherein a string of comma separated column names can be given.

Change-Id: I4ae0cd3760088f1982301aa6f23a5c2d40be2455
Closes-Bug: #1438365
2015-11-13 23:17:36 +05:30
Valeriy Ponomaryov
74a0401a46 Add support for enable/disable service API
Manila has API to enable or disable its services for long time.
Since fork from Cinder. But manilaclient does not have support for it.
So, add it.

Change-Id: I797e2e4201ba5d2d85d397834aeb0bee5e4240f5
Closes-Bug: #1499247
2015-10-14 16:12:38 +03:00
Valeriy Ponomaryov
997cc43433 Add Keystone v3 API support
Keystone is used for authentication in Manila and the latter's
client does not support latest version of it that exists for long time.

So, add support of Keystone v3 API and make Manila client to use it
at first priority if it is available.

Change-Id: I3e2f505f46f7ab60c66bcb0b1d65a38bea602df4
Closes-Bug: #1499260
2015-10-13 21:12:55 +03:00
Jenkins
0a731dcafa Merge "Fix args parsing for quota-class-update" 2015-10-06 21:07:03 +00:00
Julia Varlamova
f0f2811b36 Fix args parsing for quota-class-update
Change 'class-name' argument to 'class_name' to avoid
AttributeError.

Add alias '--share_network' to command-line args.

Add argument 'snapshot_gigabytes' to 'update' function of
QuotaClassSetManager.

Closes-bug: #1498457

Change-Id: Ifbf1d8391c8b3cccaa0b20990133d4a68818d811
2015-09-25 05:23:41 -04:00
Jenkins
9d25b0353b Merge "Change Manilaclient to use --os-region-name param" 2015-09-22 12:45:59 +00:00
Julia Varlamova
0d257aedce Change Manilaclient to use --os-region-name param
Manilaclient ignores --os-region-param now. Change client from
'manilaclient/v1/client.py' to use first endpoint with a matching region.

Closes-bug: #1450613

Change-Id: I7fd76b0d874a91952513c40b4a7bdb0c45241dad
2015-09-22 06:36:38 -04:00
Valeriy Ponomaryov
0bbd2144f7 Fix shares CLI for using CGs
For the moment, share can not be neither created with CG nor deleted
if belongs to some CG.
So, add experimental header to 'share create' operation to fix
the former case and update 'delete share' operation to make it support
deletion of shares that belongs to CG in general.

Change-Id: I497a9ab845552fd7e0d66e7352d637c6a86082af
Closes-Bug: #1496518
Closes-Bug: #1497215
2015-09-18 15:11:39 +03:00
cFouts
556b5a65e9 Add consistency group support to manila client
Adds support for recently implemented Manila features:
    * consistency groups
    * consistency group snapshots

Enables the client to support newly available APIs which support create,
update, read, and delete operations for consistency groups and
consistency group snapshots.

Implements bp: manila-client-consistency-groups

Change-Id: Ia2760156ab289f127fd7411a7b9a13a371f5129c
2015-09-15 15:12:18 +00:00
Jenkins
66ef98d87f Merge "Allow user to unset security service params" 2015-09-10 21:55:09 +00:00
Jenkins
e5099ed223 Merge "Implement Share Instances Admin API" 2015-09-10 21:55:02 +00:00
Jenkins
aed9f8abde Merge "Add support of new extra spec 'snapshot_support'" 2015-09-09 18:58:31 +00:00
Jenkins
b97f30de6a Merge "Allow user to unset share network params" 2015-09-09 18:44:06 +00:00
Igor Malinovskiy
9f497727c5 Implement Share Instances Admin API
Add new CLI commands for share instances:
- share-instance-list
- share-instance-show
- share-instance-reset-state
- share-instance-force-delete

Add appropriate unit tests.

Change-Id: I3a44e89b8d8868d1a325dc91cbfb6a71d71f45d9
2015-09-08 14:33:13 +03:00
Jenkins
d84c4a1972 Merge "Add availability zones support" 2015-09-08 06:09:56 +00:00
Rodrigo Barbieri
e3e5eb6d7b Add Share Migration support to Manila Client
Added Share Migration CLI entry point to Manila Client,
use the following command:

"manila migrate <share> <host#pool> [--force-host-copy]"

The force-host-copy parameter forces Generic Migration approach,
bypassing driver optimization migration if present.

Please note that the above command is an admin only command.

Implements: blueprint share-migration-client
Change-Id: I00b51106b1736559b40d101d6d3609db84f8635d
Depends-On: I8dde892cb7c0180b2b56d8c7d680dfe2320c2ec7
2015-09-06 22:25:24 -03:00
cFouts
36384fa190 Manila REST API Microversion Support for Client
Manila client needs to provide 'X-Openstack-Manila-Api-Version' in the
HTTP request header along with the appropriate version. Manila client
also needs to provide 'X-OpenStack-Manila-API-Experimental' in the HTTP
request header for APIs that are marked as experimental. This is a
temporary fix until Manila client can support Nova style microversions.

Closes-bug: #1489450

Change-Id: I6344dfa6d272f0e813a4873c015be614ebeb4e7e
2015-09-01 21:01:18 +00:00
Valeriy Ponomaryov
ab49d645be Add support of new extra spec 'snapshot_support'
On last midcycle meetup was decided to make snapshots optional feature.
So, add following features:

- Allow to setup 'snapshot_support' extra spec in share type creation
  request. Make it optional key with default 'True' value.
- Display this extra spec with 'type list' command as part of 'optional'
  extra specs.

Change-Id: Id8e11b591a713654f7237cb1b66aeeaebfbf5871
Implements blueprint snapshots-optional
2015-08-27 15:39:30 +03:00
Julia Varlamova
4fcccf9e38 Allow user to unset security service params
It is impossible to unset some value from security service if it was set.
Allow user to set security service params (dns_ip, server, domain,
user, password, name, description) to empty value.

Closes-bug: #1446696

Change-Id: Ifea8f49b2007358565686f90a5d56476c4913c86
2015-08-27 04:13:38 -04:00
Julia Varlamova
d6ad3710b1 Allow user to unset share network params
It is impossible to unset some value from share network if it was set.
Allow user to set share network params (name, description, neutron_net_id,
neutron_subnet_id) to empty value.

Closes-bug: #1446695

Change-Id: I43315d49a3b721db9619812656702c1865155338
2015-08-26 06:53:24 -04:00
Dustin Schoenbrun
5f45b18f36 Make spec_driver_handles_share_servers required
This change makes the extra spec "spec_driver_handles_share_servers"
required for the type-create command in the Manila Client as opposed 
to being listed as an optional argument that was in fact required. I
had to remove a no longer valid test case in the unit test suite, 
but it was done because instead of throwing an exception, the 
argparser will just exit(2).

Change-Id: I0dc58cdfe10493a8eb736fa1bd0cd196bb0f5c05
Closes-Bug: #1484156
2015-08-12 17:20:01 +00:00
Igor Malinovskiy
43be586466 Add availability zones support
- Add --availability_zone argument for 'create' command
- Add 'Availability zone' column to 'list' command output
- Update appropriate unit tests

Depends-On: Iea9fbc3fea5c0128772115c028989121f397e0c5
Change-Id: I268c1125f138e0eab7f459428fde8e3d1d1e6cd1
2015-07-31 13:13:35 +03:00
Igor Malinovskiy
6b2121e0d9 Add share shrink API
Implement API method and shell command for shrinking
shares:
"manila shrink <share-id> <new-size>"

Change-Id: I46890171174541b5392cfbabee53ad044041ae68
2015-06-05 17:21:43 +03:00
Igor Malinovskiy
916ae8cb63 Add share extend API
Implement API method and shell command for extending
shares similar to Cinder:
"manila extend <share-id> <new-size>"

Change-Id: I1fadd514de4d9ae000cf0921262edd2bb111f5c5
2015-05-15 11:29:38 +03:00
Jenkins
8f48dd0511 Merge "Improve docstrings for share and snapshot API methods" 2015-04-08 15:46:37 +00:00
Igor Malinovskiy
ac314c05fe Validate required parameters for token-based authentication
Currently user can specify only 'input_auth_token' parameter
and get attribute error in the client. To fix this issue we should
validate that user provides both arguments: 'input_auth_token'
and 'service_catalog_url'.

Change-Id: Ie783f1d7e091138671c54be899ca84c6a28c9f9b
Closes-Bug: #1439683
2015-04-07 19:05:03 +03:00
Valeriy Ponomaryov
0ff4083f4f Improve docstrings for share and snapshot API methods
Modules 'manilaclient.v1.shares' and 'manilaclient.v1.share_snapshots' have
improper docstrings for various methods about expected parameters.
So, update them. Also make some improvements to handling of these parameters
that make various method consistent with each other about same parameters.
Add unit test coverage to updated methods.

Change-Id: I634de686f400b5df257c33e25c948ea509110e01
Closes-Bug: #1439690
2015-04-07 12:38:55 +03:00
Jenkins
476fa0244f Merge "Implement private share_types" 2015-03-20 15:24:40 +00:00
Jenkins
a123cca829 Merge "Make public shares visible for all tenants" 2015-03-20 03:52:03 +00:00
Igor Malinovskiy
13b0ce4c6e Implement private share_types
- Add ShareTypeAccessManager to client
- Add type-access-list, type-access-add, type-access-remove
shell commands
- Add additional parameters to type-add and type-list commands
- Add appropriate unit tests

Implementation details and unit tests were mostly adapted
from Cinder and Nova access extensions.

Change-Id: Iaef80b85d413d7e7bb27ebd5cccae6bea30cb446
2015-03-19 20:36:21 +02:00
Julia Varlamova
9dc072955f Make public shares visible for all tenants
Add new param '--public' to 'manila list' which would allow user
to list public shares from all projects along with shares for current project.

Rename 'manila rename' to 'manila update'. Add '--public' param to 'manila create'
and 'manila update'.

Add unit tests.

Implements bp level-of-visibility-for-shares

Change-Id: I69aafa32754f037f573b73e79d9cb6a6084d165e
2015-03-19 15:42:34 +03:00
Clinton Knight
74325af4b7 Add Manila client and CLI support for listing scheduler pools
The pools feature of Manila core added an API to list existing
pools, needed by a few admin-only features such as manage/unmanage.
But like Cinder, no CLI command was added to provide easy access
to the feature.  This is rectified in this patch with a pool-list
command and associated unit and functional tests.

Closes-Bug: #1422043
Change-Id: I4613feafa4ca79400a7419be488252b3324cc231
2015-03-18 13:00:29 +00:00
Jenkins
a366edb759 Merge "Remove workaround from type_create() shell command" 2015-03-17 18:46:15 +00:00
Igor Malinovskiy
9c65fbc490 Remove workaround from type_create() shell command
This workaround is not required any more, because
appropriate change already have merged to manila.

Change-Id: Ifdad13c047de07d85078fe86f8c9bc3f8d2130ec
2015-03-14 17:50:54 +02:00
Igor Malinovskiy
8a8b6fbf62 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 share from manila, but without physical
removal from share backend.

- Add manage() and unmanage() methods to share manager
- Add manage and unmanage shell commands
- Add appropriate unit tests.

Partially implements bp manage-shares

Change-Id: I7f8c4cbea6b699c468a8e85104cbe4111f796eb1
2015-03-14 17:38:30 +02:00
Jenkins
7c391ef8b5 Merge "Manila access-allow CLI command doesn't accept backslash" 2015-02-27 22:47:34 +00:00
Jenkins
c571d84573 Merge "Remove redundant call to API in ShareType.get_keys() method" 2015-02-27 21:21:37 +00:00
Clinton Knight
3490ba86e1 Manila access-allow CLI command doesn't accept backslash
The access-allow CLI command should accept backslash characters so
that one may enter a Windows domain user, such as MYDOMAIN\Administrator.
This must also be fixed in the server.

Change-Id: I55be8a54feac011a5e573b25c484ac5a6494d2a0
Closes-Bug: #1426100
2015-02-27 17:55:24 +00:00
Jenkins
2fb280bf69 Merge "Add support of snapshot gigabytes quotas" 2015-02-27 17:42:02 +00:00
Jenkins
717f4245f8 Merge "Make extra spec driver_handles_share_servers required" 2015-02-27 17:39:56 +00:00
Igor Malinovskiy
4787980c18 Make extra spec driver_handles_share_servers required
Currently, the driver_handles_share_servers is an optional extra_spec
on each share_type that allows the scheduler to filter. We want to
make this a required extra spec, so that every share type has this
value set to true or false. It's not be possible to remove that extra
spec. Modifying the extra spec is allowed as long as the value
remains either true or false.

- Add required argument "spec_driver_handles_share_servers" to
"type_create" command
- Add column "required_extra_specs" to columns printed by command
"type-list"
- Change title of column "extra_specs" to "all_extra_specs" in
"extra-specs-list" command
- Add appropriate unit tests

Partially implements bp share-type-require-driver-mode

Change-Id: I9bd3855e8a51159cf5ccc282bcbef688f7268e5e
2015-02-27 14:41:04 +02:00
Igor Malinovskiy
c2fa7205d8 Remove redundant call to API in ShareType.get_keys() method
In most cases ShareType resource already has all needed data,
that's why get_keys() do redundant calls to API.

Change-Id: I280c8919c29a19767d8bc0b5b9c1f217628b7357
2015-02-25 17:36:00 +02:00
Valeriy Ponomaryov
363a4d6917 Add support of snapshot gigabytes quotas
Manila is going to support separate gigabyte quota for snapshots. Need add
its support to client.

Change-Id: I6566c0f696fbe033cb036be5cda720f706fdc222
2015-02-25 17:09:20 +02:00
Valeriy Ponomaryov
1fba19926e Add support of nova network to share networks
Add support of nova network id to share network APIs 'create', 'update' and
'list'.

Change-Id: I361803afd76a2e4bd9b41b40a2c36c06909e852e
2015-02-25 14:52:29 +00:00
Igor Malinovskiy
58cc003661 Add keystone-session support
Currently python-manilaclient doesn't support keystone sessions
unlike to others clients. keystoneclient.session.Session gives
end-user possibility to share common authentication and request
parameters between a variety of services.

- Add python-keystoneclient to requirements.txt
- Move authentication logic to v1/client.py
- Move HttpClient to separate module
- Simplify SecretsHelper in shell.py
- Replace service_catalog module by keystoneclient.service_catalog
- Add appropriate unit tests

Implements bp add-keystone-session-support

Change-Id: I7d1c50fa31d9e2f32bb518a78a02bc12b114d0ab
2015-02-23 11:51:27 +02:00
Igor Malinovskiy
1b6a1370d5 Add is_default column to type-list command output
Add additional column "is_default" to output provided
by command "type-list".

Partially implements blueprint default-volume-type

Change-Id: Ia0a97a7a4999e239b6cee89502cfa3cc5d0b950a
2015-02-19 18:37:23 +02:00
Bob Callaway
f4ddf3626c Rename volume_type to share_type
This change renames support for volume_type to share_type.
The manila client will send data to Manila API using share_type, but
passes both share_type and volume_type values returned from API call to users
of the python binding; however, CLI output will only print the value of
share_type. This change ensures that --volume-type (and its other
permutations) are aliases of --share-type, thus providing backwards
compatibility for command line arguments of the shell.

Change-Id: Id40eea27c2c5b44e1d01c061a48e1658ba800f43
2015-02-18 19:14:05 +00:00
Julia Varlamova
5af1e5c8b9 Add support of arg "access_level" to allow_access operation
Add new option 'access_level' to manilaclient's access-allow function.
Manila API of share access should allow user to choose one of the following
access modes: 'ro' and 'rw'.

Add new field 'access_level' to result of 'access-list' function.

Fix unit tests and add new ones.

Implements bp level-of-access-for-shares

Change-Id: I96bf7a1b8a8fe9013d0c8b6e63d312a2134bd3e0
2015-01-22 13:42:57 +03:00