blob: fa1f10260286f5c8581af9ba4cd2dadc40388178 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
---
- name: setup
cs_volume: name={{ cs_resource_prefix }}_vol state=absent
register: vol
- name: verify setup
assert:
that:
- vol|success
- name: setup instance 1
cs_instance:
name: "{{ test_cs_instance_1 }}"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
register: instance
- name: verify create instance
assert:
that:
- instance|success
- name: setup instance 2
cs_instance:
name: "{{ test_cs_instance_2 }}"
template: "{{ test_cs_instance_template }}"
service_offering: "{{ test_cs_instance_offering_1 }}"
register: instance
- name: verify create instance
assert:
that:
- instance|success
- name: test fail if missing name
action: cs_volume
register: vol
ignore_errors: true
- name: verify results of fail if missing name
assert:
that:
- vol|failed
- "vol.msg == 'missing required arguments: name'"
- name: test create volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
disk_offering: "{{ test_cs_disk_offering_1 }}"
register: vol
- name: verify results test create volume
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- name: test create volume idempotence
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
disk_offering: "{{ test_cs_disk_offering_1 }}"
register: vol
- name: verify results test create volume idempotence
assert:
that:
- not vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- name: test attach volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
vm: "{{ test_cs_instance_1 }}"
state: attached
register: vol
- name: verify results test attach volume
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.vm == "{{ test_cs_instance_1 }}"
- vol.attached is defined
- name: test attach volume idempotence
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
vm: "{{ test_cs_instance_1 }}"
state: attached
register: vol
- name: verify results test attach volume idempotence
assert:
that:
- not vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.vm == "{{ test_cs_instance_1 }}"
- vol.attached is defined
- name: test attach attached volume to another vm
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
vm: "{{ test_cs_instance_2 }}"
state: attached
register: vol
- name: verify results test attach attached volume to another vm
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.vm == "{{ test_cs_instance_2 }}"
- vol.attached is defined
- name: test attach attached volume to another vm idempotence
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
vm: "{{ test_cs_instance_2 }}"
state: attached
register: vol
- name: verify results test attach attached volume to another vm idempotence
assert:
that:
- not vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.vm == "{{ test_cs_instance_2 }}"
- vol.attached is defined
- name: test detach volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
state: detached
register: vol
- name: verify results test detach volume
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.attached is undefined
- name: test detach volume idempotence
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
state: detached
register: vol
- name: verify results test detach volume idempotence
assert:
that:
- not vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- vol.attached is undefined
- name: test delete volume
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
state: absent
register: vol
- name: verify results test create volume
assert:
that:
- vol|changed
- vol.name == "{{ cs_resource_prefix }}_vol"
- name: test delete volume idempotence
cs_volume:
name: "{{ cs_resource_prefix }}_vol"
state: absent
register: vol
- name: verify results test delete volume idempotence
assert:
that:
- not vol|changed
- name: cleanup instance 1
cs_instance:
name: "{{ test_cs_instance_1 }}"
state: absent
register: instance
- name: verify create instance
assert:
that:
- instance|success
- name: cleanup instance 2
cs_instance:
name: "{{ test_cs_instance_2 }}"
state: absent
register: instance
- name: verify create instance
assert:
that:
- instance|success
|