mass replace cinder to manila
This commit is contained in:
parent
2d2bedf6b0
commit
77dffa2c99
14
HACKING
14
HACKING
@ -1,4 +1,4 @@
|
|||||||
Cinder Style Commandments
|
Manila Style Commandments
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
Step 1: Read http://www.python.org/dev/peps/pep-0008/
|
Step 1: Read http://www.python.org/dev/peps/pep-0008/
|
||||||
@ -16,7 +16,7 @@ Imports
|
|||||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
{{stdlib imports in human alphabetical order}}
|
{{stdlib imports in human alphabetical order}}
|
||||||
\n
|
\n
|
||||||
{{cinder imports in human alphabetical order}}
|
{{manila imports in human alphabetical order}}
|
||||||
\n
|
\n
|
||||||
\n
|
\n
|
||||||
{{begin your code}}
|
{{begin your code}}
|
||||||
@ -42,11 +42,11 @@ Human Alphabetical Order Examples
|
|||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from cinder import flags
|
from manila import flags
|
||||||
from cinder import test
|
from manila import test
|
||||||
from cinder.auth import users
|
from manila.auth import users
|
||||||
from cinder.endpoint import api
|
from manila.endpoint import api
|
||||||
from cinder.endpoint import cloud
|
from manila.endpoint import cloud
|
||||||
|
|
||||||
Docstrings
|
Docstrings
|
||||||
----------
|
----------
|
||||||
|
26
README.rst
26
README.rst
@ -1,11 +1,11 @@
|
|||||||
Python bindings to the OpenStack Cinder API
|
Python bindings to the OpenStack Manila API
|
||||||
===========================================
|
===========================================
|
||||||
|
|
||||||
This is a client for the OpenStack Cinder API. There's a Python API (the
|
This is a client for the OpenStack Manila API. There's a Python API (the
|
||||||
``manilaclient`` module), and a command-line script (``cinder``). Each
|
``manilaclient`` module), and a command-line script (``manila``). Each
|
||||||
implements 100% of the OpenStack Cinder API.
|
implements 100% of the OpenStack Manila API.
|
||||||
|
|
||||||
See the `OpenStack CLI guide`_ for information on how to use the ``cinder``
|
See the `OpenStack CLI guide`_ for information on how to use the ``manila``
|
||||||
command-line tool. You may also want to look at the
|
command-line tool. You may also want to look at the
|
||||||
`OpenStack API documentation`_.
|
`OpenStack API documentation`_.
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ __ http://github.com/jacobian/python-cloudservers
|
|||||||
Command-line API
|
Command-line API
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
Installing this package gets you a shell command, ``cinder``, that you
|
Installing this package gets you a shell command, ``manila``, that you
|
||||||
can use to interact with any Rackspace compatible API (including OpenStack).
|
can use to interact with any Rackspace compatible API (including OpenStack).
|
||||||
|
|
||||||
You'll need to provide your OpenStack username and password. You can do this
|
You'll need to provide your OpenStack username and password. You can do this
|
||||||
@ -50,7 +50,7 @@ variables as well::
|
|||||||
export OS_AUTH_URL=http://example.com:8774/v1.1/
|
export OS_AUTH_URL=http://example.com:8774/v1.1/
|
||||||
export OS_VOLUME_API_VERSION=1
|
export OS_VOLUME_API_VERSION=1
|
||||||
|
|
||||||
If you are using Keystone, you need to set the CINDER_URL to the keystone
|
If you are using Keystone, you need to set the MANILA_URL to the keystone
|
||||||
endpoint::
|
endpoint::
|
||||||
|
|
||||||
export OS_AUTH_URL=http://example.com:5000/v2.0/
|
export OS_AUTH_URL=http://example.com:5000/v2.0/
|
||||||
@ -60,9 +60,9 @@ can specify the one you want with ``--os-region-name`` (or
|
|||||||
``export OS_REGION_NAME``). It defaults to the first in the list returned.
|
``export OS_REGION_NAME``). It defaults to the first in the list returned.
|
||||||
|
|
||||||
You'll find complete documentation on the shell by running
|
You'll find complete documentation on the shell by running
|
||||||
``cinder help``::
|
``manila help``::
|
||||||
|
|
||||||
usage: cinder [--debug] [--os-username <auth-user-name>]
|
usage: manila [--debug] [--os-username <auth-user-name>]
|
||||||
[--os-password <auth-password>]
|
[--os-password <auth-password>]
|
||||||
[--os-tenant-name <auth-tenant-name>] [--os-auth-url <auth-url>]
|
[--os-tenant-name <auth-tenant-name>] [--os-auth-url <auth-url>]
|
||||||
[--os-region-name <region-name>] [--service-type <service-type>]
|
[--os-region-name <region-name>] [--service-type <service-type>]
|
||||||
@ -73,7 +73,7 @@ You'll find complete documentation on the shell by running
|
|||||||
[--os-cacert <ca-certificate>] [--retries <retries>]
|
[--os-cacert <ca-certificate>] [--retries <retries>]
|
||||||
<subcommand> ...
|
<subcommand> ...
|
||||||
|
|
||||||
Command-line interface to the OpenStack Cinder API.
|
Command-line interface to the OpenStack Manila API.
|
||||||
|
|
||||||
Positional arguments:
|
Positional arguments:
|
||||||
<subcommand>
|
<subcommand>
|
||||||
@ -124,11 +124,11 @@ You'll find complete documentation on the shell by running
|
|||||||
--service-type <service-type>
|
--service-type <service-type>
|
||||||
Defaults to compute for most actions
|
Defaults to compute for most actions
|
||||||
--service-name <service-name>
|
--service-name <service-name>
|
||||||
Defaults to env[CINDER_SERVICE_NAME]
|
Defaults to env[MANILA_SERVICE_NAME]
|
||||||
--volume-service-name <volume-service-name>
|
--volume-service-name <volume-service-name>
|
||||||
Defaults to env[CINDER_VOLUME_SERVICE_NAME]
|
Defaults to env[MANILA_VOLUME_SERVICE_NAME]
|
||||||
--endpoint-type <endpoint-type>
|
--endpoint-type <endpoint-type>
|
||||||
Defaults to env[CINDER_ENDPOINT_TYPE] or publicURL.
|
Defaults to env[MANILA_ENDPOINT_TYPE] or publicURL.
|
||||||
--os-volume-api-version <compute-api-ver>
|
--os-volume-api-version <compute-api-ver>
|
||||||
Accepts 1,defaults to env[OS_VOLUME_API_VERSION].
|
Accepts 1,defaults to env[OS_VOLUME_API_VERSION].
|
||||||
--os-cacert <ca-certificate>
|
--os-cacert <ca-certificate>
|
||||||
|
@ -3,13 +3,13 @@ Python API
|
|||||||
In order to use the python api directly, you must first obtain an auth token and identify which endpoint you wish to speak to. Once you have done so, you can use the API like so::
|
In order to use the python api directly, you must first obtain an auth token and identify which endpoint you wish to speak to. Once you have done so, you can use the API like so::
|
||||||
|
|
||||||
>>> from manilaclient import client
|
>>> from manilaclient import client
|
||||||
>>> cinder = client.Client('1', $OS_USER_NAME, $OS_PASSWORD, $OS_TENANT_NAME, $OS_AUTH_URL)
|
>>> manila = client.Client('1', $OS_USER_NAME, $OS_PASSWORD, $OS_TENANT_NAME, $OS_AUTH_URL)
|
||||||
>>> cinder.volumes.list()
|
>>> manila.volumes.list()
|
||||||
[]
|
[]
|
||||||
>>> myvol = cinder.volumes.create(display_name="test-vol", size=1)
|
>>> myvol = manila.volumes.create(display_name="test-vol", size=1)
|
||||||
>>> myvol.id
|
>>> myvol.id
|
||||||
ce06d0a8-5c1b-4e2c-81d2-39eca6bbfb70
|
ce06d0a8-5c1b-4e2c-81d2-39eca6bbfb70
|
||||||
>>> cinder.volumes.list()
|
>>> manila.volumes.list()
|
||||||
[<Volume: ce06d0a8-5c1b-4e2c-81d2-39eca6bbfb70>]
|
[<Volume: ce06d0a8-5c1b-4e2c-81d2-39eca6bbfb70>]
|
||||||
>>>myvol.delete
|
>>>myvol.delete
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ In order to use the CLI, you must provide your OpenStack username, password, ten
|
|||||||
export OS_TENANT_ID=b363706f891f48019483f8bd6503c54b
|
export OS_TENANT_ID=b363706f891f48019483f8bd6503c54b
|
||||||
export OS_AUTH_URL=http://auth.example.com:5000/v2.0
|
export OS_AUTH_URL=http://auth.example.com:5000/v2.0
|
||||||
|
|
||||||
Once you've configured your authentication parameters, you can run ``cinder help`` to see a complete listing of available commands.
|
Once you've configured your authentication parameters, you can run ``manila help`` to see a complete listing of available commands.
|
||||||
|
|
||||||
|
|
||||||
Release Notes
|
Release Notes
|
||||||
@ -39,7 +39,7 @@ Release Notes
|
|||||||
1.0.3
|
1.0.3
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* Added support for V2 Cinder API
|
* Added support for V2 Manila API
|
||||||
* Corected upload-volume-to-image help messaging
|
* Corected upload-volume-to-image help messaging
|
||||||
* Align handling of metadata args for all methods
|
* Align handling of metadata args for all methods
|
||||||
* Update OSLO version
|
* Update OSLO version
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
The :program:`cinder` shell utility
|
The :program:`manila` shell utility
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
.. program:: cinder
|
.. program:: manila
|
||||||
.. highlight:: bash
|
.. highlight:: bash
|
||||||
|
|
||||||
The :program:`cinder` shell utility interacts with the OpenStack Cinder API
|
The :program:`manila` shell utility interacts with the OpenStack Manila API
|
||||||
from the command line. It supports the entirety of the OpenStack Cinder API.
|
from the command line. It supports the entirety of the OpenStack Manila API.
|
||||||
|
|
||||||
You'll need to provide :program:`cinder` with your OpenStack username and
|
You'll need to provide :program:`manila` with your OpenStack username and
|
||||||
API key. You can do this with the :option:`--os-username`, :option:`--os-password`
|
API key. You can do this with the :option:`--os-username`, :option:`--os-password`
|
||||||
and :option:`--os-tenant-name` options, but it's easier to just set them as
|
and :option:`--os-tenant-name` options, but it's easier to just set them as
|
||||||
environment variables by setting two environment variables:
|
environment variables by setting two environment variables:
|
||||||
|
|
||||||
.. envvar:: OS_USERNAME or CINDER_USERNAME
|
.. envvar:: OS_USERNAME or MANILA_USERNAME
|
||||||
|
|
||||||
Your OpenStack Cinder username.
|
Your OpenStack Manila username.
|
||||||
|
|
||||||
.. envvar:: OS_PASSWORD or CINDER_PASSWORD
|
.. envvar:: OS_PASSWORD or MANILA_PASSWORD
|
||||||
|
|
||||||
Your password.
|
Your password.
|
||||||
|
|
||||||
.. envvar:: OS_TENANT_NAME or CINDER_PROJECT_ID
|
.. envvar:: OS_TENANT_NAME or MANILA_PROJECT_ID
|
||||||
|
|
||||||
Project for work.
|
Project for work.
|
||||||
|
|
||||||
.. envvar:: OS_AUTH_URL or CINDER_URL
|
.. envvar:: OS_AUTH_URL or MANILA_URL
|
||||||
|
|
||||||
The OpenStack API server URL.
|
The OpenStack API server URL.
|
||||||
|
|
||||||
@ -42,8 +42,8 @@ For example, in Bash you'd use::
|
|||||||
|
|
||||||
From there, all shell commands take the form::
|
From there, all shell commands take the form::
|
||||||
|
|
||||||
cinder <command> [arguments...]
|
manila <command> [arguments...]
|
||||||
|
|
||||||
Run :program:`cinder help` to get a full list of all possible commands,
|
Run :program:`manila help` to get a full list of all possible commands,
|
||||||
and run :program:`cinder help <command>` to get detailed help for that
|
and run :program:`manila help <command>` to get detailed help for that
|
||||||
command.
|
command.
|
||||||
|
@ -97,8 +97,8 @@ class Manager(utils.HookableMixin):
|
|||||||
|
|
||||||
# NOTE(sirp): Keep separate UUID caches for each username + endpoint
|
# NOTE(sirp): Keep separate UUID caches for each username + endpoint
|
||||||
# pair
|
# pair
|
||||||
username = utils.env('OS_USERNAME', 'CINDER_USERNAME')
|
username = utils.env('OS_USERNAME', 'MANILA_USERNAME')
|
||||||
url = utils.env('OS_URL', 'CINDER_URL')
|
url = utils.env('OS_URL', 'MANILA_URL')
|
||||||
uniqifier = hashlib.md5(username + url).hexdigest()
|
uniqifier = hashlib.md5(username + url).hexdigest()
|
||||||
|
|
||||||
cache_dir = os.path.expanduser(os.path.join(base_dir, uniqifier))
|
cache_dir = os.path.expanduser(os.path.join(base_dir, uniqifier))
|
||||||
|
@ -272,7 +272,7 @@ class HTTPClient(object):
|
|||||||
auth_url = self.auth_url
|
auth_url = self.auth_url
|
||||||
if self.version == "v2.0":
|
if self.version == "v2.0":
|
||||||
while auth_url:
|
while auth_url:
|
||||||
if "CINDER_RAX_AUTH" in os.environ:
|
if "MANILA_RAX_AUTH" in os.environ:
|
||||||
auth_url = self._rax_auth(auth_url)
|
auth_url = self._rax_auth(auth_url)
|
||||||
else:
|
else:
|
||||||
auth_url = self._v2_auth(auth_url)
|
auth_url = self._v2_auth(auth_url)
|
||||||
@ -290,7 +290,7 @@ class HTTPClient(object):
|
|||||||
try:
|
try:
|
||||||
while auth_url:
|
while auth_url:
|
||||||
auth_url = self._v1_auth(auth_url)
|
auth_url = self._v1_auth(auth_url)
|
||||||
# In some configurations cinder makes redirection to
|
# In some configurations manila makes redirection to
|
||||||
# v2.0 keystone endpoint. Also, new location does not contain
|
# v2.0 keystone endpoint. Also, new location does not contain
|
||||||
# real endpoint, only hostname and port.
|
# real endpoint, only hostname and port.
|
||||||
except exceptions.AuthorizationFailure:
|
except exceptions.AuthorizationFailure:
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Command-line interface to the OpenStack Cinder API.
|
Command-line interface to the OpenStack Manila API.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@ -64,13 +64,13 @@ class manilaclientArgumentParser(argparse.ArgumentParser):
|
|||||||
'subp': progparts[2]})
|
'subp': progparts[2]})
|
||||||
|
|
||||||
|
|
||||||
class OpenStackCinderShell(object):
|
class OpenStackManilaShell(object):
|
||||||
|
|
||||||
def get_base_parser(self):
|
def get_base_parser(self):
|
||||||
parser = manilaclientArgumentParser(
|
parser = manilaclientArgumentParser(
|
||||||
prog='cinder',
|
prog='manila',
|
||||||
description=__doc__.strip(),
|
description=__doc__.strip(),
|
||||||
epilog='See "cinder help COMMAND" '
|
epilog='See "manila help COMMAND" '
|
||||||
'for help on a specific command.',
|
'for help on a specific command.',
|
||||||
add_help=False,
|
add_help=False,
|
||||||
formatter_class=OpenStackHelpFormatter,
|
formatter_class=OpenStackHelpFormatter,
|
||||||
@ -94,7 +94,7 @@ class OpenStackCinderShell(object):
|
|||||||
parser.add_argument('--os-username',
|
parser.add_argument('--os-username',
|
||||||
metavar='<auth-user-name>',
|
metavar='<auth-user-name>',
|
||||||
default=utils.env('OS_USERNAME',
|
default=utils.env('OS_USERNAME',
|
||||||
'CINDER_USERNAME'),
|
'MANILA_USERNAME'),
|
||||||
help='Defaults to env[OS_USERNAME].')
|
help='Defaults to env[OS_USERNAME].')
|
||||||
parser.add_argument('--os_username',
|
parser.add_argument('--os_username',
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
@ -102,7 +102,7 @@ class OpenStackCinderShell(object):
|
|||||||
parser.add_argument('--os-password',
|
parser.add_argument('--os-password',
|
||||||
metavar='<auth-password>',
|
metavar='<auth-password>',
|
||||||
default=utils.env('OS_PASSWORD',
|
default=utils.env('OS_PASSWORD',
|
||||||
'CINDER_PASSWORD'),
|
'MANILA_PASSWORD'),
|
||||||
help='Defaults to env[OS_PASSWORD].')
|
help='Defaults to env[OS_PASSWORD].')
|
||||||
parser.add_argument('--os_password',
|
parser.add_argument('--os_password',
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
@ -110,7 +110,7 @@ class OpenStackCinderShell(object):
|
|||||||
parser.add_argument('--os-tenant-name',
|
parser.add_argument('--os-tenant-name',
|
||||||
metavar='<auth-tenant-name>',
|
metavar='<auth-tenant-name>',
|
||||||
default=utils.env('OS_TENANT_NAME',
|
default=utils.env('OS_TENANT_NAME',
|
||||||
'CINDER_PROJECT_ID'),
|
'MANILA_PROJECT_ID'),
|
||||||
help='Defaults to env[OS_TENANT_NAME].')
|
help='Defaults to env[OS_TENANT_NAME].')
|
||||||
parser.add_argument('--os_tenant_name',
|
parser.add_argument('--os_tenant_name',
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
@ -118,7 +118,7 @@ class OpenStackCinderShell(object):
|
|||||||
parser.add_argument('--os-tenant-id',
|
parser.add_argument('--os-tenant-id',
|
||||||
metavar='<auth-tenant-id>',
|
metavar='<auth-tenant-id>',
|
||||||
default=utils.env('OS_TENANT_ID',
|
default=utils.env('OS_TENANT_ID',
|
||||||
'CINDER_TENANT_ID'),
|
'MANILA_TENANT_ID'),
|
||||||
help='Defaults to env[OS_TENANT_ID].')
|
help='Defaults to env[OS_TENANT_ID].')
|
||||||
parser.add_argument('--os_tenant_id',
|
parser.add_argument('--os_tenant_id',
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
@ -126,7 +126,7 @@ class OpenStackCinderShell(object):
|
|||||||
parser.add_argument('--os-auth-url',
|
parser.add_argument('--os-auth-url',
|
||||||
metavar='<auth-url>',
|
metavar='<auth-url>',
|
||||||
default=utils.env('OS_AUTH_URL',
|
default=utils.env('OS_AUTH_URL',
|
||||||
'CINDER_URL'),
|
'MANILA_URL'),
|
||||||
help='Defaults to env[OS_AUTH_URL].')
|
help='Defaults to env[OS_AUTH_URL].')
|
||||||
parser.add_argument('--os_auth_url',
|
parser.add_argument('--os_auth_url',
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
@ -134,7 +134,7 @@ class OpenStackCinderShell(object):
|
|||||||
parser.add_argument('--os-region-name',
|
parser.add_argument('--os-region-name',
|
||||||
metavar='<region-name>',
|
metavar='<region-name>',
|
||||||
default=utils.env('OS_REGION_NAME',
|
default=utils.env('OS_REGION_NAME',
|
||||||
'CINDER_REGION_NAME'),
|
'MANILA_REGION_NAME'),
|
||||||
help='Defaults to env[OS_REGION_NAME].')
|
help='Defaults to env[OS_REGION_NAME].')
|
||||||
parser.add_argument('--os_region_name',
|
parser.add_argument('--os_region_name',
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
@ -147,23 +147,23 @@ class OpenStackCinderShell(object):
|
|||||||
|
|
||||||
parser.add_argument('--service-name',
|
parser.add_argument('--service-name',
|
||||||
metavar='<service-name>',
|
metavar='<service-name>',
|
||||||
default=utils.env('CINDER_SERVICE_NAME'),
|
default=utils.env('MANILA_SERVICE_NAME'),
|
||||||
help='Defaults to env[CINDER_SERVICE_NAME]')
|
help='Defaults to env[MANILA_SERVICE_NAME]')
|
||||||
parser.add_argument('--service_name',
|
parser.add_argument('--service_name',
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
|
|
||||||
parser.add_argument('--volume-service-name',
|
parser.add_argument('--volume-service-name',
|
||||||
metavar='<volume-service-name>',
|
metavar='<volume-service-name>',
|
||||||
default=utils.env('CINDER_VOLUME_SERVICE_NAME'),
|
default=utils.env('MANILA_VOLUME_SERVICE_NAME'),
|
||||||
help='Defaults to env[CINDER_VOLUME_SERVICE_NAME]')
|
help='Defaults to env[MANILA_VOLUME_SERVICE_NAME]')
|
||||||
parser.add_argument('--volume_service_name',
|
parser.add_argument('--volume_service_name',
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
|
|
||||||
parser.add_argument('--endpoint-type',
|
parser.add_argument('--endpoint-type',
|
||||||
metavar='<endpoint-type>',
|
metavar='<endpoint-type>',
|
||||||
default=utils.env('CINDER_ENDPOINT_TYPE',
|
default=utils.env('MANILA_ENDPOINT_TYPE',
|
||||||
default=DEFAULT_MANILA_ENDPOINT_TYPE),
|
default=DEFAULT_MANILA_ENDPOINT_TYPE),
|
||||||
help='Defaults to env[CINDER_ENDPOINT_TYPE] or '
|
help='Defaults to env[MANILA_ENDPOINT_TYPE] or '
|
||||||
+ DEFAULT_MANILA_ENDPOINT_TYPE + '.')
|
+ DEFAULT_MANILA_ENDPOINT_TYPE + '.')
|
||||||
parser.add_argument('--endpoint_type',
|
parser.add_argument('--endpoint_type',
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
@ -209,17 +209,17 @@ class OpenStackCinderShell(object):
|
|||||||
|
|
||||||
# alias for --os-password, left in for backwards compatibility
|
# alias for --os-password, left in for backwards compatibility
|
||||||
parser.add_argument('--apikey', '--password', dest='apikey',
|
parser.add_argument('--apikey', '--password', dest='apikey',
|
||||||
default=utils.env('CINDER_API_KEY'),
|
default=utils.env('MANILA_API_KEY'),
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
|
|
||||||
# alias for --os-tenant-name, left in for backward compatibility
|
# alias for --os-tenant-name, left in for backward compatibility
|
||||||
parser.add_argument('--projectid', '--tenant_name', dest='projectid',
|
parser.add_argument('--projectid', '--tenant_name', dest='projectid',
|
||||||
default=utils.env('CINDER_PROJECT_ID'),
|
default=utils.env('MANILA_PROJECT_ID'),
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
|
|
||||||
# alias for --os-auth-url, left in for backward compatibility
|
# alias for --os-auth-url, left in for backward compatibility
|
||||||
parser.add_argument('--url', '--auth_url', dest='url',
|
parser.add_argument('--url', '--auth_url', dest='url',
|
||||||
default=utils.env('CINDER_URL'),
|
default=utils.env('MANILA_URL'),
|
||||||
help=argparse.SUPPRESS)
|
help=argparse.SUPPRESS)
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
@ -444,7 +444,7 @@ class OpenStackCinderShell(object):
|
|||||||
if not utils.isunauthenticated(args.func):
|
if not utils.isunauthenticated(args.func):
|
||||||
self.cs.authenticate()
|
self.cs.authenticate()
|
||||||
except exc.Unauthorized:
|
except exc.Unauthorized:
|
||||||
raise exc.CommandError("Invalid OpenStack Cinder credentials.")
|
raise exc.CommandError("Invalid OpenStack Manila credentials.")
|
||||||
except exc.AuthorizationFailure:
|
except exc.AuthorizationFailure:
|
||||||
raise exc.CommandError("Unable to authorize user")
|
raise exc.CommandError("Unable to authorize user")
|
||||||
|
|
||||||
@ -459,7 +459,7 @@ class OpenStackCinderShell(object):
|
|||||||
"""Print arguments for bash_completion.
|
"""Print arguments for bash_completion.
|
||||||
|
|
||||||
Prints all of the commands and options to stdout so that the
|
Prints all of the commands and options to stdout so that the
|
||||||
cinder.bash_completion script doesn't have to hard code them.
|
manila.bash_completion script doesn't have to hard code them.
|
||||||
"""
|
"""
|
||||||
commands = set()
|
commands = set()
|
||||||
options = set()
|
options = set()
|
||||||
@ -498,9 +498,9 @@ class OpenStackHelpFormatter(argparse.HelpFormatter):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
OpenStackCinderShell().main(map(strutils.safe_decode, sys.argv[1:]))
|
OpenStackManilaShell().main(map(strutils.safe_decode, sys.argv[1:]))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print >> sys.stderr, "... terminating cinder client"
|
print >> sys.stderr, "... terminating manila client"
|
||||||
sys.exit(130)
|
sys.exit(130)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.debug(e, exc_info=1)
|
logger.debug(e, exc_info=1)
|
||||||
|
2
setup.py
2
setup.py
@ -33,7 +33,7 @@ setuptools.setup(
|
|||||||
version=setup.get_version(project),
|
version=setup.get_version(project),
|
||||||
author="OpenStack Contributors",
|
author="OpenStack Contributors",
|
||||||
author_email="openstack-dev@lists.openstack.org",
|
author_email="openstack-dev@lists.openstack.org",
|
||||||
description="Client library for OpenStack Cinder API.",
|
description="Client library for OpenStack Manila API.",
|
||||||
long_description=read_file("README.rst"),
|
long_description=read_file("README.rst"),
|
||||||
license="Apache License, Version 2.0",
|
license="Apache License, Version 2.0",
|
||||||
url="https://github.com/openstack/python-manilaclient",
|
url="https://github.com/openstack/python-manilaclient",
|
||||||
|
@ -31,7 +31,7 @@ class ShellTest(utils.TestCase):
|
|||||||
orig = sys.stdout
|
orig = sys.stdout
|
||||||
try:
|
try:
|
||||||
sys.stdout = cStringIO.StringIO()
|
sys.stdout = cStringIO.StringIO()
|
||||||
_shell = manilaclient.shell.OpenStackCinderShell()
|
_shell = manilaclient.shell.OpenStackManilaShell()
|
||||||
_shell.main(argstr.split())
|
_shell.main(argstr.split())
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||||
@ -50,7 +50,7 @@ class ShellTest(utils.TestCase):
|
|||||||
required = [
|
required = [
|
||||||
'.*?^usage: ',
|
'.*?^usage: ',
|
||||||
'.*?(?m)^\s+create\s+Add a new volume.',
|
'.*?(?m)^\s+create\s+Add a new volume.',
|
||||||
'.*?(?m)^See "cinder help COMMAND" for help on a specific command',
|
'.*?(?m)^See "manila help COMMAND" for help on a specific command',
|
||||||
]
|
]
|
||||||
help_text = self.shell('help')
|
help_text = self.shell('help')
|
||||||
for r in required:
|
for r in required:
|
||||||
@ -59,7 +59,7 @@ class ShellTest(utils.TestCase):
|
|||||||
|
|
||||||
def test_help_on_subcommand(self):
|
def test_help_on_subcommand(self):
|
||||||
required = [
|
required = [
|
||||||
'.*?^usage: cinder list',
|
'.*?^usage: manila list',
|
||||||
'.*?(?m)^List all the volumes.',
|
'.*?(?m)^List all the volumes.',
|
||||||
]
|
]
|
||||||
help_text = self.shell('help list')
|
help_text = self.shell('help list')
|
||||||
|
@ -28,7 +28,7 @@ def _stub_volume(**kwargs):
|
|||||||
'display_description': None,
|
'display_description': None,
|
||||||
"attachments": [],
|
"attachments": [],
|
||||||
"bootable": "false",
|
"bootable": "false",
|
||||||
"availability_zone": "cinder",
|
"availability_zone": "manila",
|
||||||
"created_at": "2012-08-27T00:00:00.000000",
|
"created_at": "2012-08-27T00:00:00.000000",
|
||||||
"display_description": None,
|
"display_description": None,
|
||||||
"display_name": None,
|
"display_name": None,
|
||||||
|
@ -195,7 +195,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
|||||||
{"headers": {'location':'http://127.0.0.1:5001'},
|
{"headers": {'location':'http://127.0.0.1:5001'},
|
||||||
"status_code": 305,
|
"status_code": 305,
|
||||||
"text": "Use proxy"},
|
"text": "Use proxy"},
|
||||||
# Configured on admin port, cinder redirects to v2.0 port.
|
# Configured on admin port, manila redirects to v2.0 port.
|
||||||
# When trying to connect on it, keystone auth succeed by v1.0
|
# When trying to connect on it, keystone auth succeed by v1.0
|
||||||
# protocol (through headers) but tokens are being returned in
|
# protocol (through headers) but tokens are being returned in
|
||||||
# body (looks like keystone bug). Leaved for compatibility.
|
# body (looks like keystone bug). Leaved for compatibility.
|
||||||
|
@ -29,11 +29,11 @@ from tests import utils
|
|||||||
class ShellTest(utils.TestCase):
|
class ShellTest(utils.TestCase):
|
||||||
|
|
||||||
FAKE_ENV = {
|
FAKE_ENV = {
|
||||||
'CINDER_USERNAME': 'username',
|
'MANILA_USERNAME': 'username',
|
||||||
'CINDER_PASSWORD': 'password',
|
'MANILA_PASSWORD': 'password',
|
||||||
'CINDER_PROJECT_ID': 'project_id',
|
'MANILA_PROJECT_ID': 'project_id',
|
||||||
'OS_VOLUME_API_VERSION': '1.1',
|
'OS_VOLUME_API_VERSION': '1.1',
|
||||||
'CINDER_URL': 'http://no.where',
|
'MANILA_URL': 'http://no.where',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Patch os.environ to avoid required auth info.
|
# Patch os.environ to avoid required auth info.
|
||||||
@ -44,7 +44,7 @@ class ShellTest(utils.TestCase):
|
|||||||
self.useFixture(fixtures.EnvironmentVariable(var,
|
self.useFixture(fixtures.EnvironmentVariable(var,
|
||||||
self.FAKE_ENV[var]))
|
self.FAKE_ENV[var]))
|
||||||
|
|
||||||
self.shell = shell.OpenStackCinderShell()
|
self.shell = shell.OpenStackManilaShell()
|
||||||
|
|
||||||
#HACK(bcwaldon): replace this when we start using stubs
|
#HACK(bcwaldon): replace this when we start using stubs
|
||||||
self.old_get_client_class = client.get_client_class
|
self.old_get_client_class = client.get_client_class
|
||||||
|
@ -27,7 +27,7 @@ def _stub_volume(**kwargs):
|
|||||||
'description': None,
|
'description': None,
|
||||||
"attachments": [],
|
"attachments": [],
|
||||||
"bootable": "false",
|
"bootable": "false",
|
||||||
"availability_zone": "cinder",
|
"availability_zone": "manila",
|
||||||
"created_at": "2012-08-27T00:00:00.000000",
|
"created_at": "2012-08-27T00:00:00.000000",
|
||||||
"id": '00000000-0000-0000-0000-000000000000',
|
"id": '00000000-0000-0000-0000-000000000000',
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
|
@ -211,7 +211,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
|||||||
{"headers": {'location':'http://127.0.0.1:5001'},
|
{"headers": {'location':'http://127.0.0.1:5001'},
|
||||||
"status_code": 305,
|
"status_code": 305,
|
||||||
"text": "Use proxy"},
|
"text": "Use proxy"},
|
||||||
# Configured on admin port, cinder redirects to v2.0 port.
|
# Configured on admin port, manila redirects to v2.0 port.
|
||||||
# When trying to connect on it, keystone auth succeed by v1.0
|
# When trying to connect on it, keystone auth succeed by v1.0
|
||||||
# protocol (through headers) but tokens are being returned in
|
# protocol (through headers) but tokens are being returned in
|
||||||
# body (looks like keystone bug). Leaved for compatibility.
|
# body (looks like keystone bug). Leaved for compatibility.
|
||||||
|
@ -24,11 +24,11 @@ from tests.v2 import fakes
|
|||||||
class ShellTest(utils.TestCase):
|
class ShellTest(utils.TestCase):
|
||||||
|
|
||||||
FAKE_ENV = {
|
FAKE_ENV = {
|
||||||
'CINDER_USERNAME': 'username',
|
'MANILA_USERNAME': 'username',
|
||||||
'CINDER_PASSWORD': 'password',
|
'MANILA_PASSWORD': 'password',
|
||||||
'CINDER_PROJECT_ID': 'project_id',
|
'MANILA_PROJECT_ID': 'project_id',
|
||||||
'OS_VOLUME_API_VERSION': '2',
|
'OS_VOLUME_API_VERSION': '2',
|
||||||
'CINDER_URL': 'http://no.where',
|
'MANILA_URL': 'http://no.where',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Patch os.environ to avoid required auth info.
|
# Patch os.environ to avoid required auth info.
|
||||||
@ -39,7 +39,7 @@ class ShellTest(utils.TestCase):
|
|||||||
self.useFixture(fixtures.EnvironmentVariable(var,
|
self.useFixture(fixtures.EnvironmentVariable(var,
|
||||||
self.FAKE_ENV[var]))
|
self.FAKE_ENV[var]))
|
||||||
|
|
||||||
self.shell = shell.OpenStackCinderShell()
|
self.shell = shell.OpenStackManilaShell()
|
||||||
|
|
||||||
#HACK(bcwaldon): replace this when we start using stubs
|
#HACK(bcwaldon): replace this when we start using stubs
|
||||||
self.old_get_client_class = client.get_client_class
|
self.old_get_client_class = client.get_client_class
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
_cinder()
|
_manila()
|
||||||
{
|
{
|
||||||
local cur prev opts
|
local cur prev opts
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
|
||||||
opts="$(cinder bash_completion)"
|
opts="$(manila bash_completion)"
|
||||||
|
|
||||||
COMPLETION_CACHE=~/.manilaclient/*/*-cache
|
COMPLETION_CACHE=~/.manilaclient/*/*-cache
|
||||||
opts+=" "$(cat $COMPLETION_CACHE 2> /dev/null | tr '\n' ' ')
|
opts+=" "$(cat $COMPLETION_CACHE 2> /dev/null | tr '\n' ' ')
|
||||||
|
|
||||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||||
}
|
}
|
||||||
complete -F _cinder cinder
|
complete -F _manila manila
|
||||||
|
@ -190,7 +190,7 @@ def install_dependencies(venv=VENV):
|
|||||||
|
|
||||||
pip_install('-r', PIP_REQUIRES)
|
pip_install('-r', PIP_REQUIRES)
|
||||||
pip_install('-r', TEST_REQUIRES)
|
pip_install('-r', TEST_REQUIRES)
|
||||||
# Tell the virtual env how to "import cinder"
|
# Tell the virtual env how to "import manila"
|
||||||
pthfile = os.path.join(venv, "lib", PY_VERSION, "site-packages",
|
pthfile = os.path.join(venv, "lib", PY_VERSION, "site-packages",
|
||||||
"manilaclient.pth")
|
"manilaclient.pth")
|
||||||
f = open(pthfile, 'w')
|
f = open(pthfile, 'w')
|
||||||
|
Loading…
Reference in New Issue
Block a user