|
28 | 28 |
|
29 | 29 | from openstackclient import command |
30 | 30 | from openstackclient.i18n import _ |
31 | | -from openstackclient.network import common |
32 | 31 |
|
33 | 32 | LOG = logging.getLogger(__name__) |
34 | 33 |
|
|
63 | 62 | 'volumes', |
64 | 63 | ] |
65 | 64 |
|
66 | | -NOVA_NETWORK_QUOTAS = { |
67 | | - 'fixed_ips': 'fixed-ips', |
68 | | - 'floating_ips': 'floating-ips', |
69 | | - 'security_group_rules': 'secgroup-rules', |
70 | | - 'security_groups': 'secgroups', |
71 | | -} |
72 | | - |
73 | 65 | NETWORK_QUOTAS = { |
74 | 66 | 'floatingip': 'floating-ips', |
75 | 67 | 'security_group_rule': 'secgroup-rules', |
@@ -490,41 +482,20 @@ def take_action( |
490 | 482 | return ((), ()) |
491 | 483 |
|
492 | 484 |
|
493 | | -class SetQuota(common.NetDetectionMixin, command.Command): |
| 485 | +class SetQuota(command.Command): |
494 | 486 | _description = _("Set quotas for project or class") |
495 | 487 |
|
496 | 488 | def _build_options_list(self) -> list[tuple[str, str, str]]: |
497 | 489 | help_fmt = _('New value for the %s quota') |
498 | | - # Compute and volume quota options are always the same |
| 490 | + # Compute volume and network quota options are always the same |
499 | 491 | rets = [ |
500 | 492 | (k, v, help_fmt % v) |
501 | 493 | for k, v in itertools.chain( |
502 | 494 | COMPUTE_QUOTAS.items(), |
503 | 495 | VOLUME_QUOTAS.items(), |
| 496 | + NETWORK_QUOTAS.items(), |
504 | 497 | ) |
505 | 498 | ] |
506 | | - # For docs build, we want to produce helps for both neutron and |
507 | | - # nova-network options. They overlap, so we have to figure out which |
508 | | - # need to be tagged as specific to one network type or the other. |
509 | | - if self.is_docs_build: |
510 | | - # NOTE(efried): This takes advantage of the fact that we know the |
511 | | - # nova-net options are a subset of the neutron options. If that |
512 | | - # ever changes, this algorithm will need to be adjusted accordingly |
513 | | - inv_compute = set(NOVA_NETWORK_QUOTAS.values()) |
514 | | - for k, v in NETWORK_QUOTAS.items(): |
515 | | - _help = help_fmt % v |
516 | | - if v not in inv_compute: |
517 | | - # This one is unique to neutron |
518 | | - _help = self.enhance_help_neutron(_help) |
519 | | - rets.append((k, v, _help)) |
520 | | - elif self.is_neutron: |
521 | | - rets.extend( |
522 | | - [(k, v, help_fmt % v) for k, v in NETWORK_QUOTAS.items()] |
523 | | - ) |
524 | | - elif self.is_nova_network: |
525 | | - rets.extend( |
526 | | - [(k, v, help_fmt % v) for k, v in NOVA_NETWORK_QUOTAS.items()] |
527 | | - ) |
528 | 499 | return rets |
529 | 500 |
|
530 | 501 | def get_parser(self, prog_name: str) -> argparse.ArgumentParser: |
@@ -654,11 +625,6 @@ def take_action(self, parsed_args: argparse.Namespace) -> None: |
654 | 625 | value = getattr(parsed_args, k, None) |
655 | 626 | if value is not None: |
656 | 627 | network_kwargs[k] = value |
657 | | - elif self.app.client_manager.is_compute_endpoint_enabled(): |
658 | | - for k, v in NOVA_NETWORK_QUOTAS.items(): |
659 | | - value = getattr(parsed_args, k, None) |
660 | | - if value is not None: |
661 | | - compute_kwargs[k] = value |
662 | 628 |
|
663 | 629 | if network_kwargs: |
664 | 630 | if parsed_args.force is True: |
@@ -843,7 +809,6 @@ def _normalize_names(section: dict[str, Any]) -> None: |
843 | 809 | # in nova will be replaced by neutron's. |
844 | 810 | for k, v in itertools.chain( |
845 | 811 | COMPUTE_QUOTAS.items(), |
846 | | - NOVA_NETWORK_QUOTAS.items(), |
847 | 812 | VOLUME_QUOTAS.items(), |
848 | 813 | NETWORK_QUOTAS.items(), |
849 | 814 | ): |
|
0 commit comments