Skip to content

Commit 70a4da2

Browse files
committed
Remove nova-network support
Most common code shared between networking and compute was removed as it is no longer necessary. Network object delete still remains as we need to handle multiple resource deletion and deal with possible failures. Updated documentation accordingly. Add/remove floating IP via server will only use network endpoint for operations. Removed floating IP pool code as it is deprecated and no longer used. Removed remaining quota code in compute relating to networks as it is deprecated. Removed a number of tests that no longer apply. Change-Id: I3138028f9aac49d5f54fd5c1d2bcd61920e94a1e Signed-off-by: Brian Haley <haleyb.dev@gmail.com>
1 parent faa4d51 commit 70a4da2

27 files changed

Lines changed: 410 additions & 3269 deletions

doc/source/cli/backwards-incompatible.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ from this backwards incompatible change handling.
1616
Backwards Incompatible Changes
1717
==============================
1818

19+
Release 10.0
20+
------------
21+
22+
1. Nova network support was removed from the networking commands.
23+
24+
As Neutron has been the preferred networking solution in
25+
Openstack for close to ten years, the old Nova network
26+
code was finally removed. All networking API calls are still
27+
supported, but they will only use the Neutron API endpoint.
28+
29+
* Commit: https://review.opendev.org/981613
30+
1931
Release 4.0
2032
-----------
2133

doc/source/cli/command-objects/floating-ip-pool.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

doc/source/cli/commands.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ referring to both Compute and Volume quotas.
9999
* ``flavor``: (**Compute**) predefined server configurations: ram, root disk and so on
100100
* ``fixed ip``: (**Compute**) - an internal IP address assigned to a server
101101
* ``floating ip``: (**Network**) - a public IP address that can be mapped to a server
102-
* ``floating ip pool``: (**Network**) - a pool of public IP addresses
103102
* ``group``: (**Identity**) a grouping of users
104103
* ``host``: (**Compute**) - the physical computer running compute services
105104
* ``hypervisor``: (**Compute**) the virtual machine manager

doc/source/contributor/command-errors.rst

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,11 @@ multiple ``delete_network()`` calls.
172172

173173
.. code-block:: python
174174
175-
class DeleteNetwork(common.NetworkAndComputeCommand):
175+
class DeleteNetwork(common.NetworkDelete):
176176
"""Delete network(s)"""
177177
178-
def update_parser_common(self, parser):
178+
def get_parser(self, prog_name):
179+
parser = super().get_parser(prog_name)
179180
parser.add_argument(
180181
'network',
181182
metavar="<network>",
@@ -184,20 +185,7 @@ multiple ``delete_network()`` calls.
184185
)
185186
return parser
186187
187-
def take_action(self, client, parsed_args):
188-
ret = 0
189-
190-
for network in parsed_args.network:
191-
try:
192-
obj = client.find_network(network, ignore_missing=False)
193-
client.delete_network(obj)
194-
except Exception:
195-
LOG.error(_("Failed to delete network with name "
196-
"or ID %s."), network)
197-
ret += 1
198-
199-
if ret > 0:
200-
total = len(parsed_args.network)
201-
msg = (_("Failed to delete %(ret)s of %(total)s networks.")
202-
% {"ret": ret, "total": total})
203-
raise exceptions.CommandError(msg)
188+
def take_action_delete(self, parsed_args):
189+
client = self.app.client_manager.network
190+
obj = client.find_network(network, ignore_missing=False)
191+
client.delete_network(obj)

openstackclient/common/quota.py

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
from openstackclient import command
2929
from openstackclient.i18n import _
30-
from openstackclient.network import common
3130

3231
LOG = logging.getLogger(__name__)
3332

@@ -62,13 +61,6 @@
6261
'volumes',
6362
]
6463

