Remove aliases for `args` and `env` in utils

To remove aliases for `arg` and `env` functions in novaclient.utils,
we should use `arg` and `env` directly from cliutils in novaclients modules.

This patch removes aliases in `novaclient.utils` and starts using
`args` and `env` from novaclient.openstack.common.cliutils directly.

Change-Id: I4585adae62bc66ad6bc9d19be10d4679bb3dc5a1
This commit is contained in:
Andrey Kurilin 2014-10-24 14:15:17 +03:00
parent 821643e126
commit 96a124fae6
13 changed files with 134 additions and 114 deletions

View File

@ -45,8 +45,8 @@ from six.moves.urllib import parse
from novaclient import exceptions from novaclient import exceptions
from novaclient.i18n import _ from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient import service_catalog from novaclient import service_catalog
from novaclient import utils
class _ClientConnectionPool(object): class _ClientConnectionPool(object):
@ -90,8 +90,8 @@ class CompletionCache(object):
""" """
uniqifier = hashlib.md5(username.encode('utf-8') + uniqifier = hashlib.md5(username.encode('utf-8') +
auth_url.encode('utf-8')).hexdigest() auth_url.encode('utf-8')).hexdigest()
base_dir = utils.env('NOVACLIENT_UUID_CACHE_DIR', base_dir = cliutils.env('NOVACLIENT_UUID_CACHE_DIR',
default="~/.novaclient") default="~/.novaclient")
return os.path.expanduser(os.path.join(base_dir, uniqifier)) return os.path.expanduser(os.path.join(base_dir, uniqifier))
def _prepare_directory(self): def _prepare_directory(self):

View File

