From f449a0f48c02b7d22a64f9b563b1a593d8269118 Mon Sep 17 00:00:00 2001 From: Abitha Palaniappan Date: Wed, 9 Sep 2015 15:38:39 -0700 Subject: [PATCH] Add support for port-id,port-name to nics in os_server --- cloud/openstack/os_server.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cloud/openstack/os_server.py b/cloud/openstack/os_server.py index a0f97d6ecb8..44481d643f4 100644 --- a/cloud/openstack/os_server.py +++ b/cloud/openstack/os_server.py @@ -262,6 +262,15 @@ def _network_args(module, cloud): msg='Could not find network by net-name: %s' % net['net-name']) args.append({'net-id': by_name['id']}) + elif net.get('port-id'): + args.append(net) + elif net.get('port-name'): + by_name = cloud.get_port(net['port-name']) + if not by_name: + module.fail_json( + msg='Could not find port by port-name: %s' % + net['port-name']) + args.append({'port-id': by_name['id']}) return args