mass replace cinder to manila

This commit is contained in:
Yulia Portnova 2013-09-05 13:32:38 +03:00
parent 2d2bedf6b0
commit 77dffa2c99
17 changed files with 88 additions and 88 deletions

14
HACKING
View File

@ -1,4 +1,4 @@
Cinder Style Commandments
Manila Style Commandments
=========================
Step 1: Read http://www.python.org/dev/peps/pep-0008/
@ -16,7 +16,7 @@ Imports
# vim: tabstop=4 shiftwidth=4 softtabstop=4
{{stdlib imports in human alphabetical order}}
\n
{{cinder imports in human alphabetical order}}
{{manila imports in human alphabetical order}}
\n
\n
{{begin your code}}
@ -42,11 +42,11 @@ Human Alphabetical Order Examples
import time
import unittest
from cinder import flags
from cinder import test
from cinder.auth import users
from cinder.endpoint import api
from cinder.endpoint import cloud
from manila import flags
from manila import test
from manila.auth import users
from manila.endpoint import api
from manila.endpoint import cloud
Docstrings
----------

View File

@ -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
``manilaclient`` module), and a command-line script (``cinder``). Each
implements 100% of the OpenStack Cinder API.
This is a client for the OpenStack Manila API. There's a Python API (the
``manilaclient`` module), and a command-line script (``manila``). Each
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
`OpenStack API documentation`_.
@ -32,7 +32,7 @@ __ http://github.com/jacobian/python-cloudservers
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).
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_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::
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.
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-tenant-name <auth-tenant-name>] [--os-auth-url <auth-url>]
[--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>]
<subcommand> ...
Command-line interface to the OpenStack Cinder API.
Command-line interface to the OpenStack Manila API.
Positional arguments:
<subcommand>
@ -124,11 +124,11 @@ You'll find complete documentation on the shell by running
--service-type <service-type>
Defaults to compute for most actions
--service-name <service-name>
Defaults to env[CINDER_SERVICE_NAME]
Defaults to env[MANILA_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>
Defaults to env[CINDER_ENDPOINT_TYPE] or publicURL.
Defaults to env[MANILA_ENDPOINT_TYPE] or publicURL.
--os-volume-api-version <compute-api-ver>
Accepts 1,defaults to env[OS_VOLUME_API_VERSION].
--os-cacert <ca-certificate>

View File

@ -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::
>>> from manilaclient import client
>>> cinder = client.Client('1', $OS_USER_NAME, $OS_PASSWORD, $OS_TENANT_NAME, $OS_AUTH_URL)
>>> cinder.volumes.list()
>>> manila = client.Client('1', $OS_USER_NAME, $OS_PASSWORD, $OS_TENANT_NAME, $OS_AUTH_URL)
>>> 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
ce06d0a8-5c1b-4e2c-81d2-39eca6bbfb70
>>> cinder.volumes.list()
>>> manila.volumes.list()
[<Volume: ce06d0a8-5c1b-4e2c-81d2-39eca6bbfb70>]
>>>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_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
@ -39,7 +39,7 @@ Release Notes
1.0.3
-----
* Added support for V2 Cinder API
* Added support for V2 Manila API
* Corected upload-volume-to-image help messaging
* Align handling of metadata args for all methods
* Update OSLO version

View File

@ -1,30 +1,30 @@
The :program:`cinder` shell utility
The :program:`manila` shell utility
=========================================
.. program:: cinder
.. program:: manila
.. highlight:: bash
The :program:`cinder` shell utility interacts with the OpenStack Cinder API
from the command line. It supports the entirety of 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 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`
and :option:`--os-tenant-name` options, but it's easier to just set them as
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.
.. envvar:: OS_TENANT_NAME or CINDER_PROJECT_ID
.. envvar:: OS_TENANT_NAME or MANILA_PROJECT_ID
Project for work.
.. envvar:: OS_AUTH_URL or CINDER_URL
.. envvar:: OS_AUTH_URL or MANILA_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::
cinder <command> [arguments...]
manila <command> [arguments...]
Run :program:`cinder help` to get a full list of all possible commands,
and run :program:`cinder help <command>` to get detailed help for that
Run :program:`manila help` to get a full list of all possible commands,
and run :program:`manila help <command>` to get detailed help for that
command.

View File

@ -97,8 +97,8 @@ class Manager(utils.HookableMixin):
# NOTE(sirp): Keep separate UUID caches for each username + endpoint
# pair
username = utils.env('OS_USERNAME', 'CINDER_USERNAME')
url = utils.env('OS_URL', 'CINDER_URL')
username = utils.env('OS_USERNAME', 'MANILA_USERNAME')
url = utils.env('OS_URL', 'MANILA_URL')
uniqifier = hashlib.md5(username + url).hexdigest()
cache_dir = os.path.expanduser(os.path.join(base_dir, uniqifier))

View File

@ -272,7 +272,7 @@ class HTTPClient(object):
auth_url = self.auth_url
if self.version == "v2.0":
while auth_url:
if "CINDER_RAX_AUTH" in os.environ:
if "MANILA_RAX_AUTH" in os.environ:
auth_url = self._rax_auth(auth_url)
else:
auth_url = self._v2_auth(auth_url)
@ -290,7 +290,7 @@ class HTTPClient(object):
try:
while 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
# real endpoint, only hostname and port.
except exceptions.AuthorizationFailure:

View File

@ -15,7 +15,7 @@
# under the License.
"""
Command-line interface to the OpenStack Cinder API.
Command-line interface to the OpenStack Manila API.
"""
import argparse
@ -64,13 +64,13 @@ class manilaclientArgumentParser(argparse.ArgumentParser):
'subp': progparts[2]})
class OpenStackCinderShell(object):
class OpenStackManilaShell(object):
def get_base_parser(self):
parser = manilaclientArgumentParser(
prog='cinder',
prog='manila',
description=__doc__.strip(),
epilog='See "cinder help COMMAND" '
epilog='See "manila help COMMAND" '
'for help on a specific command.',
add_help=False,
formatter_class=OpenStackHelpFormatter,
@ -94,7 +94,7 @@ class OpenStackCinderShell(object):
parser.add_argument('--os-username',
metavar='<auth-user-name>',
default=utils.env('OS_USERNAME',
'CINDER_USERNAME'),
'MANILA_USERNAME'),
help='Defaults to env[OS_USERNAME].')
parser.add_argument('--os_username',
help=argparse.SUPPRESS)
@ -102,7 +102,7 @@ class OpenStackCinderShell(object):
parser.add_argument('--os-password',
metavar='<auth-password>',
default=utils.env('OS_PASSWORD',
'CINDER_PASSWORD'),
'MANILA_PASSWORD'),
help='Defaults to env[OS_PASSWORD].')
parser.add_argument('--os_password',
help=argparse.SUPPRESS)
@ -110,7 +110,7 @@ class OpenStackCinderShell(object):
parser.add_argument('--os-tenant-name',
metavar='<auth-tenant-name>',
default=utils.env('OS_TENANT_NAME',
'CINDER_PROJECT_ID'),
'MANILA_PROJECT_ID'),
help='Defaults to env[OS_TENANT_NAME].')
parser.add_argument('--os_tenant_name',
help=argparse.SUPPRESS)
@ -118,7 +118,7 @@ class OpenStackCinderShell(object):
parser.add_argument('--os-tenant-id',
metavar='<auth-tenant-id>',
default=utils.env('OS_TENANT_ID',
'CINDER_TENANT_ID'),
'MANILA_TENANT_ID'),
help='Defaults to env[OS_TENANT_ID].')
parser.add_argument('--os_tenant_id',
help=argparse.SUPPRESS)
@ -126,7 +126,7 @@ class OpenStackCinderShell(object):
parser.add_argument('--os-auth-url',
metavar='<auth-url>',
default=utils.env('OS_AUTH_URL',
'CINDER_URL'),
'MANILA_URL'),
help='Defaults to env[OS_AUTH_URL].')
parser.add_argument('--os_auth_url',
help=argparse.SUPPRESS)
@ -134,7 +134,7 @@ class OpenStackCinderShell(object):
parser.add_argument('--os-region-name',
metavar='<region-name>',
default=utils.env('OS_REGION_NAME',
'CINDER_REGION_NAME'),
'MANILA_REGION_NAME'),
help='Defaults to env[OS_REGION_NAME].')
parser.add_argument('--os_region_name',
help=argparse.SUPPRESS)
@ -147,23 +147,23 @@ class OpenStackCinderShell(object):
parser.add_argument('--service-name',
metavar='<service-name>',
default=utils.env('CINDER_SERVICE_NAME'),
help='Defaults to env[CINDER_SERVICE_NAME]')
default=utils.env('MANILA_SERVICE_NAME'),
help='Defaults to env[MANILA_SERVICE_NAME]')
parser.add_argument('--service_name',
help=argparse.SUPPRESS)
parser.add_argument('--volume-service-name',
metavar='<volume-service-name>',
default=utils.env('CINDER_VOLUME_SERVICE_NAME'),
help='Defaults to env[CINDER_VOLUME_SERVICE_NAME]')
default=utils.env('MANILA_VOLUME_SERVICE_NAME'),
help='Defaults to env[MANILA_VOLUME_SERVICE_NAME]')
parser.add_argument('--volume_service_name',
help=argparse.SUPPRESS)
parser.add_argument('--endpoint-type',
metavar='<endpoint-type>',
default=utils.env('CINDER_ENDPOINT_TYPE',
default=utils.env('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 + '.')
parser.add_argument('--endpoint_type',
help=argparse.SUPPRESS)
@ -209,17 +209,17 @@ class OpenStackCinderShell(object):
# alias for --os-password, left in for backwards compatibility
parser.add_argument('--apikey', '--password', dest='apikey',
default=utils.env('CINDER_API_KEY'),
default=utils.env('MANILA_API_KEY'),
help=argparse.SUPPRESS)
# alias for --os-tenant-name, left in for backward compatibility
parser.add_argument('--projectid', '--tenant_name', dest='projectid',
default=utils.env('CINDER_PROJECT_ID'),
default=utils.env('MANILA_PROJECT_ID'),
help=argparse.SUPPRESS)
# alias for --os-auth-url, left in for backward compatibility
parser.add_argument('--url', '--auth_url', dest='url',
default=utils.env('CINDER_URL'),
default=utils.env('MANILA_URL'),
help=argparse.SUPPRESS)
return parser
@ -444,7 +444,7 @@ class OpenStackCinderShell(object):
if not utils.isunauthenticated(args.func):
self.cs.authenticate()
except exc.Unauthorized:
raise exc.CommandError("Invalid OpenStack Cinder credentials.")
raise exc.CommandError("Invalid OpenStack Manila credentials.")
except exc.AuthorizationFailure:
raise exc.CommandError("Unable to authorize user")
@ -459,7 +459,7 @@ class OpenStackCinderShell(object):
"""Print arguments for bash_completion.
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()
options = set()
@ -498,9 +498,9 @@ class OpenStackHelpFormatter(argparse.HelpFormatter):
def main():
try:
OpenStackCinderShell().main(map(strutils.safe_decode, sys.argv[1:]))
OpenStackManilaShell().main(map(strutils.safe_decode, sys.argv[1:]))
except KeyboardInterrupt:
print >> sys.stderr, "... terminating cinder client"
print >> sys.stderr, "... terminating manila client"
sys.exit(130)
except Exception, e:
logger.debug(e, exc_info=1)

View File

@ -33,7 +33,7 @@ setuptools.setup(
version=setup.get_version(project),
author="OpenStack Contributors",
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"),
license="Apache License, Version 2.0",
url="https://github.com/openstack/python-manilaclient",

View File

@ -31,7 +31,7 @@ class ShellTest(utils.TestCase):
orig = sys.stdout
try:
sys.stdout = cStringIO.StringIO()
_shell = manilaclient.shell.OpenStackCinderShell()
_shell = manilaclient.shell.OpenStackManilaShell()
_shell.main(argstr.split())
except SystemExit:
exc_type, exc_value, exc_traceback = sys.exc_info()
@ -50,7 +50,7 @@ class ShellTest(utils.TestCase):
required = [
'.*?^usage: ',
'.*?(?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')
for r in required:
@ -59,7 +59,7 @@ class ShellTest(utils.TestCase):
def test_help_on_subcommand(self):
required = [
'.*?^usage: cinder list',
'.*?^usage: manila list',
'.*?(?m)^List all the volumes.',
]
help_text = self.shell('help list')

View File

@ -28,7 +28,7 @@ def _stub_volume(**kwargs):
'display_description': None,
"attachments": [],
"bootable": "false",
"availability_zone": "cinder",
"availability_zone": "manila",
"created_at": "2012-08-27T00:00:00.000000",
"display_description": None,
"display_name": None,

View File

@ -195,7 +195,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
{"headers": {'location':'http://127.0.0.1:5001'},
"status_code": 305,
"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
# protocol (through headers) but tokens are being returned in
# body (looks like keystone bug). Leaved for compatibility.

View File

@ -29,11 +29,11 @@ from tests import utils
class ShellTest(utils.TestCase):
FAKE_ENV = {
'CINDER_USERNAME': 'username',
'CINDER_PASSWORD': 'password',
'CINDER_PROJECT_ID': 'project_id',
'MANILA_USERNAME': 'username',
'MANILA_PASSWORD': 'password',
'MANILA_PROJECT_ID': 'project_id',
'OS_VOLUME_API_VERSION': '1.1',
'CINDER_URL': 'http://no.where',
'MANILA_URL': 'http://no.where',
}
# Patch os.environ to avoid required auth info.
@ -44,7 +44,7 @@ class ShellTest(utils.TestCase):
self.useFixture(fixtures.EnvironmentVariable(var,
self.FAKE_ENV[var]))
self.shell = shell.OpenStackCinderShell()
self.shell = shell.OpenStackManilaShell()
#HACK(bcwaldon): replace this when we start using stubs
self.old_get_client_class = client.get_client_class

View File

@ -27,7 +27,7 @@ def _stub_volume(**kwargs):
'description': None,
"attachments": [],
"bootable": "false",
"availability_zone": "cinder",
"availability_zone": "manila",
"created_at": "2012-08-27T00:00:00.000000",
"id": '00000000-0000-0000-0000-000000000000',
"metadata": {},

View File

@ -211,7 +211,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
{"headers": {'location':'http://127.0.0.1:5001'},
"status_code": 305,
"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
# protocol (through headers) but tokens are being returned in
# body (looks like keystone bug). Leaved for compatibility.

View File

@ -24,11 +24,11 @@ from tests.v2 import fakes
class ShellTest(utils.TestCase):
FAKE_ENV = {
'CINDER_USERNAME': 'username',
'CINDER_PASSWORD': 'password',
'CINDER_PROJECT_ID': 'project_id',
'MANILA_USERNAME': 'username',
'MANILA_PASSWORD': 'password',
'MANILA_PROJECT_ID': 'project_id',
'OS_VOLUME_API_VERSION': '2',
'CINDER_URL': 'http://no.where',
'MANILA_URL': 'http://no.where',
}
# Patch os.environ to avoid required auth info.
@ -39,7 +39,7 @@ class ShellTest(utils.TestCase):
self.useFixture(fixtures.EnvironmentVariable(var,
self.FAKE_ENV[var]))
self.shell = shell.OpenStackCinderShell()
self.shell = shell.OpenStackManilaShell()
#HACK(bcwaldon): replace this when we start using stubs
self.old_get_client_class = client.get_client_class

View File

@ -1,15 +1,15 @@
_cinder()
_manila()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="$(cinder bash_completion)"
opts="$(manila bash_completion)"
COMPLETION_CACHE=~/.manilaclient/*/*-cache
opts+=" "$(cat $COMPLETION_CACHE 2> /dev/null | tr '\n' ' ')
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
}
complete -F _cinder cinder
complete -F _manila manila

View File

@ -190,7 +190,7 @@ def install_dependencies(venv=VENV):
pip_install('-r', PIP_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",
"manilaclient.pth")
f = open(pthfile, 'w')