@ -159,7 +159,7 @@ class SecretsHelper(object):
self._password = self.args.os_password self._password = self.args.os_password
else: else:
verify_pass = strutils.bool_from_string( verify_pass = strutils.bool_from_string(
utils.env("OS_VERIFY_PASSWORD", default=False), True) cliutils.env("OS_VERIFY_PASSWORD", default=False), True)
self._password = self._prompt_password(verify_pass) self._password = self._prompt_password(verify_pass)
if not self._password: if not self._password:
raise exc.CommandError( raise exc.CommandError(
@ -241,16 +241,17 @@ class OpenStackComputeShell(object):
# Register the CLI arguments that have moved to the session object. # Register the CLI arguments that have moved to the session object.
ksession.Session.register_cli_options(parser) ksession.Session.register_cli_options(parser)
parser.set_defaults(insecure=utils.env('NOVACLIENT_INSECURE', parser.set_defaults(insecure=cliutils.env('NOVACLIENT_INSECURE',
default=False)) default=False))
identity.Password.register_argparse_arguments(parser) identity.Password.register_argparse_arguments(parser)
parser.set_defaults(os_username=utils.env('OS_USERNAME', parser.set_defaults(os_username=cliutils.env('OS_USERNAME',
'NOVA_USERNAME')) 'NOVA_USERNAME'))
parser.set_defaults(os_password=utils.env('OS_PASSWORD', parser.set_defaults(os_password=cliutils.env('OS_PASSWORD',
'NOVA_PASSWORD')) 'NOVA_PASSWORD'))
parser.set_defaults(os_auth_url=utils.env('OS_AUTH_URL', 'NOVA_URL')) parser.set_defaults(os_auth_url=cliutils.env('OS_AUTH_URL',
'NOVA_URL'))
def get_base_parser(self): def get_base_parser(self):
parser = NovaClientArgumentParser( parser = NovaClientArgumentParser(
@ -282,7 +283,7 @@ class OpenStackComputeShell(object):
parser.add_argument( parser.add_argument(
'--os-cache', '--os-cache',
default=strutils.bool_from_string( default=strutils.bool_from_string(
utils.env('OS_CACHE', default=False), True), cliutils.env('OS_CACHE', default=False), True),
action='store_true', action='store_true',
help=_("Use the auth token cache. Defaults to False if " help=_("Use the auth token cache. Defaults to False if "
"env[OS_CACHE] is not set.")) "env[OS_CACHE] is not set."))
@ -295,7 +296,7 @@ class OpenStackComputeShell(object):
parser.add_argument( parser.add_argument(
'--os-auth-token', '--os-auth-token',
default=utils.env('OS_AUTH_TOKEN'), default=cliutils.env('OS_AUTH_TOKEN'),
help='Defaults to env[OS_AUTH_TOKEN]') help='Defaults to env[OS_AUTH_TOKEN]')
parser.add_argument( parser.add_argument(
@ -309,7 +310,7 @@ class OpenStackComputeShell(object):
parser.add_argument( parser.add_argument(
'--os-tenant-name', '--os-tenant-name',
metavar='<auth-tenant-name>', metavar='<auth-tenant-name>',
default=utils.env('OS_TENANT_NAME', 'NOVA_PROJECT_ID'), default=cliutils.env('OS_TENANT_NAME', 'NOVA_PROJECT_ID'),
help=_('Defaults to env[OS_TENANT_NAME].')) help=_('Defaults to env[OS_TENANT_NAME].'))
parser.add_argument( parser.add_argument(
'--os_tenant_name', '--os_tenant_name',
@ -318,7 +319,7 @@ class OpenStackComputeShell(object):
parser.add_argument( parser.add_argument(
'--os-tenant-id', '--os-tenant-id',
metavar='<auth-tenant-id>', metavar='<auth-tenant-id>',
default=utils.env('OS_TENANT_ID'), default=cliutils.env('OS_TENANT_ID'),
help=_('Defaults to env[OS_TENANT_ID].')) help=_('Defaults to env[OS_TENANT_ID].'))
parser.add_argument( parser.add_argument(
@ -328,7 +329,7 @@ class OpenStackComputeShell(object):
parser.add_argument( parser.add_argument(
'--os-region-name', '--os-region-name',
metavar='<region-name>', metavar='<region-name>',
default=utils.env('OS_REGION_NAME', 'NOVA_REGION_NAME'), default=cliutils.env('OS_REGION_NAME', 'NOVA_REGION_NAME'),
help=_('Defaults to env[OS_REGION_NAME].')) help=_('Defaults to env[OS_REGION_NAME].'))
parser.add_argument( parser.add_argument(
'--os_region_name', '--os_region_name',
@ -337,7 +338,7 @@ class OpenStackComputeShell(object):
parser.add_argument( parser.add_argument(
'--os-auth-system', '--os-auth-system',
metavar='<auth-system>', metavar='<auth-system>',
default=utils.env('OS_AUTH_SYSTEM'), default=cliutils.env('OS_AUTH_SYSTEM'),
help='Defaults to env[OS_AUTH_SYSTEM].') help='Defaults to env[OS_AUTH_SYSTEM].')
parser.add_argument( parser.add_argument(
'--os_auth_system', '--os_auth_system',
@ -354,7 +355,7 @@ class OpenStackComputeShell(object):
parser.add_argument( parser.add_argument(
'--service-name', '--service-name',
metavar='<service-name>', metavar='<service-name>',
default=utils.env('NOVA_SERVICE_NAME'), default=cliutils.env('NOVA_SERVICE_NAME'),
help=_('Defaults to env[NOVA_SERVICE_NAME]')) help=_('Defaults to env[NOVA_SERVICE_NAME]'))
parser.add_argument( parser.add_argument(
'--service_name', '--service_name',
@ -363,7 +364,7 @@ class OpenStackComputeShell(object):
parser.add_argument( parser.add_argument(
'--volume-service-name', '--volume-service-name',
metavar='<volume-service-name>', metavar='<volume-service-name>',
default=utils.env('NOVA_VOLUME_SERVICE_NAME'), default=cliutils.env('NOVA_VOLUME_SERVICE_NAME'),
help=_('Defaults to env[NOVA_VOLUME_SERVICE_NAME]')) help=_('Defaults to env[NOVA_VOLUME_SERVICE_NAME]'))
parser.add_argument( parser.add_argument(
'--volume_service_name', '--volume_service_name',
@ -373,9 +374,9 @@ class OpenStackComputeShell(object):
'--os-endpoint-type', '--os-endpoint-type',
metavar='<endpoint-type>', metavar='<endpoint-type>',
dest='endpoint_type', dest='endpoint_type',
default=utils.env( default=cliutils.env(
'NOVA_ENDPOINT_TYPE', 'NOVA_ENDPOINT_TYPE',
default=utils.env( default=cliutils.env(
'OS_ENDPOINT_TYPE', 'OS_ENDPOINT_TYPE',
default=DEFAULT_NOVA_ENDPOINT_TYPE)), default=DEFAULT_NOVA_ENDPOINT_TYPE)),
help=_('Defaults to env[NOVA_ENDPOINT_TYPE], ' help=_('Defaults to env[NOVA_ENDPOINT_TYPE], '
@ -395,8 +396,8 @@ class OpenStackComputeShell(object):
parser.add_argument( parser.add_argument(
'--os-compute-api-version', '--os-compute-api-version',
metavar='<compute-api-ver>', metavar='<compute-api-ver>',
default=utils.env('OS_COMPUTE_API_VERSION', default=cliutils.env('OS_COMPUTE_API_VERSION',
default=DEFAULT_OS_COMPUTE_API_VERSION), default=DEFAULT_OS_COMPUTE_API_VERSION),
help=_('Accepts 1.1 or 3, ' help=_('Accepts 1.1 or 3, '
'defaults to env[OS_COMPUTE_API_VERSION].')) 'defaults to env[OS_COMPUTE_API_VERSION].'))
parser.add_argument( parser.add_argument(
@ -407,7 +408,7 @@ class OpenStackComputeShell(object):
'--bypass-url', '--bypass-url',
metavar='<bypass-url>', metavar='<bypass-url>',
dest='bypass_url', dest='bypass_url',
default=utils.env('NOVACLIENT_BYPASS_URL'), default=cliutils.env('NOVACLIENT_BYPASS_URL'),
help="Use this API endpoint instead of the Service Catalog. " help="Use this API endpoint instead of the Service Catalog. "
"Defaults to env[NOVACLIENT_BYPASS_URL]") "Defaults to env[NOVACLIENT_BYPASS_URL]")
parser.add_argument('--bypass_url', parser.add_argument('--bypass_url',
@ -849,7 +850,7 @@ class OpenStackComputeShell(object):
commands.remove('bash_completion') commands.remove('bash_completion')
print(' '.join(commands | options)) print(' '.join(commands | options))
@utils.arg( @cliutils.arg(
'command', 'command',
metavar='<subcommand>', metavar='<subcommand>',
nargs='?', nargs='?',

View File

@ -27,9 +27,6 @@ from novaclient.i18n import _
from novaclient.openstack.common import cliutils from novaclient.openstack.common import cliutils
arg = cliutils.arg
env = cliutils.env
VALID_KEY_REGEX = re.compile(r"[\w\.\- :]+$", re.UNICODE) VALID_KEY_REGEX = re.compile(r"[\w\.\- :]+$", re.UNICODE)

View File

@ -19,6 +19,7 @@ Baremetal interface (v2 extension).
from novaclient import base from novaclient import base
from novaclient.i18n import _ from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient import utils from novaclient import utils
@ -151,43 +152,43 @@ class BareMetalNodeManager(base.ManagerWithFind):
return interfaces return interfaces
@utils.arg( @cliutils.arg(
'service_host', 'service_host',
metavar='<service_host>', metavar='<service_host>',
help=_('Name of nova compute host which will control this baremetal ' help=_('Name of nova compute host which will control this baremetal '
'node')) 'node'))
@utils.arg( @cliutils.arg(
'cpus', 'cpus',
metavar='<cpus>', metavar='<cpus>',
type=int, type=int,
help=_('Number of CPUs in the node')) help=_('Number of CPUs in the node'))
@utils.arg( @cliutils.arg(
'memory_mb', 'memory_mb',
metavar='<memory_mb>', metavar='<memory_mb>',
type=int, type=int,
help=_('Megabytes of RAM in the node')) help=_('Megabytes of RAM in the node'))
@utils.arg( @cliutils.arg(
'local_gb', 'local_gb',
metavar='<local_gb>', metavar='<local_gb>',
type=int, type=int,
help=_('Gigabytes of local storage in the node')) help=_('Gigabytes of local storage in the node'))
@utils.arg( @cliutils.arg(
'prov_mac_address', 'prov_mac_address',
metavar='<prov_mac_address>', metavar='<prov_mac_address>',
help=_('MAC address to provision the node')) help=_('MAC address to provision the node'))
@utils.arg( @cliutils.arg(
'--pm_address', default=None, '--pm_address', default=None,
metavar='<pm_address>', metavar='<pm_address>',
help=_('Power management IP for the node')) help=_('Power management IP for the node'))
@utils.arg( @cliutils.arg(
'--pm_user', default=None, '--pm_user', default=None,
metavar='<pm_user>', metavar='<pm_user>',
help=_('Username for the node\'s power management')) help=_('Username for the node\'s power management'))
@utils.arg( @cliutils.arg(
'--pm_password', default=None, '--pm_password', default=None,
metavar='<pm_password>', metavar='<pm_password>',
help=_('Password for the node\'s power management')) help=_('Password for the node\'s power management'))
@utils.arg( @cliutils.arg(
'--terminal_port', default=None, '--terminal_port', default=None,
metavar='<terminal_port>', metavar='<terminal_port>',
type=int, type=int,
@ -204,7 +205,7 @@ def do_baremetal_node_create(cs, args):
_print_baremetal_resource(node) _print_baremetal_resource(node)
@utils.arg( @cliutils.arg(
'node', 'node',
metavar='<node>', metavar='<node>',
help=_('ID of the node to delete.')) help=_('ID of the node to delete.'))
@ -286,7 +287,7 @@ def _print_baremetal_node_interfaces(interfaces):
]) ])
@utils.arg( @cliutils.arg(
'node', 'node',
metavar='<node>', metavar='<node>',
help=_("ID of node")) help=_("ID of node"))
@ -296,20 +297,20 @@ def do_baremetal_node_show(cs, args):
_print_baremetal_resource(node) _print_baremetal_resource(node)
@utils.arg( @cliutils.arg(
'node', 'node',
metavar='<node>', metavar='<node>',
help=_("ID of node")) help=_("ID of node"))
@utils.arg( @cliutils.arg(
'address', 'address',
metavar='<address>', metavar='<address>',
help=_("MAC address of interface")) help=_("MAC address of interface"))
@utils.arg( @cliutils.arg(
'--datapath_id', '--datapath_id',
default=0, default=0,
metavar='<datapath_id>', metavar='<datapath_id>',
help=_("OpenFlow Datapath ID of interface")) help=_("OpenFlow Datapath ID of interface"))
@utils.arg( @cliutils.arg(
'--port_no', '--port_no',
default=0, default=0,
metavar='<port_no>', metavar='<port_no>',
@ -321,14 +322,17 @@ def do_baremetal_interface_add(cs, args):
_print_baremetal_resource(bmif) _print_baremetal_resource(bmif)
@utils.arg('node', metavar='<node>', help=_("ID of node")) @cliutils.arg('node', metavar='<node>', help=_("ID of node"))
@utils.arg('address', metavar='<address>', help=_("MAC address of interface")) @cliutils.arg(
'address',
metavar='<address>',
help=_("MAC address of interface"))
def do_baremetal_interface_remove(cs, args): def do_baremetal_interface_remove(cs, args):
"""Remove a network interface from a baremetal node.""" """Remove a network interface from a baremetal node."""
cs.baremetal.remove_interface(args.node, args.address) cs.baremetal.remove_interface(args.node, args.address)
@utils.arg('node', metavar='<node>', help=_("ID of node")) @cliutils.arg('node', metavar='<node>', help=_("ID of node"))
def do_baremetal_interface_list(cs, args): def do_baremetal_interface_list(cs, args):
"""List network interfaces associated with a baremetal node.""" """List network interfaces associated with a baremetal node."""
interfaces = cs.baremetal.list_interfaces(args.node) interfaces = cs.baremetal.list_interfaces(args.node)

View File

@ -15,6 +15,7 @@
from novaclient import base from novaclient import base
from novaclient.i18n import _ from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient import utils from novaclient import utils
@ -46,7 +47,7 @@ class CellsManager(base.Manager):
return self._get("/os-cells/%s" % path, "cell") return self._get("/os-cells/%s" % path, "cell")
@utils.arg( @cliutils.arg(
'cell', 'cell',
metavar='<cell-name>', metavar='<cell-name>',
help=_('Name of the cell.')) help=_('Name of the cell.'))
@ -56,7 +57,7 @@ def do_cell_show(cs, args):
utils.print_dict(cell._info) utils.print_dict(cell._info)
@utils.arg( @cliutils.arg(
'--cell', '--cell',
metavar='<cell-name>', metavar='<cell-name>',
help=_("Name of the cell to get the capacities."), help=_("Name of the cell to get the capacities."),

View File

@ -12,16 +12,17 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from novaclient.openstack.common import cliutils
from novaclient import utils from novaclient import utils
@utils.arg('server', metavar='<server>', help='Name or ID of server.') @cliutils.arg('server', metavar='<server>', help='Name or ID of server.')
def do_force_delete(cs, args): def do_force_delete(cs, args):
"""Force delete a server.""" """Force delete a server."""
utils.find_resource(cs.servers, args.server).force_delete() utils.find_resource(cs.servers, args.server).force_delete()
@utils.arg('server', metavar='<server>', help='Name or ID of server.') @cliutils.arg('server', metavar='<server>', help='Name or ID of server.')
def do_restore(cs, args): def do_restore(cs, args):
"""Restore a soft-deleted server.""" """Restore a soft-deleted server."""
utils.find_resource(cs.servers, args.server).restore() utils.find_resource(cs.servers, args.server).restore()

View File

@ -15,6 +15,7 @@
from novaclient import base from novaclient import base
from novaclient.i18n import _ from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient import utils from novaclient import utils
@ -37,19 +38,19 @@ def _server_evacuate(cs, server, args):
"error_message": error_message}) "error_message": error_message})
@utils.arg('host', metavar='<host>', help='Name of host.') @cliutils.arg('host', metavar='<host>', help='Name of host.')
@utils.arg('--target_host', @cliutils.arg(
metavar='<target_host>', '--target_host',
default=None, metavar='<target_host>',
help=_('Name of target host. ' default=None,
'If no host is specified the scheduler' help=_('Name of target host. If no host is specified the scheduler will '
' will select a target.')) 'select a target.'))
@utils.arg('--on-shared-storage', @cliutils.arg(
dest='on_shared_storage', '--on-shared-storage',
action="store_true", dest='on_shared_storage',
default=False, action="store_true",
help=_('Specifies whether all instances files are on shared ' default=False,
' storage')) help=_('Specifies whether all instances files are on shared storage'))
def do_host_evacuate(cs, args): def do_host_evacuate(cs, args):
"""Evacuate all instances from failed host.""" """Evacuate all instances from failed host."""
hypervisors = cs.hypervisors.search(args.host, servers=True) hypervisors = cs.hypervisors.search(args.host, servers=True)

View File

@ -14,6 +14,7 @@
# under the License. # under the License.
from novaclient.i18n import _ from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient import utils from novaclient import utils
@ -37,19 +38,22 @@ def _server_live_migrate(cs, server, args):
error_message) error_message)
@utils.arg('host', metavar='<host>', help='Name of host.') @cliutils.arg('host', metavar='<host>', help='Name of host.')
@utils.arg('--target-host', @cliutils.arg(
metavar='<target_host>', '--target-host',
default=None, metavar='<target_host>',
help=_('Name of target host.')) default=None,
@utils.arg('--block-migrate', help=_('Name of target host.'))
action='store_true', @cliutils.arg(
default=False, '--block-migrate',
help=_('Enable block migration.')) action='store_true',
@utils.arg('--disk-over-commit', default=False,
action='store_true', help=_('Enable block migration.'))
default=False, @cliutils.arg(
help=_('Enable disk overcommit.')) '--disk-over-commit',
action='store_true',
default=False,
help=_('Enable disk overcommit.'))
def do_host_evacuate_live(cs, args): def do_host_evacuate_live(cs, args):
"""Live migrate all instances of the specified host """Live migrate all instances of the specified host
to other available hosts. to other available hosts.

View File

@ -15,6 +15,7 @@
from novaclient import base from novaclient import base
from novaclient.i18n import _ from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient import utils from novaclient import utils
@ -36,7 +37,7 @@ def _server_migrate(cs, server):
"error_message": error_message}) "error_message": error_message})
@utils.arg('host', metavar='<host>', help='Name of host.') @cliutils.arg('host', metavar='<host>', help='Name of host.')
def do_host_servers_migrate(cs, args): def do_host_servers_migrate(cs, args):
"""Migrate all instances of the specified host to other available hosts.""" """Migrate all instances of the specified host to other available hosts."""
hypervisors = cs.hypervisors.search(args.host, servers=True) hypervisors = cs.hypervisors.search(args.host, servers=True)

View File

@ -17,6 +17,7 @@ import pprint
from novaclient import base from novaclient import base
from novaclient.i18n import _ from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient import utils from novaclient import utils
@ -40,11 +41,11 @@ class InstanceActionManager(base.ManagerWithFind):
base.getid(server), 'instanceActions') base.getid(server), 'instanceActions')
@utils.arg( @cliutils.arg(
'server', 'server',
metavar='<server>', metavar='<server>',
help=_('Name or UUID of the server to show an action for.')) help=_('Name or UUID of the server to show an action for.'))
@utils.arg( @cliutils.arg(
'request_id', 'request_id',
metavar='<request_id>', metavar='<request_id>',
help=_('Request ID of the action to get.')) help=_('Request ID of the action to get.'))
@ -58,7 +59,7 @@ def do_instance_action(cs, args):
utils.print_dict(action) utils.print_dict(action)
@utils.arg( @cliutils.arg(
'server', 'server',
metavar='<server>', metavar='<server>',
help=_('Name or UUID of the server to list actions for.')) help=_('Name or UUID of the server to list actions for.'))

View File

@ -14,24 +14,26 @@
# under the License. # under the License.
from novaclient.i18n import _ from novaclient.i18n import _
from novaclient import utils from novaclient.openstack.common import cliutils
from novaclient.v1_1 import shell from novaclient.v1_1 import shell
@utils.arg('host', @cliutils.arg(
metavar='<host>', 'host',
help=_('Name of host.')) metavar='<host>',
@utils.arg('action', help=_('Name of host.'))
metavar='<action>', @cliutils.arg(
choices=['set', 'delete'], 'action',
help=_("Actions: 'set' or 'delete'")) metavar='<action>',
@utils.arg('metadata', choices=['set', 'delete'],
metavar='<key=value>', help=_("Actions: 'set' or 'delete'"))
nargs='+', @cliutils.arg(
action='append', 'metadata',
default=[], metavar='<key=value>',
help=_('Metadata to set or delete (only key is necessary on ' nargs='+',
'delete)')) action='append',
default=[],
help=_('Metadata to set or delete (only key is necessary on delete)'))
def do_host_meta(cs, args): def do_host_meta(cs, args):
"""Set or Delete metadata on all instances of a host.""" """Set or Delete metadata on all instances of a host."""
hypervisors = cs.hypervisors.search(args.host, servers=True) hypervisors = cs.hypervisors.search(args.host, servers=True)

View File

@ -18,6 +18,7 @@ from six.moves.urllib import parse
from novaclient import base from novaclient import base
from novaclient.i18n import _ from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient import utils from novaclient import utils
@ -53,18 +54,21 @@ class MigrationManager(base.ManagerWithFind):
return self._list("/os-migrations%s" % query_string, "migrations") return self._list("/os-migrations%s" % query_string, "migrations")
@utils.arg('--host', @cliutils.arg(
dest='host', '--host',
metavar='<host>', dest='host',
help=_('Fetch migrations for the given host.')) metavar='<host>',
@utils.arg('--status', help=_('Fetch migrations for the given host.'))
dest='status', @cliutils.arg(
metavar='<status>', '--status',
help=_('Fetch migrations for the given status.')) dest='status',
@utils.arg('--cell_name', metavar='<status>',
dest='cell_name', help=_('Fetch migrations for the given status.'))
metavar='<cell_name>', @cliutils.arg(
help=_('Fetch migrations for the given cell_name.')) '--cell_name',
dest='cell_name',
metavar='<cell_name>',
help=_('Fetch migrations for the given cell_name.'))
def do_migration_list(cs, args): def do_migration_list(cs, args):
"""Print a list of migrations.""" """Print a list of migrations."""
_print_migrations(cs.migrations.list(args.host, args.status, _print_migrations(cs.migrations.list(args.host, args.status,

View File

@ -14,6 +14,7 @@
from novaclient import base from novaclient import base
from novaclient.i18n import _ from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient import utils from novaclient import utils
@ -40,7 +41,7 @@ class TenantNetworkManager(base.ManagerWithFind):
return self._create('/os-tenant-networks', body, 'network') return self._create('/os-tenant-networks', body, 'network')
@utils.arg('network_id', metavar='<network_id>', help='ID of network') @cliutils.arg('network_id', metavar='<network_id>', help='ID of network')
def do_net(cs, args): def do_net(cs, args):
""" """
Show a network Show a network
@ -57,12 +58,14 @@ def do_net_list(cs, args):
utils.print_list(networks, ['ID', 'Label', 'CIDR']) utils.print_list(networks, ['ID', 'Label', 'CIDR'])
@utils.arg('label', metavar='<network_label>', @cliutils.arg(
help=_('Network label (ex. my_new_network)')) 'label',
@utils.arg( metavar='<network_label>',
'cidr', metavar='<cidr>', help=_('Network label (ex. my_new_network)'))
help=_('IP block to allocate from (ex. 172.16.0.0/24 or ' @cliutils.arg(
'2001:DB8::/64)')) 'cidr',
metavar='<cidr>',
help=_('IP block to allocate from (ex. 172.16.0.0/24 or 2001:DB8::/64)'))
def do_net_create(cs, args): def do_net_create(cs, args):
""" """
Create a network Create a network
@ -71,7 +74,7 @@ def do_net_create(cs, args):
utils.print_dict(network._info) utils.print_dict(network._info)
@utils.arg('network_id', metavar='<network_id>', help='ID of network') @cliutils.arg('network_id', metavar='<network_id>', help='ID of network')
def do_net_delete(cs, args): def do_net_delete(cs, args):
""" """
Delete a network Delete a network