summaryrefslogtreecommitdiff
path: root/openstackclient/network
diff options
context:
space:
mode:
authorHongbin Lu <hongbin.lu@huawei.com>2017-12-08 22:52:59 +0000
committerHongbin Lu <hongbin034@gmail.com>2018-01-03 21:11:02 +0000
commit5fdd0730c88b7a3f65b728c0ea87bb34cbc1d9c4 (patch)
treeaca35b2cc9cb7afb1dcb217bed2f676427d34453 /openstackclient/network
parentb13a323128072f6f56619a816f5be165796171a4 (diff)
downloadpython-openstackclient-5fdd0730c88b7a3f65b728c0ea87bb34cbc1d9c4.tar.gz
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
Diffstat (limited to 'openstackclient/network')
-rw-r--r--openstackclient/network/v2/port.py7
1 files changed, 7 insertions, 0 deletions
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='<server>',
help=_("List only ports attached to this server (name or ID)"),
)
+ device_group.add_argument(
+ '--device-id',
+ metavar='<device-id>',
+ help=_("List only ports with the specified device ID")
+ )
parser.add_argument(
'--mac-address',
metavar='<mac-address>',
@@ -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)