From 5fdd0730c88b7a3f65b728c0ea87bb34cbc1d9c4 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Fri, 8 Dec 2017 22:52:59 +0000 Subject: Allow ports filtering with device_id Right now, if a neutron port is owned by a container powered by Kuryr, there is no way to list and filter those ports because OSC assumed a neutron port is owned by either a server or router. This patch adds support for that by introducing an option '--device-id' to the 'port list' command. Change-Id: Ib1fd27e8d843a99fb02ccabd8a12a24ac27cec9c --- openstackclient/network/v2/port.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'openstackclient/network') diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py index 21f30c41..032e1787 100644 --- a/openstackclient/network/v2/port.py +++ b/openstackclient/network/v2/port.py @@ -499,6 +499,11 @@ class ListPort(command.Lister): metavar='', help=_("List only ports attached to this server (name or ID)"), ) + device_group.add_argument( + '--device-id', + metavar='', + help=_("List only ports with the specified device ID") + ) parser.add_argument( '--mac-address', metavar='', @@ -553,6 +558,8 @@ class ListPort(command.Lister): column_headers += ('Security Groups', 'Device Owner', 'Tags') if parsed_args.device_owner is not None: filters['device_owner'] = parsed_args.device_owner + if parsed_args.device_id is not None: + filters['device_id'] = parsed_args.device_id if parsed_args.router: _router = network_client.find_router(parsed_args.router, ignore_missing=False) -- cgit v1.2.1