diff options
| author | Zuul <zuul@review.openstack.org> | 2018-01-11 21:03:18 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2018-01-11 21:03:18 +0000 |
| commit | 8abf6bf5ba389a0ebbd202d69d0dbf8b64bb30d6 (patch) | |
| tree | cf1de6ec8e717e30658c5ee3449c5170e3102d12 /openstackclient/network | |
| parent | cc47c075a067e3f4f3bb80dd933cdd4d483b8105 (diff) | |
| parent | cf91d7a2f46b4a8546169a4836cc64476fce44d8 (diff) | |
| download | python-openstackclient-8abf6bf5ba389a0ebbd202d69d0dbf8b64bb30d6.tar.gz | |
Merge "Add floating IP qos_policy actions"
Diffstat (limited to 'openstackclient/network')
| -rw-r--r-- | openstackclient/network/v2/floating_ip.py | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/openstackclient/network/v2/floating_ip.py b/openstackclient/network/v2/floating_ip.py index 05b688a6..181f88c0 100644 --- a/openstackclient/network/v2/floating_ip.py +++ b/openstackclient/network/v2/floating_ip.py @@ -67,6 +67,10 @@ def _get_attrs(client_manager, parsed_args): if parsed_args.fixed_ip_address: attrs['fixed_ip_address'] = parsed_args.fixed_ip_address + if parsed_args.qos_policy: + attrs['qos_policy_id'] = network_client.find_qos_policy( + parsed_args.qos_policy, ignore_missing=False).id + if parsed_args.description is not None: attrs['description'] = parsed_args.description @@ -170,6 +174,11 @@ class CreateFloatingIP(common.NetworkAndComputeShowOne): help=_("Fixed IP address mapped to the floating IP") ) parser.add_argument( + '--qos-policy', + metavar='<qos-policy>', + help=_("Attach QoS policy to the floating IP (name or ID)") + ) + parser.add_argument( '--description', metavar='<description>', help=_('Set floating IP description') @@ -462,6 +471,17 @@ class SetFloatingIP(command.Command): help=_("Fixed IP of the port " "(required only if port has multiple IPs)") ) + qos_policy_group = parser.add_mutually_exclusive_group() + qos_policy_group.add_argument( + '--qos-policy', + metavar='<qos-policy>', + help=_("Attach QoS policy to the floating IP (name or ID)") + ) + qos_policy_group.add_argument( + '--no-qos-policy', + action='store_true', + help=_("Remove the QoS policy attached to the floating IP") + ) return parser def take_action(self, parsed_args): @@ -479,6 +499,13 @@ class SetFloatingIP(command.Command): if parsed_args.fixed_ip_address: attrs['fixed_ip_address'] = parsed_args.fixed_ip_address + if parsed_args.qos_policy: + attrs['qos_policy_id'] = client.find_qos_policy( + parsed_args.qos_policy, ignore_missing=False).id + + if 'no_qos_policy' in parsed_args and parsed_args.no_qos_policy: + attrs['qos_policy_id'] = None + client.update_ip(obj, **attrs) @@ -549,6 +576,12 @@ class UnsetFloatingIP(command.Command): default=False, help=_("Disassociate any port associated with the floating IP") ) + parser.add_argument( + '--qos-policy', + action='store_true', + default=False, + help=_("Remove the QoS policy attached to the floating IP") + ) return parser def take_action(self, parsed_args): @@ -559,8 +592,11 @@ class UnsetFloatingIP(command.Command): parsed_args.floating_ip, ignore_missing=False, ) + attrs = {} if parsed_args.port: - attrs = { - 'port_id': None, - } + attrs['port_id'] = None + if parsed_args.qos_policy: + attrs['qos_policy_id'] = None + + if attrs: client.update_ip(obj, **attrs) |
