From 307d23bb58f0f44c9b9facdeaaa10227748ef50d Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Tue, 16 Jun 2020 15:31:26 -0400 Subject: port: add --host to list command This adds an option to allow filtering ports bound to a specific host when listing them. Change-Id: I747ed0f8b070074c51789576a158345f670fe733 --- openstackclient/network/v2/port.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'openstackclient/network/v2') diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py index a22bcafb..4011f5f0 100644 --- a/openstackclient/network/v2/port.py +++ b/openstackclient/network/v2/port.py @@ -515,6 +515,10 @@ class ListPort(command.Lister): "This is the entity that uses the port (for example, " "network:dhcp).") ) + parser.add_argument( + '--host', + metavar='', + help=_("List only ports bound to this host ID")) parser.add_argument( '--network', metavar='', @@ -603,6 +607,8 @@ class ListPort(command.Lister): server = utils.find_resource(compute_client.servers, parsed_args.server) filters['device_id'] = server.id + if parsed_args.host: + filters['binding:host_id'] = parsed_args.host if parsed_args.network: network = network_client.find_network(parsed_args.network, ignore_missing=False) -- cgit v1.2.1