Remove deprecated fixedip/floatingip/virtual interface CLIs/APIs

The add-fixed-ip, remove-fixed-ip, floating-ip-associate,
floating-ip-disassociate, and virtual-interface-list CLIs
and related python API bindings were deprecated in the 9.0.0
release in Pike via change Ie76283962c375b735f30ccb3053db07cf2330de2.
This removes the CLIs and related python API bindings and will go
into the 10.0.0 release.

Change-Id: Icb667973c65d26395db660b1c7b919550db66d08
This commit is contained in:
Matt Riedemann 2018-01-11 17:19:48 -05:00
parent 1d88717e75
commit 01fb16533b
8 changed files with 16 additions and 398 deletions

View File

@ -704,13 +704,6 @@ class FakeSessionClient(base_client.SessionClient):
assert 'flavorRef' in body[action]
elif action in cls.none_actions:
assert body[action] is None
elif action == 'addFixedIp':
assert list(body[action]) == ['networkId']
elif action in ['removeFixedIp', 'removeFloatingIp']:
assert list(body[action]) == ['address']
elif action == 'addFloatingIp':
assert (list(body[action]) == ['address'] or
sorted(list(body[action])) == ['address', 'fixed_address'])
elif action == 'changePassword':
assert list(body[action]) == ['adminPass']
elif action in cls.type_actions:
@ -1134,14 +1127,6 @@ class FakeSessionClient(base_client.SessionClient):
r = {'keypair': self.get_os_keypairs()[2]['keypairs'][0]['keypair']}
return (202, {}, r)
#
# Virtual Interfaces
#
def get_servers_1234_os_virtual_interfaces(self, **kw):
return (200, {}, {"virtual_interfaces": [
{'id': 'fakeid', 'mac_address': 'fakemac'}
]})
#
# Quotas
#

View File

@ -20,7 +20,6 @@ import mock
import six
from novaclient import api_versions
from novaclient import base
from novaclient import exceptions
from novaclient.tests.unit.fixture_data import client
from novaclient.tests.unit.fixture_data import floatingips
@ -30,21 +29,6 @@ from novaclient.tests.unit.v2 import fakes
from novaclient.v2 import servers
class _FloatingIPManager(base.Manager):
resource_class = base.Resource
@api_versions.deprecated_after('2.35')
def list(self):
"""DEPRECATED: List floating IPs"""
return self._list("/os-floating-ips", "floating_ips")
@api_versions.deprecated_after('2.35')
def get(self, floating_ip):
"""DEPRECATED: Retrieve a floating IP"""
return self._get("/os-floating-ips/%s" % base.getid(floating_ip),
"floating_ip")
class ServersTest(utils.FixturedTestCase):
client_fixture_class = client.V1
@ -56,7 +40,6 @@ class ServersTest(utils.FixturedTestCase):
self.useFixture(floatingips.FloatingFixture(self.requests_mock))
if self.api_version:
self.cs.api_version = api_versions.APIVersion(self.api_version)
self.floating_ips = _FloatingIPManager(self.cs)
def _get_server_create_default_nics(self):
"""Callback for default nics kwarg when creating a server.
@ -567,81 +550,6 @@ class ServersTest(utils.FixturedTestCase):
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
@mock.patch('warnings.warn')
def test_add_fixed_ip(self, mock_warn):
s = self.cs.servers.get(1234)
fip = s.add_fixed_ip(1)
mock_warn.assert_called_once()
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
fip = self.cs.servers.add_fixed_ip(s, 1)
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
@mock.patch('warnings.warn')
def test_remove_fixed_ip(self, mock_warn):
s = self.cs.servers.get(1234)
ret = s.remove_fixed_ip('10.0.0.1')
mock_warn.assert_called_once()
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
ret = self.cs.servers.remove_fixed_ip(s, '10.0.0.1')
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
@mock.patch('warnings.warn')
def test_add_floating_ip(self, mock_warn):
s = self.cs.servers.get(1234)
fip = s.add_floating_ip('11.0.0.1')
mock_warn.assert_called_once()
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
fip = self.cs.servers.add_floating_ip(s, '11.0.0.1')
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
f = self.floating_ips.list()[0]
fip = self.cs.servers.add_floating_ip(s, f)
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
fip = s.add_floating_ip(f)
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
def test_add_floating_ip_to_fixed(self):
s = self.cs.servers.get(1234)
fip = s.add_floating_ip('11.0.0.1', fixed_address='12.0.0.1')
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
fip = self.cs.servers.add_floating_ip(s, '11.0.0.1',
fixed_address='12.0.0.1')
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
f = self.floating_ips.list()[0]
fip = self.cs.servers.add_floating_ip(s, f)
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
fip = s.add_floating_ip(f)
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
@mock.patch('warnings.warn')
def test_remove_floating_ip(self, mock_warn):
s = self.cs.servers.get(1234)
ret = s.remove_floating_ip('11.0.0.1')
mock_warn.assert_called_once()
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
ret = self.cs.servers.remove_floating_ip(s, '11.0.0.1')
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
f = self.floating_ips.list()[0]
ret = self.cs.servers.remove_floating_ip(s, f)
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
ret = s.remove_floating_ip(f)
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
def test_stop(self):
s = self.cs.servers.get(1234)
ret = s.stop()
@ -1421,18 +1329,6 @@ class ServersV2_37Test(ServersV226Test):
self.assert_called('POST', '/servers')
self.assertIsInstance(s, servers.Server)
def test_add_floating_ip(self):
# self.floating_ips.list() is not available after 2.35
pass
def test_add_floating_ip_to_fixed(self):
# self.floating_ips.list() is not available after 2.35
pass
def test_remove_floating_ip(self):
# self.floating_ips.list() is not available after 2.35
pass
class ServersCreateImageBackupV2_45Test(utils.FixturedTestCase):
"""Tests the 2.45 microversion for createImage and createBackup

