Skip to content

Commit a08ca3c

Browse files
committed
add image store
1 parent 8e54e67 commit a08ca3c

File tree

3 files changed

+172
-0
lines changed

3 files changed

+172
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cloud/cs
2+
cs/group1
3+
cs/group3
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
dependencies:
3+
- cs_common
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
- name: setup image store is absent
3+
ngine_io.cloudstack.image_store:
4+
name: "storage_pool_adv"
5+
zone: "{{ cs_common_zone_adv }}"
6+
state: absent
7+
register: sp
8+
- name: verify setup image store is absent
9+
assert:
10+
that:
11+
- sp is successful
12+
13+
- name: test fail if missing params
14+
ngine_io.cloudstack.image_store:
15+
register: ss
16+
ignore_errors: true
17+
- name: verify test fail if missing params
18+
assert:
19+
that:
20+
- ss is failed
21+
- "'name' in ss.msg"
22+
- "'zone' in ss.msg"
23+
- "'missing required arguments: ' in ss.msg"
24+
25+
- name: setup image store with wrong parameters
26+
ngine_io.cloudstack.image_store:
27+
name: "storage_pool_adv"
28+
zone: "{{ cs_common_zone_adv }}"
29+
state: present
30+
ignore_errors: true
31+
register: ss
32+
- name: verify setup image store with wrong parameters
33+
assert:
34+
that:
35+
- ss is failed
36+
- "ss.msg == 'state is present but all of the following are missing: url, provider'"
37+
38+
- name: setup image store in check mode
39+
ngine_io.cloudstack.image_store:
40+
name: "storage_pool_adv"
41+
zone: "{{ cs_common_zone_adv }}"
42+
url: "nfs://nfs-mount.domain/share/images/"
43+
provider: "NFS"
44+
state: present
45+
check_mode: true
46+
register: ss
47+
- name: verify setup image store in check mode
48+
assert:
49+
that:
50+
- ss is successful
51+
- ss is changed
52+
53+
- name: setup image store
54+
ngine_io.cloudstack.image_store:
55+
name: "storage_pool_adv"
56+
zone: "{{ cs_common_zone_adv }}"
57+
url: "nfs://nfs-mount.domain/share/images/"
58+
provider: "NFS"
59+
state: present
60+
register: ss
61+
- name: verify setup image store
62+
assert:
63+
that:
64+
- ss is successful
65+
- ss is changed
66+
- "ss.url == 'nfs://nfs-mount.domain/share/images/'"
67+
- "ss.provider_name == 'NFS'"
68+
- "ss.zone == cs_common_zone_adv"
69+
- "ss.protocol == 'nfs'"
70+
71+
- name: setup image store idempotence
72+
ngine_io.cloudstack.image_store:
73+
name: "storage_pool_adv"
74+
zone: "{{ cs_common_zone_adv }}"
75+
url: "nfs://nfs-mount.domain/share/images/"
76+
provider: "NFS"
77+
state: present
78+
register: ss
79+
- name: verify setup image store idempotence
80+
assert:
81+
that:
82+
- ss is successful
83+
- ss is not changed
84+
- "ss.url == 'nfs://nfs-mount.domain/share/images/'"
85+
- "ss.provider_name == 'NFS'"
86+
- "ss.zone == cs_common_zone_adv"
87+
- "ss.protocol == 'nfs'"
88+
- "ss.name == 'storage_pool_adv'"
89+
90+
- name: image store not recreated
91+
ngine_io.cloudstack.image_store:
92+
name: "storage_pool_adv"
93+
zone: "{{ cs_common_zone_adv }}"
94+
url: "nfs://nfs-mount.domain/share2/images/"
95+
provider: "NFS"
96+
state: present
97+
register: ss
98+
- name: verify image store not recreated
99+
assert:
100+
that:
101+
- ss is successful
102+
- ss is not changed
103+
- "ss.url == 'nfs://nfs-mount.domain/share/images/'"
104+
- "ss.name == 'storage_pool_adv'"
105+
- "ss.zone == cs_common_zone_adv"
106+
107+
- name: recreate image store
108+
ngine_io.cloudstack.image_store:
109+
name: "storage_pool_adv"
110+
zone: "{{ cs_common_zone_adv }}"
111+
url: "nfs://nfs-mount.domain/share2/images/"
112+
provider: "NFS"
113+
force_recreate: yes
114+
state: present
115+
register: ss
116+
- name: verify setup image store idempotence
117+
assert:
118+
that:
119+
- ss is successful
120+
- ss is changed
121+
- "ss.url == 'nfs://nfs-mount.domain/share2/images/'"
122+
- "ss.name == 'storage_pool_adv'"
123+
- "ss.zone == cs_common_zone_adv"
124+
125+
- name: delete the image store in check_mode
126+
ngine_io.cloudstack.image_store:
127+
name: "storage_pool_adv"
128+
zone: "{{ cs_common_zone_adv }}"
129+
state: absent
130+
register: ss
131+
check_mode: yes
132+
- name: verify results for delete the image store in check_mode
133+
assert:
134+
that:
135+
- ss is successful
136+
- ss is changed
137+
- "ss.name == 'storage_pool_adv'"
138+
- "ss.zone == cs_common_zone_adv"
139+
140+
- name: delete the image store
141+
ngine_io.cloudstack.image_store:
142+
name: "storage_pool_adv"
143+
zone: "{{ cs_common_zone_adv }}"
144+
state: absent
145+
register: ss
146+
- name: verify results for delete the image store
147+
assert:
148+
that:
149+
- ss is successful
150+
- ss is changed
151+
- "ss.name == 'storage_pool_adv'"
152+
- "ss.zone == cs_common_zone_adv"
153+
154+
- name: delete the image store idempotence
155+
ngine_io.cloudstack.image_store:
156+
name: "storage_pool_adv"
157+
zone: "{{ cs_common_zone_adv }}"
158+
state: absent
159+
register: ss
160+
- name: verify delete the image store idempotence
161+
assert:
162+
that:
163+
- ss is successful
164+
- ss is not changed
165+
- ss.name is undefined
166+
- "ss.zone == cs_common_zone_adv"

0 commit comments

Comments
 (0)