Use flavors.get when finding with id

flavors.get is more efficient than flavors.find when looking for
falvors with id.

Change-Id: I82a12e5287766d88a815c15a68515b3918a63988
This commit is contained in:
Rabi Mishra
2015-12-23 09:51:05 +05:30
parent 2f8a9993f6
commit 32ddfbfa48
7 changed files with 37 additions and 21 deletions

View File

@@ -231,7 +231,7 @@ class NovaClientPlugin(client_plugin.ClientPlugin):
:returns: the id of :flavor:
"""
try:
return self.client().flavors.find(id=flavor).id
return self.client().flavors.get(flavor).id
except exceptions.NotFound:
return self.client().flavors.find(name=flavor).id

View File

@@ -99,7 +99,7 @@ class TroveClientPlugin(client_plugin.ClientPlugin):
:returns: the id of :flavor:
"""
try:
return self.client().flavors.find(id=flavor).id
return self.client().flavors.get(flavor).id
except exceptions.NotFound:
return self.client().flavors.find(name=flavor).id