View File

@ -1858,22 +1858,6 @@ class ShellTest(utils.TestCase):
self.assert_called('DELETE', '/servers/uuid1/metadata/key1', pos=1)
self.assert_called('DELETE', '/servers/uuid2/metadata/key1', pos=2)
def test_server_floating_ip_associate(self):
_, err = self.run_command(
'floating-ip-associate sample-server 11.0.0.1')
self.assertIn('WARNING: Command floating-ip-associate is deprecated',
err)
self.assert_called('POST', '/servers/1234/action',
{'addFloatingIp': {'address': '11.0.0.1'}})
def test_server_floating_ip_disassociate(self):
_, err = self.run_command(
'floating-ip-disassociate sample-server 11.0.0.1')
self.assertIn(
'WARNING: Command floating-ip-disassociate is deprecated', err)
self.assert_called('POST', '/servers/1234/action',
{'removeFloatingIp': {'address': '11.0.0.1'}})
def test_usage_list(self):
cmd = 'usage-list --start 2000-01-20 --end 2005-02-01'
stdout, _stderr = self.run_command(cmd)
@ -2708,18 +2692,6 @@ class ShellTest(utils.TestCase):
'PUT', '/os-quota-class-sets/97f4c221bff44578b0300df4ef119353',
body)
def test_add_fixed_ip(self):
_, err = self.run_command('add-fixed-ip sample-server 1')
self.assertIn('WARNING: Command add-fixed-ip is deprecated', err)
self.assert_called('POST', '/servers/1234/action',
{'addFixedIp': {'networkId': '1'}})
def test_remove_fixed_ip(self):
_, err = self.run_command('remove-fixed-ip sample-server 10.0.0.10')
self.assertIn('WARNING: Command remove-fixed-ip is deprecated', err)
self.assert_called('POST', '/servers/1234/action',
{'removeFixedIp': {'address': '10.0.0.10'}})
def test_backup(self):
out, err = self.run_command('backup sample-server back1 daily 1')
# With microversion < 2.45 there is no output from this command.
@ -3125,12 +3097,6 @@ class ShellTest(utils.TestCase):
self.run_command('server-group-list --limit 20 --offset 5')
self.assert_called('GET', '/os-server-groups?limit=20&offset=5')
def test_list_server_os_virtual_interfaces(self):
_, err = self.run_command('virtual-interface-list 1234')
self.assertIn('WARNING: Command virtual-interface-list is deprecated',
err)
self.assert_called('GET', '/servers/1234/os-virtual-interfaces')
def test_versions(self):
exclusions = set([
1, # Same as version 2.0
@ -3139,6 +3105,7 @@ class ShellTest(utils.TestCase):
5, # doesn't require any changes in novaclient
7, # doesn't require any changes in novaclient
9, # doesn't require any changes in novaclient
12, # no longer supported
15, # doesn't require any changes in novaclient
16, # doesn't require any changes in novaclient
18, # NOTE(andreykurilin): this microversion requires changes in

View File

@ -43,7 +43,6 @@ from novaclient.v2 import servers
from novaclient.v2 import services
from novaclient.v2 import usage
from novaclient.v2 import versions
from novaclient.v2 import virtual_interfaces
from novaclient.v2 import volumes
@ -152,8 +151,6 @@ class Client(object):
self.quota_classes = quota_classes.QuotaClassSetManager(self)
self.quotas = quotas.QuotaSetManager(self)
self.usage = usage.UsageManager(self)
self.virtual_interfaces = \
virtual_interfaces.VirtualInterfaceManager(self)
self.aggregates = aggregates.AggregateManager(self)
self.hypervisors = hypervisors.HypervisorManager(self)
self.hypervisor_stats = hypervisors.HypervisorStatsManager(self)

View File

@ -20,7 +20,6 @@ Server interface.
"""
import base64
import warnings
from oslo_utils import encodeutils
import six
@ -52,12 +51,6 @@ CONSOLE_TYPE_PROTOCOL_MAPPING = {
'webmks': 'mks'
}
ADD_REMOVE_FIXED_FLOATING_DEPRECATION_WARNING = _(
'The %s server action API is deprecated as of the 2.44 microversion. This '
'API binding will be removed in the first major release after the Nova '
'16.0.0 Pike release. Use python-neutronclient or openstacksdk instead.'
)
class Server(base.Resource):
HUMAN_ID = True
@ -172,35 +165,6 @@ class Server(base.Resource):
"""
return self.manager.clear_password(self)
def add_fixed_ip(self, network_id):
"""
Add an IP address on a network.
:param network_id: The ID of the network the IP should be on.
:returns: An instance of novaclient.base.TupleWithMeta
"""
return self.manager.add_fixed_ip(self, network_id)
def add_floating_ip(self, address, fixed_address=None):
"""
Add floating IP to an instance
:param address: The IP address or FloatingIP to add to the instance
:param fixed_address: The fixedIP address the FloatingIP is to be
associated with (optional)
:returns: An instance of novaclient.base.TupleWithMeta
"""
return self.manager.add_floating_ip(self, address, fixed_address)
def remove_floating_ip(self, address):
"""
Remove floating IP from an instance
:param address: The IP address or FloatingIP to remove
:returns: An instance of novaclient.base.TupleWithMeta
"""
return self.manager.remove_floating_ip(self, address)
def stop(self):
"""
Stop -- Stop the running server.
@ -346,15 +310,6 @@ class Server(base.Resource):
"""
return self.manager.migrate(self, host=host)
def remove_fixed_ip(self, address):
"""
Remove an IP address.
:param address: The IP address to remove.
:returns: An instance of novaclient.base.TupleWithMeta
"""
return self.manager.remove_fixed_ip(self, address)
def change_password(self, password):
"""
Update the admin password for a server.
@ -902,69 +857,6 @@ class ServerManager(base.BootingManagerWithFind):
marker = result[-1].id
return result
@api_versions.wraps('2.0', '2.43')
def add_fixed_ip(self, server, network_id):
"""
DEPRECATED Add an IP address on a network.
:param server: The :class:`Server` (or its ID) to add an IP to.
:param network_id: The ID of the network the IP should be on.
:returns: An instance of novaclient.base.TupleWithMeta
"""
warnings.warn(ADD_REMOVE_FIXED_FLOATING_DEPRECATION_WARNING %
'addFixedIP', DeprecationWarning)
return self._action('addFixedIp', server, {'networkId': network_id})
@api_versions.wraps('2.0', '2.43')
def remove_fixed_ip(self, server, address):
"""
DEPRECATED Remove an IP address.
:param server: The :class:`Server` (or its ID) to add an IP to.
:param address: The IP address to remove.
:returns: An instance of novaclient.base.TupleWithMeta
"""
warnings.warn(ADD_REMOVE_FIXED_FLOATING_DEPRECATION_WARNING %
'removeFixedIP', DeprecationWarning)
return self._action('removeFixedIp', server, {'address': address})
@api_versions.wraps('2.0', '2.43')
def add_floating_ip(self, server, address, fixed_address=None):
"""
DEPRECATED Add a floating IP to an instance
:param server: The :class:`Server` (or its ID) to add an IP to.
:param address: The FloatingIP or string floating address to add.
:param fixed_address: The FixedIP the floatingIP should be
associated with (optional)
:returns: An instance of novaclient.base.TupleWithMeta
"""
warnings.warn(ADD_REMOVE_FIXED_FLOATING_DEPRECATION_WARNING %
'addFloatingIP', DeprecationWarning)
address = address.ip if hasattr(address, 'ip') else address
if fixed_address:
if hasattr(fixed_address, 'ip'):
fixed_address = fixed_address.ip
return self._action('addFloatingIp', server,
{'address': address,
'fixed_address': fixed_address})
else:
return self._action('addFloatingIp', server, {'address': address})
@api_versions.wraps('2.0', '2.43')
def remove_floating_ip(self, server, address):
"""
DEPRECATED Remove a floating IP address.
:param server: The :class:`Server` (or its ID) to remove an IP from.
:param address: The FloatingIP or string floating address to remove.
:returns: An instance of novaclient.base.TupleWithMeta
"""
warnings.warn(ADD_REMOVE_FIXED_FLOATING_DEPRECATION_WARNING %
'removeFloatingIP', DeprecationWarning)
address = address.ip if hasattr(address, 'ip') else address
return self._action('removeFloatingIp', server, {'address': address})
def get_vnc_console(self, server, console_type):
"""
Get a vnc console for an instance

View File

@ -49,17 +49,6 @@ from novaclient.v2 import servers
logger = logging.getLogger(__name__)
# NOTE(mriedem): Remove this along with the deprecated commands in the first
# major python-novaclient release AFTER the nova server 16.0.0 Pike release.
def emit_fixed_floating_deprecation_warning(command_name):
print(_('WARNING: Command %s is deprecated and will be removed '
'in the first major release after the Nova server 16.0.0 '
'Pike release. Use python-neutronclient or python-openstackclient'
'instead. Specify --os-compute-api-version less than 2.44 '
'to continue using this command until it is removed.') %
command_name, file=sys.stderr)
def emit_duplicated_image_with_warning(img, image_with):
img_uuid_list = [str(image.id) for image in img]
print(_('WARNING: Multiple matching images: %(img_uuid_list)s\n'
@ -2338,27 +2327,6 @@ def _find_network_id(cs, net_name):
raise exceptions.CommandError(six.text_type(e))
@utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
@utils.arg(
'network_id',
metavar='<network-id>',
help=_('Network ID.'))
def do_add_fixed_ip(cs, args):
"""DEPRECATED Add new IP address on a network to server."""
emit_fixed_floating_deprecation_warning('add-fixed-ip')
server = _find_server(cs, args.server)
server.add_fixed_ip(args.network_id)
@utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
@utils.arg('address', metavar='<address>', help=_('IP Address.'))
def do_remove_fixed_ip(cs, args):
"""DEPRECATED Remove an IP address from a server."""
emit_fixed_floating_deprecation_warning('remove-fixed-ip')
server = _find_server(cs, args.server)
server.remove_fixed_ip(args.address)
def _print_volume(volume):
utils.print_dict(volume.to_dict())
@ -2596,37 +2564,6 @@ def do_console_log(cs, args):
print(data)
@utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
@utils.arg('address', metavar='<address>', help=_('IP Address.'))
@utils.arg(
'--fixed-address',
metavar='<fixed_address>',
default=None,
help=_('Fixed IP Address to associate with.'))
def do_floating_ip_associate(cs, args):
"""DEPRECATED Associate a floating IP address to a server."""
emit_fixed_floating_deprecation_warning('floating-ip-associate')
_associate_floating_ip(cs, args)
def _associate_floating_ip(cs, args):
server = _find_server(cs, args.server)
server.add_floating_ip(args.address, args.fixed_address)
@utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
@utils.arg('address', metavar='<address>', help=_('IP Address.'))
def do_floating_ip_disassociate(cs, args):
"""DEPRECATED Disassociate a floating IP address from a server."""
emit_fixed_floating_deprecation_warning('floating-ip-disassociate')
_disassociate_floating_ip(cs, args)
def _disassociate_floating_ip(cs, args):
server = _find_server(cs, args.server)
server.remove_floating_ip(args.address)
@utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
@utils.arg(
'secgroup',
@ -4582,33 +4519,6 @@ def do_version_list(cs, args):
utils.print_list(result, columns)
@api_versions.wraps("2.0", "2.11")
def _print_virtual_interface_list(cs, interface_list):
columns = ['Id', 'Mac address']
utils.print_list(interface_list, columns)
@api_versions.wraps("2.12")
def _print_virtual_interface_list(cs, interface_list):
columns = ['Id', 'Mac address', 'Network ID']
formatters = {"Network ID": lambda o: o.net_id}
utils.print_list(interface_list, columns, formatters)
@utils.arg('server', metavar='<server>', help=_('ID of server.'))
def do_virtual_interface_list(cs, args):
"""DEPRECATED Show virtual interface info about the given server."""
print(_('WARNING: Command virtual-interface-list is deprecated and will '
'be removed in the first major release after the Nova server '
'16.0.0 Pike release. There is no replacement or alternative for '
'this command. Specify --os-compute-api-version less than 2.44 '
'to continue using this command until it is removed.'),
file=sys.stderr)
server = _find_server(cs, args.server)
interface_list = cs.virtual_interfaces.list(base.getid(server))
_print_virtual_interface_list(cs, interface_list)
@api_versions.wraps("2.26")
@utils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
def do_server_tag_list(cs, args):

View File

@ -1,44 +0,0 @@
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
DEPRECATED Virtual Interfaces
"""
import warnings
from novaclient import api_versions
from novaclient import base
from novaclient.i18n import _
class VirtualInterface(base.Resource):
def __repr__(self):
return "<VirtualInterface>"
class VirtualInterfaceManager(base.ManagerWithFind):
"""DEPRECATED"""
resource_class = VirtualInterface
@api_versions.wraps('2.0', '2.43')
def list(self, instance_id):
"""DEPRECATED"""
warnings.warn(_('The os-virtual-interfaces API is deprecated. This '
'API binding will be removed in the first major '
'release after the Nova server 16.0.0 Pike release.'),
DeprecationWarning)
return self._list('/servers/%s/os-virtual-interfaces' % instance_id,
'virtual_interfaces')

View File

@ -0,0 +1,15 @@
---
upgrade:
- |
The following CLIs and their backing API bindings were deprecated and
capped at microversion 2.44:
* ``nova add-fixed-ip``: use python-neutronclient or openstacksdk
* ``nova remove-fixed-ip``: use python-neutronclient or openstacksdk
* ``nova floating-ip-associate``: use python-neutronclient or openstacksdk
* ``nova floating-ip-disassociate``: use python-neutronclient or
openstacksdk
* ``nova virtual-interface-list``: there is no replacement as this is
only implemented for nova-network which is deprecated
The CLIs and API bindings have now been removed.