aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common
diff options
context:
space:
mode:
authorShobhi Jain <shobhi.jain@intel.com>2018-03-27 16:47:04 +0100
committerShobhi Jain <shobhi.jain@intel.com>2018-04-23 13:10:03 +0000
commitaded0fdb30caf035e0eb94c1216f436ba597c2c7 (patch)
tree08e0028de88edf88bfd7d8377a18d551d84efde2 /yardstick/common
parentc1ab98526209a761a0565afa7ccd552ba9ac7ade (diff)
Replace nova delete keypair with shade client.
Function delete_keypair now uses shade client. JIRA: YARDSTICK-1088 Change-Id: I46b895748c5c44b0bf7d5b035395676ebff48d7f Signed-off-by: Shobhi Jain <shobhi.jain@intel.com>
Diffstat (limited to 'yardstick/common')
-rw-r--r--yardstick/common/exceptions.py4
-rw-r--r--yardstick/common/openstack_utils.py16
2 files changed, 15 insertions, 5 deletions
diff --git a/yardstick/common/exceptions.py b/yardstick/common/exceptions.py
index 41333c161..734706191 100644
--- a/yardstick/common/exceptions.py
+++ b/yardstick/common/exceptions.py
@@ -186,3 +186,7 @@ class ScenarioDeleteServerError(YardstickException):
class ScenarioCreateKeypairError(YardstickException):
message = 'Nova Create Keypair Scenario failed'
+
+
+class ScenarioDeleteKeypairError(YardstickException):
+ message = 'Nova Delete Keypair Scenario failed'
diff --git a/yardstick/common/openstack_utils.py b/yardstick/common/openstack_utils.py
index e79c98872..0902d29e1 100644
--- a/yardstick/common/openstack_utils.py
+++ b/yardstick/common/openstack_utils.py
@@ -348,12 +348,18 @@ def delete_flavor(flavor_id): # pragma: no cover
return True
-def delete_keypair(nova_client, key): # pragma: no cover
+def delete_keypair(shade_client, name):
+ """Delete a keypair.
+
+ :param name: Name of the keypair to delete.
+
+ :returns: True if delete succeeded, False otherwise.
+ """
try:
- nova_client.keypairs.delete(key=key)
- return True
- except Exception: # pylint: disable=broad-except
- log.exception("Error [delete_keypair(nova_client)]")
+ return shade_client.delete_keypair(name)
+ except exc.OpenStackCloudException as o_exc:
+ log.error("Error [delete_neutron_router(shade_client, '%s')]. "
+ "Exception message: %s", name, o_exc.orig_message)
return False