Use novaclient/utils directly and remove openstack/common (1/4)
We can use novaclient/utils directly and get rid of openstack/common folder. This is the first part. Change-Id: Iaec234fbcf4d0f8c7e8f2175eae11d3083a62090 Partial-Bug: #1551603
This commit is contained in:
parent
f9360ae6d4
commit
93913c84b6
@ -46,7 +46,6 @@ from novaclient import client
|
||||
from novaclient import exceptions as exc
|
||||
import novaclient.extension
|
||||
from novaclient.i18n import _
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient import utils
|
||||
|
||||
DEFAULT_MAJOR_OS_COMPUTE_API_VERSION = "2.0"
|
||||
@ -1042,7 +1041,7 @@ class OpenStackComputeShell(object):
|
||||
commands.remove('bash_completion')
|
||||
print(' '.join(commands | options))
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'command',
|
||||
metavar='<subcommand>',
|
||||
nargs='?',
|
||||
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
from novaclient import api_versions
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient import utils
|
||||
|
||||
|
||||
@api_versions.wraps("2.10", "2.20")
|
||||
@ -32,11 +32,11 @@ def do_another_fake_action():
|
||||
return 0
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--foo',
|
||||
start_version='2.1',
|
||||
end_version='2.2')
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--bar',
|
||||
start_version='2.3',
|
||||
end_version='2.4')
|
||||
@ -44,12 +44,12 @@ def do_fake_action2():
|
||||
return 3
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--foo',
|
||||
help='first foo',
|
||||
start_version='2.10',
|
||||
end_version='2.20')
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--foo',
|
||||
help='second foo',
|
||||
start_version='2.21')
|
||||
|
@ -18,7 +18,6 @@ import mock
|
||||
import novaclient
|
||||
from novaclient import api_versions
|
||||
from novaclient import exceptions
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient.tests.unit import utils
|
||||
from novaclient import utils as nutils
|
||||
from novaclient.v2 import versions
|
||||
@ -279,9 +278,9 @@ class WrapsTestCase(utils.TestCase):
|
||||
checker.assert_called_once_with(*((obj,) + some_args), **some_kwargs)
|
||||
|
||||
def test_arguments_property_is_copied(self):
|
||||
@cliutils.arg("argument_1")
|
||||
@nutils.arg("argument_1")
|
||||
@api_versions.wraps("2.666", "2.777")
|
||||
@cliutils.arg("argument_2")
|
||||
@nutils.arg("argument_2")
|
||||
def some_func():
|
||||
pass
|
||||
|
||||
|
@ -19,7 +19,6 @@ Baremetal interface (v2 extension).
|
||||
|
||||
from novaclient import base
|
||||
from novaclient.i18n import _
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient import utils
|
||||
|
||||
|
||||
@ -156,43 +155,43 @@ class BareMetalNodeManager(base.ManagerWithFind):
|
||||
return interfaces
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'service_host',
|
||||
metavar='<service_host>',
|
||||
help=_('Name of nova compute host which will control this baremetal '
|
||||
'node'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'cpus',
|
||||
metavar='<cpus>',
|
||||
type=int,
|
||||
help=_('Number of CPUs in the node'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'memory_mb',
|
||||
metavar='<memory_mb>',
|
||||
type=int,
|
||||
help=_('Megabytes of RAM in the node'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'local_gb',
|
||||
metavar='<local_gb>',
|
||||
type=int,
|
||||
help=_('Gigabytes of local storage in the node'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'prov_mac_address',
|
||||
metavar='<prov_mac_address>',
|
||||
help=_('MAC address to provision the node'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--pm_address', default=None,
|
||||
metavar='<pm_address>',
|
||||
help=_('Power management IP for the node'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--pm_user', default=None,
|
||||
metavar='<pm_user>',
|
||||
help=_('Username for the node\'s power management'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--pm_password', default=None,
|
||||
metavar='<pm_password>',
|
||||
help=_('Password for the node\'s power management'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--terminal_port', default=None,
|
||||
metavar='<terminal_port>',
|
||||
type=int,
|
||||
@ -209,7 +208,7 @@ def do_baremetal_node_create(cs, args):
|
||||
_print_baremetal_resource(node)
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'node',
|
||||
metavar='<node>',
|
||||
help=_('ID of the node to delete.'))
|
||||
@ -291,7 +290,7 @@ def _print_baremetal_node_interfaces(interfaces):
|
||||
])
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'node',
|
||||
metavar='<node>',
|
||||
help=_("ID of node"))
|
||||
@ -301,20 +300,20 @@ def do_baremetal_node_show(cs, args):
|
||||
_print_baremetal_resource(node)
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'node',
|
||||
metavar='<node>',
|
||||
help=_("ID of node"))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'address',
|
||||
metavar='<address>',
|
||||
help=_("MAC address of interface"))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--datapath_id',
|
||||
default=0,
|
||||
metavar='<datapath_id>',
|
||||
help=_("OpenFlow Datapath ID of interface"))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--port_no',
|
||||
default=0,
|
||||
metavar='<port_no>',
|
||||
@ -326,8 +325,8 @@ def do_baremetal_interface_add(cs, args):
|
||||
_print_baremetal_resource(bmif)
|
||||
|
||||
|
||||
@cliutils.arg('node', metavar='<node>', help=_("ID of node"))
|
||||
@cliutils.arg(
|
||||
@utils.arg('node', metavar='<node>', help=_("ID of node"))
|
||||
@utils.arg(
|
||||
'address',
|
||||
metavar='<address>',
|
||||
help=_("MAC address of interface"))
|
||||
@ -336,7 +335,7 @@ def do_baremetal_interface_remove(cs, args):
|
||||
cs.baremetal.remove_interface(args.node, args.address)
|
||||
|
||||
|
||||
@cliutils.arg('node', metavar='<node>', help=_("ID of node"))
|
||||
@utils.arg('node', metavar='<node>', help=_("ID of node"))
|
||||
def do_baremetal_interface_list(cs, args):
|
||||
"""List network interfaces associated with a baremetal node."""
|
||||
interfaces = cs.baremetal.list_interfaces(args.node)
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
from novaclient import base
|
||||
from novaclient.i18n import _
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient import utils
|
||||
|
||||
|
||||
@ -47,7 +46,7 @@ class CellsManager(base.Manager):
|
||||
return self._get("/os-cells/%s" % path, "cell")
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'cell',
|
||||
metavar='<cell-name>',
|
||||
help=_('Name of the cell.'))
|
||||
@ -57,7 +56,7 @@ def do_cell_show(cs, args):
|
||||
utils.print_dict(cell._info)
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--cell',
|
||||
metavar='<cell-name>',
|
||||
help=_("Name of the cell to get the capacities."),
|
||||
|
@ -12,17 +12,16 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient import utils
|
||||
|
||||
|
||||
@cliutils.arg('server', metavar='<server>', help='Name or ID of server.')
|
||||
@utils.arg('server', metavar='<server>', help='Name or ID of server.')
|
||||
def do_force_delete(cs, args):
|
||||
"""Force delete a server."""
|
||||
utils.find_resource(cs.servers, args.server).force_delete()
|
||||
|
||||
|
||||
@cliutils.arg('server', metavar='<server>', help='Name or ID of server.')
|
||||
@utils.arg('server', metavar='<server>', help='Name or ID of server.')
|
||||
def do_restore(cs, args):
|
||||
"""Restore a soft-deleted server."""
|
||||
utils.find_resource(cs.servers, args.server, deleted=True).restore()
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
from novaclient import base
|
||||
from novaclient.i18n import _
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient import utils
|
||||
|
||||
|
||||
@ -38,14 +37,14 @@ def _server_evacuate(cs, server, args):
|
||||
"error_message": error_message})
|
||||
|
||||
|
||||
@cliutils.arg('host', metavar='<host>', help='Name of host.')
|
||||
@cliutils.arg(
|
||||
@utils.arg('host', metavar='<host>', help='Name of host.')
|
||||
@utils.arg(
|
||||
'--target_host',
|
||||
metavar='<target_host>',
|
||||
default=None,
|
||||
help=_('Name of target host. If no host is specified the scheduler will '
|
||||
'select a target.'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--on-shared-storage',
|
||||
dest='on_shared_storage',
|
||||
action="store_true",
|
||||
|
@ -14,7 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
from novaclient.i18n import _
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient import utils
|
||||
|
||||
|
||||
@ -38,23 +37,23 @@ def _server_live_migrate(cs, server, args):
|
||||
error_message)
|
||||
|
||||
|
||||
@cliutils.arg('host', metavar='<host>', help='Name of host.')
|
||||
@cliutils.arg(
|
||||
@utils.arg('host', metavar='<host>', help='Name of host.')
|
||||
@utils.arg(
|
||||
'--target-host',
|
||||
metavar='<target_host>',
|
||||
default=None,
|
||||
help=_('Name of target host.'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--block-migrate',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help=_('Enable block migration.'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--disk-over-commit',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help=_('Enable disk overcommit.'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--max-servers',
|
||||
type=int,
|
||||
dest='max_servers',
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
from novaclient import base
|
||||
from novaclient.i18n import _
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient import utils
|
||||
|
||||
|
||||
@ -37,7 +36,7 @@ def _server_migrate(cs, server):
|
||||
"error_message": error_message})
|
||||
|
||||
|
||||
@cliutils.arg('host', metavar='<host>', help='Name of host.')
|
||||
@utils.arg('host', metavar='<host>', help='Name of host.')
|
||||
def do_host_servers_migrate(cs, args):
|
||||
"""Migrate all instances of the specified host to other available hosts."""
|
||||
hypervisors = cs.hypervisors.search(args.host, servers=True)
|
||||
|
@ -21,7 +21,6 @@ from novaclient import api_versions
|
||||
from novaclient import base
|
||||
from novaclient import exceptions
|
||||
from novaclient.i18n import _
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient import utils
|
||||
|
||||
|
||||
@ -62,18 +61,18 @@ def _find_server(cs, args):
|
||||
return args.server
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
help=_('Name or UUID of the server to show actions for.'),
|
||||
start_version="2.0", end_version="2.20")
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
help=_('Name or UUID of the server to show actions for. Only UUID can be '
|
||||
'used to show actions for a deleted server.'),
|
||||
start_version="2.21")
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'request_id',
|
||||
metavar='<request_id>',
|
||||
help=_('Request ID of the action to get.'))
|
||||
@ -87,12 +86,12 @@ def do_instance_action(cs, args):
|
||||
utils.print_dict(action)
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
help=_('Name or UUID of the server to list actions for.'),
|
||||
start_version="2.0", end_version="2.20")
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
help=_('Name or UUID of the server to list actions for. Only UUID can be '
|
||||
|
@ -14,20 +14,20 @@
|
||||
# under the License.
|
||||
|
||||
from novaclient.i18n import _
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient import utils
|
||||
from novaclient.v2 import shell
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'host',
|
||||
metavar='<host>',
|
||||
help=_('Name of host.'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'action',
|
||||
metavar='<action>',
|
||||
choices=['set', 'delete'],
|
||||
help=_("Actions: 'set' or 'delete'"))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'metadata',
|
||||
metavar='<key=value>',
|
||||
nargs='+',
|
||||
|
@ -19,7 +19,6 @@ from six.moves.urllib import parse
|
||||
from novaclient import api_versions
|
||||
from novaclient import base
|
||||
from novaclient.i18n import _
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient import utils
|
||||
|
||||
|
||||
@ -55,17 +54,17 @@ class MigrationManager(base.ManagerWithFind):
|
||||
return self._list("/os-migrations%s" % query_string, "migrations")
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--host',
|
||||
dest='host',
|
||||
metavar='<host>',
|
||||
help=_('Fetch migrations for the given host.'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--status',
|
||||
dest='status',
|
||||
metavar='<status>',
|
||||
help=_('Fetch migrations for the given status.'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'--cell_name',
|
||||
dest='cell_name',
|
||||
metavar='<cell_name>',
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
from novaclient import base
|
||||
from novaclient.i18n import _
|
||||
from novaclient.openstack.common import cliutils
|
||||
from novaclient import utils
|
||||
|
||||
|
||||
@ -52,7 +51,7 @@ class TenantNetworkManager(base.ManagerWithFind):
|
||||
return self._create('/os-tenant-networks', body, 'network')
|
||||
|
||||
|
||||
@cliutils.arg('network_id', metavar='<network_id>', help='ID of network')
|
||||
@utils.arg('network_id', metavar='<network_id>', help='ID of network')
|
||||
def do_net(cs, args):
|
||||
"""
|
||||
DEPRECATED, use tenant-network-show instead.
|
||||
@ -60,7 +59,7 @@ def do_net(cs, args):
|
||||
do_tenant_network_show(cs, args)
|
||||
|
||||
|
||||
@cliutils.arg('network_id', metavar='<network_id>', help='ID of network')
|
||||
@utils.arg('network_id', metavar='<network_id>', help='ID of network')
|
||||
def do_tenant_network_show(cs, args):
|
||||
"""
|
||||
Show a tenant network.
|
||||
@ -84,11 +83,11 @@ def do_tenant_network_list(cs, args):
|
||||
utils.print_list(networks, ['ID', 'Label', 'CIDR'])
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'label',
|
||||
metavar='<network_label>',
|
||||
help=_('Network label (ex. my_new_network)'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'cidr',
|
||||
metavar='<cidr>',
|
||||
help=_('IP block to allocate from (ex. 172.16.0.0/24 or 2001:DB8::/64)'))
|
||||
@ -99,11 +98,11 @@ def do_net_create(cs, args):
|
||||
do_tenant_network_create(cs, args)
|
||||
|
||||
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'label',
|
||||
metavar='<network_label>',
|
||||
help=_('Network label (ex. my_new_network)'))
|
||||
@cliutils.arg(
|
||||
@utils.arg(
|
||||
'cidr',
|
||||
metavar='<cidr>',
|
||||
help=_('IP block to allocate from (ex. 172.16.0.0/24 or 2001:DB8::/64)'))
|
||||
@ -115,7 +114,7 @@ def do_tenant_network_create(cs, args):
|
||||
utils.print_dict(network._info)
|
||||
|
||||
|
||||
@cliutils.arg('network_id', metavar='<network_id>', help='ID of network')
|
||||
@utils.arg('network_id', metavar='<network_id>', help='ID of network')
|
||||
def do_net_delete(cs, args):
|
||||
"""
|
||||
DEPRECATED, use tenant-network-delete instead.
|
||||
@ -123,7 +122,7 @@ def do_net_delete(cs, args):
|
||||
do_tenant_network_delete(cs, args)
|
||||
|
||||
|
||||
@cliutils.arg('network_id', metavar='<network_id>', help='ID of network')
|
||||
@utils.arg('network_id', metavar='<network_id>', help='ID of network')
|
||||
def do_tenant_network_delete(cs, args):
|
||||
"""
|
||||
Delete a tenant network.
|
||||
|
Loading…
x
Reference in New Issue
Block a user