diff options
Diffstat (limited to 'yardstick/orchestrator/heat.py')
-rw-r--r-- | yardstick/orchestrator/heat.py | 34 |
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""" |