Skip to content

Commit bffc98e

Browse files
author
Dean Troyer
committed
Fix server create with nova-net
A Neutron-ism slipped by in server create. Change-Id: Id590d7f93df2a41d7bd7617459a2af159a6f8071
1 parent 0a0bcbb commit bffc98e

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

openstackclient/compute/v2/server.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,9 @@ def take_action(self, parsed_args):
655655
nic_info["port-id"] = port.id
656656
else:
657657
if nic_info["net-id"]:
658-
nic_info["net-id"] = utils.find_resource(
659-
compute_client.networks,
658+
nic_info["net-id"] = compute_client.api.network_find(
660659
nic_info["net-id"]
661-
).id
660+
)['id']
662661
if nic_info["port-id"]:
663662
msg = _("can't create server with port specified "
664663
"since network endpoint not enabled")

openstackclient/tests/functional/compute/v2/test_server.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,20 @@ def test_server_attach_detach_floating_ip(self):
207207
'floating ip create -f json ' +
208208
'public'
209209
))
210-
floating_ip = cmd_output['floating_ip_address']
210+
211+
# Look for Neutron value first, then nova-net
212+
floating_ip = cmd_output.get(
213+
'floating_ip_address',
214+
cmd_output.get(
215+
'ip',
216+
None,
217+
),
218+
)
211219
self.assertNotEqual('', cmd_output['id'])
212220
self.assertNotEqual('', floating_ip)
213221
self.addCleanup(
214222
self.openstack,
215-
'floating ip delete ' + cmd_output['id']
223+
'floating ip delete ' + str(cmd_output['id'])
216224
)
217225

218226
raw_output = self.openstack(

0 commit comments

Comments
 (0)