aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-05-15 08:07:47 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-05-15 08:07:47 +0000
commit29a75d1c182b6a707c36fbc48a3e4b123f390d9f (patch)
tree4871e51a8f0ae4d37725092ed2dbefa52c821f39 /yardstick/benchmark/scenarios
parentac190e58b127f1aa276e462292d776b5126e4944 (diff)
parentf6cca46f6b1aa6134a0e634a3a9e524cdbbfa729 (diff)
Merge "Replace cinder detach volume with shade client."
Diffstat (limited to 'yardstick/benchmark/scenarios')
-rw-r--r--yardstick/benchmark/scenarios/lib/detach_volume.py33
1 files changed, 19 insertions, 14 deletions
diff --git a/yardstick/benchmark/scenarios/lib/detach_volume.py b/yardstick/benchmark/scenarios/lib/detach_volume.py
index 0b02a3a81..76c0167bd 100644
--- a/yardstick/benchmark/scenarios/lib/detach_volume.py
+++ b/yardstick/benchmark/scenarios/lib/detach_volume.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,10 +24,14 @@ class DetachVolume(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.server_id = self.options.get("server_id", "TestServer")
- self.volume_id = self.options.get("volume_id", None)
+ self.server = self.options["server_name_or_id"]
+ self.volume = self.options["volume_name_or_id"]
+ self.wait = self.options.get("wait", True)
+ self.timeout = self.options.get("timeout")
+
+ self.shade_client = openstack_utils.get_shade_client()
self.setup_done = False
@@ -44,11 +46,14 @@ class DetachVolume(base.Scenario):
if not self.setup_done:
self.setup()
- status = op_utils.detach_volume(self.server_id, self.volume_id)
+ status = openstack_utils.detach_volume(
+ self.shade_client, self.server, self.volume,
+ wait=self.wait, timeout=self.timeout)
- if status:
- result.update({"detach_volume": 1})
- LOG.info("Detach volume from server successful!")
- else:
+ if not status:
result.update({"detach_volume": 0})
- LOG.info("Detach volume from server failed!")
+ LOG.error("Detach volume from server failed!")
+ raise exceptions.ScenarioDetachVolumeError
+
+ result.update({"detach_volume": 1})
+ LOG.info("Detach volume from server successful!")