diff options
| author | Mohammed Naser <mnaser@vexxhost.com> | 2020-06-16 15:31:26 -0400 |
|---|---|---|
| committer | Mohammed Naser <mnaser@vexxhost.com> | 2020-06-17 16:33:34 +0000 |
| commit | 307d23bb58f0f44c9b9facdeaaa10227748ef50d (patch) | |
| tree | af66fe149e7f1d0fba0c560f69a3e366fc8195e2 /openstackclient/network/v2 | |
| parent | 9754a67d5d1114c44cd917e887e422b28a648465 (diff) | |
| download | python-openstackclient-307d23bb58f0f44c9b9facdeaaa10227748ef50d.tar.gz | |
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
Diffstat (limited to 'openstackclient/network/v2')
| -rw-r--r-- | openstackclient/network/v2/port.py | 6 |
1 files changed, 6 insertions, 0 deletions
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 @@ -516,6 +516,10 @@ class ListPort(command.Lister): "network:dhcp).") ) parser.add_argument( + '--host', + metavar='<host-id>', + help=_("List only ports bound to this host ID")) + parser.add_argument( '--network', metavar='<network>', help=_("List only ports connected to this network (name or ID)")) @@ -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) |