65-
NOVA_NETWORK_QUOTAS = {
66-
'fixed_ips': 'fixed-ips',
67-
'floating_ips': 'floating-ips',
68-
'security_group_rules': 'secgroup-rules',
69-
'security_groups': 'secgroups',
70-
}
71-
7264
NETWORK_QUOTAS = {
7365
'floatingip': 'floating-ips',
7466
'security_group_rule': 'secgroup-rules',
@@ -467,41 +459,20 @@ def take_action(self, parsed_args):
467459
return ((), ())
468460

469461

470-
class SetQuota(common.NetDetectionMixin, command.Command):
462+
class SetQuota(command.Command):
471463
_description = _("Set quotas for project or class")
472464

473465
def _build_options_list(self):
474466
help_fmt = _('New value for the %s quota')
475-
# Compute and volume quota options are always the same
467+
# Compute volume and network quota options are always the same
476468
rets = [
477469
(k, v, help_fmt % v)
478470
for k, v in itertools.chain(
479471
COMPUTE_QUOTAS.items(),
480472
VOLUME_QUOTAS.items(),
473+
NETWORK_QUOTAS.items(),
481474
)
482475
]
483-
# For docs build, we want to produce helps for both neutron and
484-
# nova-network options. They overlap, so we have to figure out which
485-
# need to be tagged as specific to one network type or the other.
486-
if self.is_docs_build:
487-
# NOTE(efried): This takes advantage of the fact that we know the
488-
# nova-net options are a subset of the neutron options. If that
489-
# ever changes, this algorithm will need to be adjusted accordingly
490-
inv_compute = set(NOVA_NETWORK_QUOTAS.values())
491-
for k, v in NETWORK_QUOTAS.items():
492-
_help = help_fmt % v
493-
if v not in inv_compute:
494-
# This one is unique to neutron
495-
_help = self.enhance_help_neutron(_help)
496-
rets.append((k, v, _help))
497-
elif self.is_neutron:
498-
rets.extend(
499-
[(k, v, help_fmt % v) for k, v in NETWORK_QUOTAS.items()]
500-
)
501-
elif self.is_nova_network:
502-
rets.extend(
503-
[(k, v, help_fmt % v) for k, v in NOVA_NETWORK_QUOTAS.items()]
504-
)
505476
return rets
506477

507478
def get_parser(self, prog_name):
@@ -631,11 +602,6 @@ def take_action(self, parsed_args):
631602
value = getattr(parsed_args, k, None)
632603
if value is not None:
633604
network_kwargs[k] = value
634-
elif self.app.client_manager.is_compute_endpoint_enabled():
635-
for k, v in NOVA_NETWORK_QUOTAS.items():
636-
value = getattr(parsed_args, k, None)
637-
if value is not None:
638-
compute_kwargs[k] = value
639605

640606
if network_kwargs:
641607
if parsed_args.force is True:
@@ -818,7 +784,6 @@ def _normalize_names(section: dict) -> None:
818784
# in nova will be replaced by neutron's.
819785
for k, v in itertools.chain(
820786
COMPUTE_QUOTAS.items(),
821-
NOVA_NETWORK_QUOTAS.items(),
822787
VOLUME_QUOTAS.items(),
823788
NETWORK_QUOTAS.items(),
824789
):

openstackclient/compute/v2/server.py

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
from openstackclient.common import pagination
4040
from openstackclient.i18n import _
4141
from openstackclient.identity import common as identity_common
42-
from openstackclient.network import common as network_common
4342

4443
LOG = logging.getLogger(__name__)
4544

@@ -461,12 +460,11 @@ def take_action(
461460
)
462461

463462

464-
class AddFloatingIP(network_common.NetworkAndComputeCommand):
463+
class AddFloatingIP(command.Command):
465464
_description = _("Add floating IP address to server")
466465

467-
def update_parser_common(
468-
self, parser: argparse.ArgumentParser
469-
) -> argparse.ArgumentParser:
466+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
467+
parser = super().get_parser(prog_name)
470468
parser.add_argument(
471469
"server",
472470
metavar="<server>",
@@ -491,9 +489,8 @@ def update_parser_common(
491489
)
492490
return parser
493491

494-
def take_action_network(
495-
self, client: Any, parsed_args: argparse.Namespace
496-
) -> None:
492+
def take_action(self, parsed_args: argparse.Namespace) -> None:
493+
client = self.app.client_manager.network
497494
compute_client = self.app.client_manager.compute
498495

499496
attrs = {}
@@ -552,16 +549,6 @@ def take_action_network(
552549
if error:
553550
raise error
554551

555-
def take_action_compute(
556-
self, client: Any, parsed_args: argparse.Namespace
557-
) -> None:
558-
server = client.find_server(parsed_args.server, ignore_missing=False)
559-
client.add_floating_ip_to_server(
560-
server,
561-
parsed_args.ip_address,
562-
fixed_address=parsed_args.fixed_ip_address,
563-
)
564-
565552

566553
class AddPort(command.Command):
567554
_description = _("Add port to server")
@@ -4069,12 +4056,11 @@ def take_action(self, parsed_args: argparse.Namespace) -> None:
40694056
)
40704057

40714058

4072-
class RemoveFloatingIP(network_common.NetworkAndComputeCommand):
4059+
class RemoveFloatingIP(command.Command):
40734060
_description = _("Remove floating IP address from server")
40744061

4075-
def update_parser_common(
4076-
self, parser: argparse.ArgumentParser
4077-
) -> argparse.ArgumentParser:
4062+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
4063+
parser = super().get_parser(prog_name)
40784064
parser.add_argument(
40794065
"server",
40804066
metavar="<server>",
@@ -4089,22 +4075,15 @@ def update_parser_common(
40894075
)
40904076
return parser
40914077

4092-
def take_action_network(
4093-
self, client: Any, parsed_args: argparse.Namespace
4094-
) -> None:
4078+
def take_action(self, parsed_args: argparse.Namespace) -> None:
4079+
client = self.app.client_manager.network
40954080
obj = client.find_ip(
40964081
parsed_args.ip_address,
40974082
ignore_missing=False,
40984083
)
40994084

41004085
client.update_ip(obj, port_id=None)
41014086

4102-
def take_action_compute(
4103-
self, client: Any, parsed_args: argparse.Namespace
4104-
) -> None:
4105-
server = client.find_server(parsed_args.server, ignore_missing=False)
4106-
client.remove_floating_ip_from_server(server, parsed_args.ip_address)
4107-
41084087

41094088
class RemovePort(command.Command):
41104089
_description = _("Remove port from server")

openstackclient/identity/common.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,17 +437,14 @@ def add_group_domain_option_to_parser(parser: argparse.ArgumentParser) -> None:
437437

438438
def add_project_domain_option_to_parser(
439439
parser: argparse.ArgumentParser,
440-
enhance_help: Callable[[str], str] = lambda _h: _h,
441440
) -> None:
442441
parser.add_argument(
443442
'--project-domain',
444443
metavar='<project-domain>',
445-
help=enhance_help(
446-
_(
447-
'Domain the project belongs to (name or ID). This '
448-
'can be used in case collisions between project '
449-
'names exist.'
450-
)
444+
help=_(
445+
'Domain the project belongs to (name or ID). This '
446+
'can be used in case collisions between project '
447+
'names exist.'
451448
),
452449
)
453450

0 commit comments

Comments
 (0)