diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index 8b4a37217b..60dc605caf 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -655,10 +655,9 @@ class CreateServer(command.ShowOne): nic_info["port-id"] = port.id else: if nic_info["net-id"]: - nic_info["net-id"] = utils.find_resource( - compute_client.networks, + nic_info["net-id"] = compute_client.api.network_find( nic_info["net-id"] - ).id + )['id'] if nic_info["port-id"]: msg = _("can't create server with port specified " "since network endpoint not enabled") diff --git a/openstackclient/tests/functional/compute/v2/test_server.py b/openstackclient/tests/functional/compute/v2/test_server.py index dd257e9a78..76255c69e6 100644 --- a/openstackclient/tests/functional/compute/v2/test_server.py +++ b/openstackclient/tests/functional/compute/v2/test_server.py @@ -207,12 +207,20 @@ class ServerTests(common.ComputeTestCase): 'floating ip create -f json ' + 'public' )) - floating_ip = cmd_output['floating_ip_address'] + + # Look for Neutron value first, then nova-net + floating_ip = cmd_output.get( + 'floating_ip_address', + cmd_output.get( + 'ip', + None, + ), + ) self.assertNotEqual('', cmd_output['id']) self.assertNotEqual('', floating_ip) self.addCleanup( self.openstack, - 'floating ip delete ' + cmd_output['id'] + 'floating ip delete ' + str(cmd_output['id']) ) raw_output = self.openstack(