aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/lib/delete_keypair.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/benchmark/scenarios/lib/delete_keypair.py')
-rw-r--r--yardstick/benchmark/scenarios/lib/delete_keypair.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/yardstick/benchmark/scenarios/lib/delete_keypair.py b/yardstick/benchmark/scenarios/lib/delete_keypair.py
index 135139959..a52a38567 100644
--- a/yardstick/benchmark/scenarios/lib/delete_keypair.py
+++ b/yardstick/benchmark/scenarios/lib/delete_keypair.py
@@ -6,14 +6,12 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-
-from __future__ import print_function
-from __future__ import absolute_import
-
import logging
+from yardstick.common import openstack_utils
+from yardstick.common import exceptions
from yardstick.benchmark.scenarios import base
-import yardstick.common.openstack_utils as op_utils
+
LOG = logging.getLogger(__name__)
@@ -26,11 +24,11 @@ class DeleteKeypair(base.Scenario):
def __init__(self, scenario_cfg, context_cfg):
self.scenario_cfg = scenario_cfg
self.context_cfg = context_cfg
- self.options = self.scenario_cfg['options']
+ self.options = self.scenario_cfg["options"]
- self.key_name = self.options.get("key_name", "yardstick_key")
+ self.key_name = self.options["key_name"]
- self.nova_client = op_utils.get_nova_client()
+ self.shade_client = openstack_utils.get_shade_client()
self.setup_done = False
@@ -45,12 +43,13 @@ class DeleteKeypair(base.Scenario):
if not self.setup_done:
self.setup()
- status = op_utils.delete_keypair(self.nova_client,
- self.key_name)
+ status = openstack_utils.delete_keypair(self.shade_client,
+ self.key_name)
- if status:
- result.update({"delete_keypair": 1})
- LOG.info("Delete keypair successful!")
- else:
+ if not status:
result.update({"delete_keypair": 0})
- LOG.info("Delete keypair failed!")
+ LOG.error("Delete keypair failed!")
+ raise exceptions.ScenarioDeleteKeypairError
+
+ result.update({"delete_keypair": 1})
+ LOG.info("Delete keypair successful!")