From 77dffa2c99ab1dd08eef6c465bd9fcc8a8e0c6a0 Mon Sep 17 00:00:00 2001 From: Yulia Portnova Date: Thu, 5 Sep 2013 13:32:38 +0300 Subject: [PATCH] mass replace cinder to manila --- HACKING | 14 +++++------ README.rst | 26 ++++++++++---------- doc/source/index.rst | 12 +++++----- doc/source/shell.rst | 26 ++++++++++---------- manilaclient/base.py | 4 ++-- manilaclient/client.py | 4 ++-- manilaclient/shell.py | 46 ++++++++++++++++++------------------ setup.py | 2 +- tests/test_shell.py | 6 ++--- tests/v1/fakes.py | 2 +- tests/v1/test_auth.py | 2 +- tests/v1/test_shell.py | 10 ++++---- tests/v2/fakes.py | 2 +- tests/v2/test_auth.py | 2 +- tests/v2/test_shell.py | 10 ++++---- tools/cinder.bash_completion | 6 ++--- tools/install_venv.py | 2 +- 17 files changed, 88 insertions(+), 88 deletions(-) diff --git a/HACKING b/HACKING index 3b82d9cac..0e9d43779 100644 --- a/HACKING +++ b/HACKING @@ -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 ---------- diff --git a/README.rst b/README.rst index 7d034f0d1..ed5953f11 100644 --- a/README.rst +++ b/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 -``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 ] + usage: manila [--debug] [--os-username ] [--os-password ] [--os-tenant-name ] [--os-auth-url ] [--os-region-name ] [--service-type ] @@ -73,7 +73,7 @@ You'll find complete documentation on the shell by running [--os-cacert ] [--retries ] ... - Command-line interface to the OpenStack Cinder API. + Command-line interface to the OpenStack Manila API. Positional arguments: @@ -124,11 +124,11 @@ You'll find complete documentation on the shell by running --service-type Defaults to compute for most actions --service-name - Defaults to env[CINDER_SERVICE_NAME] + Defaults to env[MANILA_SERVICE_NAME] --volume-service-name - Defaults to env[CINDER_VOLUME_SERVICE_NAME] + Defaults to env[MANILA_VOLUME_SERVICE_NAME] --endpoint-type - Defaults to env[CINDER_ENDPOINT_TYPE] or publicURL. + Defaults to env[MANILA_ENDPOINT_TYPE] or publicURL. --os-volume-api-version Accepts 1,defaults to env[OS_VOLUME_API_VERSION]. --os-cacert diff --git a/doc/source/index.rst b/doc/source/index.rst index 75c03fc8d..1117a6beb 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -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() [] >>>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 diff --git a/doc/source/shell.rst b/doc/source/shell.rst index 96b4f4fff..ee6dff2a0 100644 --- a/doc/source/shell.rst +++ b/doc/source/shell.rst @@ -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 [arguments...] + manila [arguments...] -Run :program:`cinder help` to get a full list of all possible commands, -and run :program:`cinder help ` to get detailed help for that +Run :program:`manila help` to get a full list of all possible commands, +and run :program:`manila help ` to get detailed help for that command. diff --git a/manilaclient/base.py b/manilaclient/base.py index ed226e9d0..c52f4cf0e 100644 --- a/manilaclient/base.py +++ b/manilaclient/base.py @@ -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)) diff --git a/manilaclient/client.py b/manilaclient/client.py index 1b34ce26e..80afdc7d3 100644 --- a/manilaclient/client.py +++ b/manilaclient/client.py @@ -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: diff --git a/manilaclient/shell.py b/manilaclient/shell.py index d44a2e7f7..2520350f1 100644 --- a/manilaclient/shell.py +++ b/manilaclient/shell.py @@ -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='', 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='', 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='', 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='', 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='', 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='', 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='', - 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='', - 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='', - 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) diff --git a/setup.py b/setup.py index 2fc7f1f92..93d2aba6e 100644 --- a/setup.py +++ b/setup.py @@ -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", diff --git a/tests/test_shell.py b/tests/test_shell.py index 7c39b30f5..09e586de0 100644 --- a/tests/test_shell.py +++ b/tests/test_shell.py @@ -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') diff --git a/tests/v1/fakes.py b/tests/v1/fakes.py index 7dfd27764..78aa7923a 100644 --- a/tests/v1/fakes.py +++ b/tests/v1/fakes.py @@ -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, diff --git a/tests/v1/test_auth.py b/tests/v1/test_auth.py index b64546009..2d5d86852 100644 --- a/tests/v1/test_auth.py +++ b/tests/v1/test_auth.py @@ -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. diff --git a/tests/v1/test_shell.py b/tests/v1/test_shell.py index aa1241a3c..f45973152 100644 --- a/tests/v1/test_shell.py +++ b/tests/v1/test_shell.py @@ -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 diff --git a/tests/v2/fakes.py b/tests/v2/fakes.py index 692b25a5d..ae8a946a9 100644 --- a/tests/v2/fakes.py +++ b/tests/v2/fakes.py @@ -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": {}, diff --git a/tests/v2/test_auth.py b/tests/v2/test_auth.py index 4920fa991..b54d3427f 100644 --- a/tests/v2/test_auth.py +++ b/tests/v2/test_auth.py @@ -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. diff --git a/tests/v2/test_shell.py b/tests/v2/test_shell.py index b5e435d2a..b3c8ac8ef 100644 --- a/tests/v2/test_shell.py +++ b/tests/v2/test_shell.py @@ -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 diff --git a/tools/cinder.bash_completion b/tools/cinder.bash_completion index 1726a234c..717681b7c 100644 --- a/tools/cinder.bash_completion +++ b/tools/cinder.bash_completion @@ -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 diff --git a/tools/install_venv.py b/tools/install_venv.py index 62ff2a21e..23b0c70de 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -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')