aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/orchestrator
diff options
context:
space:
mode:
authorJingLu5 <lvjing5@huawei.com>2017-07-24 01:39:57 +0000
committerJing Lu <lvjing5@huawei.com>2017-07-29 04:39:36 +0000
commitf089a528c30b8163f52db9e5ff09f8632bc9078e (patch)
tree4647eefc9de585ad464d37823e1551d0e77d0439 /yardstick/orchestrator
parent362f0330b4456414b9b05e4cc0e9e7db0c753722 (diff)
Heat: support create and attach volume in heat type context
JIRA: YARDSTICK-756 Some test scenarios require VM with volume attached. This work is about supporting create and attach volume in heat type context. context: name: demo image: cirros-0.3.5 flavor: yardstick-flavor user: cirros placement_groups: pgrp1: policy: "availability" servers: athena: floating_ip: true # per-vm inline volume definition. if no volume size specified, then this # volume should be an existing volume in the openstack environment volume: yardstick-volume placement: "pgrp1" ares: # per-vm inline volume definition. if volume size is specified, then this # volume will be crated and attach to the vm volume: name: test-volume size: 10 # volume mountpoint is also configurable volume_mountpoint: /dev/vdb placement: "pgrp1" networks: test: cidr: '10.0.1.0/24' Change-Id: Ief87b313980a59eac229eb4780d93ffc929ceb66 Signed-off-by: JingLu5 <lvjing5@huawei.com>
Diffstat (limited to 'yardstick/orchestrator')
-rw-r--r--yardstick/orchestrator/heat.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py
index 95ca0ad2e..05e359717 100644
--- a/yardstick/orchestrator/heat.py
+++ b/yardstick/orchestrator/heat.py
@@ -230,6 +230,40 @@ name (i.e. %s).\
'value': {'get_resource': name}
}
+ def add_volume(self, name, size=10):
+ """add to the template a volume description"""
+ log.debug("adding Cinder::Volume '%s' size '%d' ", name, size)
+
+ self.resources[name] = {
+ 'type': 'OS::Cinder::Volume',
+ 'properties': {'name': name,
+ 'size': size}
+ }
+
+ self._template['outputs'][name] = {
+ 'description': 'Volume %s ID' % name,
+ 'value': {'get_resource': name}
+ }
+
+ def add_volume_attachment(self, server_name, volume_name, mountpoint=None):
+ """add to the template an association of volume to instance"""
+ log.debug("adding Cinder::VolumeAttachment server '%s' volume '%s' ", server_name,
+ volume_name)
+
+ name = "%s-%s" % (server_name, volume_name)
+
+ volume_id = op_utils.get_volume_id(volume_name)
+ if not volume_id:
+ volume_id = {'get_resource': volume_name}
+ self.resources[name] = {
+ 'type': 'OS::Cinder::VolumeAttachment',
+ 'properties': {'instance_uuid': {'get_resource': server_name},
+ 'volume_id': volume_id}
+ }
+
+ if mountpoint:
+ self.resources[name]['properties']['mountpoint'] = mountpoint
+
def add_network(self, name, physical_network='physnet1', provider=None,
segmentation_id=None, port_security_enabled=None):
"""add to the template a Neutron Net"""