upstream/openstack/python-heat/python-heat/templates/hot/simple/OS_Cinder_VolumeAttachment....

123 lines
3.8 KiB
YAML

################################################################################
# Copyright (c) 2013-2015 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
################################################################################
#
# Objective:
# Demonstrate constructing the heat resource OS::Cinder::VolumeAttachment
#
# Pre-Reqs:
# Normal Lab Setup
# A glance image named: wrl6 (glance image-list)
# A nova flavor named: small (nova flavor-list)
# A network named: private-net0 (neutron net-list)
#
# Mandatory Template Parameters:
# network_id (neutron net-list)
#
# Tenant Considerations:
# The tenant (or admin) needs access to the network selected
#
# Sample CLI syntax:
# heat stack-create -f OS_Cinder_VolumeAttachment.yaml STACK
#
# Expected Outcome:
# A nova server that has mounted a new 1GB cinder volume
# cinder list
# nova list
# nova show <uuid of the new server>
#
################################################################################
heat_template_version: 2015-04-30
description: >
Demonstrate the OS::Cinder::VolumeAttachment heat resource
parameters:
IMAGE:
description: Glance image used by cinder volume (glance image-list)
type: string
default: wrl6
constraints:
- custom_constraint: glance.image
FLAVOR:
description: Nova flavor to use. (nova flavor-list)
type: string
default: small
constraints:
- custom_constraint: nova.flavor
NETWORK:
description: name of network to use (neutron net-list)
type: string
default: private-net0
constraints:
- custom_constraint: neutron.network
VM_NAME:
description: Name of the newly created VM
type: string
default: cinder_vm
VOLUME_NAME:
description: Name of the newly created volume
type: string
default: cinder_volume_demo
VOLUME_SIZE:
description: size for the new cinder volume
type: number
default: 2
resources:
OS_Cinder_VolumeAttachment:
type: OS::Cinder::VolumeAttachment
properties:
#################################################
# Required properties
#################################################
# instance_uuid: {description: The ID of the server to which the
# volume attaches.,
instance_uuid: { get_resource: some_instance }
# mountpoint: {description: The location where the volume is
# exposed on the instance., Note: launchpad bug 1267744 suggests
# the mountpoint should be /dev/vd[b-z] except on baremetal
# This value is not respected. It will use the first available
# mountpoint (usually /dev/vdb)
mountpoint: /dev/vdb
# volume_id: {description: The ID of the volume to be attached.,
# required: true, type: string}
volume_id: { get_resource: some_volume }
#################################################
# Optional properties: NONE
#################################################
#################################################
# The following resources are created because they
# are required fields for the volumeattachment
#################################################
some_instance:
type: OS::Nova::Server
properties:
name: { get_param: VM_NAME }
image: { get_param: IMAGE }
flavor: { get_param: FLAVOR }
networks:
- network: { get_param: NETWORK }
some_volume:
type: OS::Cinder::Volume
properties:
name: { get_param: VOLUME_NAME }
size: { get_param: VOLUME_SIZE }