Debian Codegraph @

heat_tempest_plugin/tests/scenario/templates/test_volumes_delete_snapshot.yaml

raw
1 heat_template_version: 2013-05-23
2
3 parameters:
4 key_name:
5 type: string
6 description: keypair to enable SSH access to the instance.
7
8 instance_type:
9 type: string
10 description: Type of the instance to be created.
11
12 image_id:
13 type: string
14 description: ID of the image to use for the instance to be created.
15
16 timeout:
17 type: number
18 description: Stack creation timeout
19
20 dev_name:
21 type: string
22 description: Expected device name for volume
23 default: vdb
24
25 test_string:
26 type: string
27 description: Test string which is written to volume
28 default: ateststring
29
30 rescan_timeout:
31 type: number
32 description: Max number of seconds to wait for volume after rescan
33 default: 120
34
35 network:
36 type: string
37
38 volume_description:
39 type: string
40 description: Description of volume
41 default: A volume description
42
43 volume_size:
44 type: number
45 description: Size of volume
46 default: 1
47
48 wc_extra_args:
49 type: string
50 description: extra options to add to CURL command
51 default: ""
52
53 resources:
54 volume:
55 deletion_policy: 'Snapshot'
56 type: OS::Cinder::Volume
57 properties:
58 size: {get_param: volume_size}
59 description: {get_param: volume_description}
60
61 volume_attachment:
62 type: OS::Cinder::VolumeAttachment
63 properties:
64 volume_id: { get_resource: volume }
65 instance_uuid: { get_resource: instance }
66
67 instance:
68 type: OS::Nova::Server
69 properties:
70 image: { get_param: image_id }
71 flavor: { get_param: instance_type }
72 key_name: { get_param: key_name }
73 networks:
74 - uuid: {get_param: network}
75 user_data_format: RAW
76 user_data:
77 str_replace:
78 template: |
79 #!/bin/sh
80 # Trigger rescan to ensure we see the attached volume
81 for i in /sys/class/scsi_host/*; do echo "- - -" > $i/scan; done
82 # Wait for the rescan as the volume doesn't appear immediately
83 for i in $(seq 1 rescan_timeout)
84 do
85 grep -q dev_name /proc/partitions && break
86 sleep 1
87 done
88 if grep -q dev_name /proc/partitions
89 then
90 mkfs.ext4 /dev/dev_name
91 mount /dev/dev_name /mnt
92 echo "test_string" > /mnt/testfile
93 umount /mnt
94 curl wc_extra_args -X PUT -H 'Content-Type:' --data-binary '{"Status": "SUCCESS", "Reason": "Test Complete", "Data": "Completed volume configuration.", "UniqueId": "instance1"}' "wc_url"
95 else
96 curl wc_extra_args -X PUT -H 'Content-Type:' --data-binary '{"Status": "FAILURE", "Reason": "Test Failed", "Data": "Expected device dev_name not found.", "UniqueId": "instance1"}' "wc_url"
97 fi
98 params:
99 wc_url: { get_resource: wait_handle }
100 dev_name: { get_param: dev_name }
101 rescan_timeout: { get_param: rescan_timeout }
102 test_string: { get_param: test_string }
103 wc_extra_args: { get_param: wc_extra_args }
104
105 wait_handle:
106 type: OS::Heat::UpdateWaitConditionHandle
107
108 wait_condition:
109 type: OS::Heat::WaitCondition
110 depends_on: instance
111 properties:
112 handle: { get_resource: wait_handle }
113 timeout: { get_param: timeout }
114
115
116 outputs:
117 status:
118 description: status
119 value: { get_attr: ['volume', 'status'] }
120
121 size:
122 description: size
123 value: { get_attr: ['volume', 'size'] }
124
125 display_description:
126 description: display_description
127 value: { get_attr: ['volume', 'display_description'] }
128
129 volume_id:
130 value: { get_resource: volume }