summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Riedemann <mriedem.os@gmail.com>2017-04-25 16:24:50 -0400
committerMatt Riedemann <mriedem.os@gmail.com>2017-04-25 21:11:47 -0400
commite303cf11bf6c8652edf13caa0ddf238103ea8601 (patch)
tree2ac922969fa254fde0b34d65c005447a3de3a6ca
parentea3b9f7fef28a7f06b51a3b176c85a1fc33cecaa (diff)
downloadpython-novaclient-e303cf11bf6c8652edf13caa0ddf238103ea8601.tar.gz
2.44: Deprecate multinic/floatingIP actions and os-virtual-interfaces
The 2.44 microversion deprecates the addFixedIP, removeFixedIP, addFloatingIP, removeFloatingIP server action APIs and os-virtual-interfaces API. This change deprecates the CLIs and python API bindings in novaclient. Implements blueprint deprecate-multinic-proxy-api Change-Id: Ie76283962c375b735f30ccb3053db07cf2330de2
-rw-r--r--novaclient/__init__.py2
-rw-r--r--novaclient/tests/unit/v2/test_servers.py16
-rw-r--r--novaclient/tests/unit/v2/test_shell.py21
-rw-r--r--novaclient/v2/servers.py29
-rw-r--r--novaclient/v2/shell.py31
-rw-r--r--novaclient/v2/virtual_interfaces.py13
-rw-r--r--releasenotes/notes/microversion-v2_44-d60c8834e436ad3d.yaml16
7 files changed, 106 insertions, 22 deletions
diff --git a/novaclient/__init__.py b/novaclient/__init__.py
index 61377cca..c8e96098 100644
--- a/novaclient/__init__.py
+++ b/novaclient/__init__.py
@@ -25,4 +25,4 @@ API_MIN_VERSION = api_versions.APIVersion("2.1")
# when client supported the max version, and bumped sequentially, otherwise
# the client may break due to server side new version may include some
# backward incompatible change.
-API_MAX_VERSION = api_versions.APIVersion("2.43")
+API_MAX_VERSION = api_versions.APIVersion("2.44")
diff --git a/novaclient/tests/unit/v2/test_servers.py b/novaclient/tests/unit/v2/test_servers.py
index 3bb22bfb..a68adeed 100644
--- a/novaclient/tests/unit/v2/test_servers.py
+++ b/novaclient/tests/unit/v2/test_servers.py
@@ -556,27 +556,33 @@ class ServersTest(utils.FixturedTestCase):
self.assert_request_id(ret, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
- def test_add_fixed_ip(self):
+ @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')
- def test_remove_fixed_ip(self):
+ @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')
- def test_add_floating_ip(self):
+ @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')
@@ -607,9 +613,11 @@ class ServersTest(utils.FixturedTestCase):
self.assert_request_id(fip, fakes.FAKE_REQUEST_ID_LIST)
self.assert_called('POST', '/servers/1234/action')
- def test_remove_floating_ip(self):
+ @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')
diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py
index dbf7e5cb..c9346e50 100644
--- a/novaclient/tests/unit/v2/test_shell.py
+++ b/novaclient/tests/unit/v2/test_shell.py
@@ -1671,12 +1671,18 @@ class ShellTest(utils.TestCase):
self.assert_called('DELETE', '/servers/uuid2/metadata/key1', pos=2)
def test_server_floating_ip_associate(self):
- self.run_command('floating-ip-associate sample-server 11.0.0.1')
+ _, 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):
- self.run_command('floating-ip-disassociate sample-server 11.0.0.1')
+ _, 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'}})
@@ -2500,12 +2506,14 @@ class ShellTest(utils.TestCase):
self.assert_called('PUT', '/os-cloudpipe/configure-project', body)
def test_add_fixed_ip(self):
- self.run_command('add-fixed-ip sample-server 1')
+ _, 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):
- self.run_command('remove-fixed-ip sample-server 10.0.0.10')
+ _, 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'}})
@@ -2867,7 +2875,9 @@ class ShellTest(utils.TestCase):
self.assert_called('GET', '/os-server-groups?limit=20&offset=5')
def test_list_server_os_virtual_interfaces(self):
- self.run_command('virtual-interface-list 1234')
+ _, 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):
@@ -2903,6 +2913,7 @@ class ShellTest(utils.TestCase):
41, # There are no version-wrapped shell method changes for this.
42, # There are no version-wrapped shell method changes for this.
43, # There are no version-wrapped shell method changes for this.
+ 44, # There are no version-wrapped shell method changes for this.
])
versions_supported = set(range(0,
novaclient.API_MAX_VERSION.ver_minor + 1))
diff --git a/novaclient/v2/servers.py b/novaclient/v2/servers.py
index ea05acd5..cd328f9c 100644
--- a/novaclient/v2/servers.py
+++ b/novaclient/v2/servers.py
@@ -20,6 +20,7 @@ Server interface.
"""
import base64
+import warnings
from oslo_utils import encodeutils
import six
@@ -51,6 +52,12 @@ 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
@@ -871,29 +878,36 @@ 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):
"""
- Add an IP address on a network.
+ 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):
"""
- Remove an IP 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):
"""
- Add a floating IP to an instance
+ 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.
@@ -901,7 +915,8 @@ class ServerManager(base.BootingManagerWithFind):
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'):
@@ -912,15 +927,17 @@ class ServerManager(base.BootingManagerWithFind):
else:
return self._action('addFloatingIp', server, {'address': address})
+ @api_versions.wraps('2.0', '2.43')
def remove_floating_ip(self, server, address):
"""
- Remove a floating IP 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})
diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py
index 8fa29a30..4df02f88 100644
--- a/novaclient/v2/shell.py
+++ b/novaclient/v2/shell.py
@@ -75,6 +75,17 @@ def emit_hosts_deprecation_warning(command_name, replacement=None):
file=sys.stderr)
+# 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)
+
+
CLIENT_BDM2_KEYS = {
'id': 'uuid',
'source': 'source_type',
@@ -2200,7 +2211,8 @@ def _find_network_id(cs, net_name):
metavar='<network-id>',
help=_('Network ID.'))
def do_add_fixed_ip(cs, args):
- """Add new IP address on a network to server."""
+ """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)
@@ -2208,7 +2220,8 @@ def do_add_fixed_ip(cs, args):
@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):
- """Remove an IP address from a server."""
+ """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)
@@ -2442,7 +2455,8 @@ def do_console_log(cs, args):
default=None,
help=_('Fixed IP Address to associate with.'))
def do_floating_ip_associate(cs, args):
- """Associate a floating IP address to a server."""
+ """DEPRECATED Associate a floating IP address to a server."""
+ emit_fixed_floating_deprecation_warning('floating-ip-associate')
_associate_floating_ip(cs, args)
@@ -2454,7 +2468,8 @@ def _associate_floating_ip(cs, args):
@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):
- """Disassociate a floating IP address from a server."""
+ """DEPRECATED Disassociate a floating IP address from a server."""
+ emit_fixed_floating_deprecation_warning('floating-ip-disassociate')
_disassociate_floating_ip(cs, args)
@@ -4473,7 +4488,13 @@ def _print_virtual_interface_list(cs, interface_list):
@utils.arg('server', metavar='<server>', help=_('ID of server.'))
def do_virtual_interface_list(cs, args):
- """Show virtual interface info about the given server."""
+ """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)
diff --git a/novaclient/v2/virtual_interfaces.py b/novaclient/v2/virtual_interfaces.py
index c2a0adf4..88cd001f 100644
--- a/novaclient/v2/virtual_interfaces.py
+++ b/novaclient/v2/virtual_interfaces.py
@@ -14,10 +14,14 @@
# under the License.
"""
-Virtual Interfaces (1.1 extension).
+DEPRECATED Virtual Interfaces (1.1 extension).
"""
+import warnings
+
+from novaclient import api_versions
from novaclient import base
+from novaclient.i18n import _
class VirtualInterface(base.Resource):
@@ -26,8 +30,15 @@ class VirtualInterface(base.Resource):
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')
diff --git a/releasenotes/notes/microversion-v2_44-d60c8834e436ad3d.yaml b/releasenotes/notes/microversion-v2_44-d60c8834e436ad3d.yaml
new file mode 100644
index 00000000..2ac1b3b0
--- /dev/null
+++ b/releasenotes/notes/microversion-v2_44-d60c8834e436ad3d.yaml
@@ -0,0 +1,16 @@
+---
+deprecations:
+ - |
+ The following CLIs and their backing API bindings are 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 will be removed in the first major release after
+ Nova 16.0.0 Pike is released.