Skip to content

Commit daf405e

Browse files
qa/suites/orch: add a pair of teuthology tests for ctdb smb clusters
Signed-off-by: John Mulligan <[email protected]>
1 parent 84d5d8b commit daf405e

File tree

2 files changed

+273
-0
lines changed

2 files changed

+273
-0
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
roles:
2+
# Test is for basic smb deployment & functionality. one node cluster is OK
3+
- - host.a
4+
- mon.a
5+
- mgr.x
6+
- osd.0
7+
- osd.1
8+
- client.0
9+
- - host.b
10+
- mon.b
11+
- osd.2
12+
- osd.3
13+
- - host.c
14+
- mon.c
15+
- osd.4
16+
- osd.5
17+
# Reserve a host for acting as an smb client
18+
- - host.d
19+
- cephadm.exclude
20+
overrides:
21+
ceph:
22+
log-only-match:
23+
- CEPHADM_
24+
tasks:
25+
- cephadm.configure_samba_client_container:
26+
role: host.d
27+
- cephadm:
28+
29+
- cephadm.shell:
30+
host.a:
31+
- ceph fs volume create cephfs
32+
- cephadm.wait_for_service:
33+
service: mds.cephfs
34+
35+
- cephadm.shell:
36+
host.a:
37+
# add subvolgroup & subvolumes for test
38+
- cmd: ceph fs subvolumegroup create cephfs smb
39+
- cmd: ceph fs subvolume create cephfs sv1 --group-name=smb --mode=0777
40+
- cmd: ceph fs subvolume create cephfs sv2 --group-name=smb --mode=0777
41+
# set up smb cluster and shares
42+
- cmd: ceph mgr module enable smb
43+
# TODO: replace sleep with poll of mgr state?
44+
- cmd: sleep 30
45+
- cmd: ceph smb apply -i -
46+
stdin: |
47+
# --- Begin Embedded YAML
48+
- resource_type: ceph.smb.cluster
49+
cluster_id: uctdb1
50+
auth_mode: user
51+
user_group_settings:
52+
- {source_type: resource, ref: ug1}
53+
placement:
54+
count: 3
55+
- resource_type: ceph.smb.usersgroups
56+
users_groups_id: ug1
57+
values:
58+
users:
59+
- {name: user1, password: t3stP4ss1}
60+
- {name: user2, password: t3stP4ss2}
61+
groups: []
62+
- resource_type: ceph.smb.share
63+
cluster_id: uctdb1
64+
share_id: share1
65+
cephfs:
66+
volume: cephfs
67+
subvolumegroup: smb
68+
subvolume: sv1
69+
path: /
70+
- resource_type: ceph.smb.share
71+
cluster_id: uctdb1
72+
share_id: share2
73+
cephfs:
74+
volume: cephfs
75+
subvolumegroup: smb
76+
subvolume: sv2
77+
path: /
78+
# --- End Embedded YAML
79+
# Wait for the smb service to start
80+
- cephadm.wait_for_service:
81+
service: smb.uctdb1
82+
# Since this is a true cluster there should be a clustermeta in rados
83+
- cephadm.shell:
84+
host.a:
85+
- cmd: rados --pool=.smb -N uctdb1 get cluster.meta.json /dev/stdout
86+
87+
# Check if shares exist
88+
- cephadm.exec:
89+
host.d:
90+
- sleep 30
91+
- "{{ctx.samba_client_container_cmd|join(' ')}} smbclient -U user1%t3stP4ss1 //{{'host.a'|role_to_remote|attr('ip_address')}}/share1 -c ls"
92+
- "{{ctx.samba_client_container_cmd|join(' ')}} smbclient -U user2%t3stP4ss2 //{{'host.a'|role_to_remote|attr('ip_address')}}/share2 -c ls"
93+
94+
# verify CTDB is healthy, cluster well formed
95+
- cephadm.exec:
96+
host.a:
97+
- "{{ctx.cephadm}} ls --no-detail | {{ctx.cephadm}} shell jq -r 'map(select(.name | startswith(\"smb.uctdb1\")))[-1].name' > /tmp/svcname"
98+
- "{{ctx.cephadm}} enter -n $(cat /tmp/svcname) ctdb status > /tmp/ctdb_status"
99+
- cat /tmp/ctdb_status
100+
- grep 'pnn:0 .*OK' /tmp/ctdb_status
101+
- grep 'pnn:1 .*OK' /tmp/ctdb_status
102+
- grep 'pnn:2 .*OK' /tmp/ctdb_status
103+
- grep 'Number of nodes:3' /tmp/ctdb_status
104+
- rm -rf /tmp/svcname /tmp/ctdb_status
105+
106+
# Test a different host in the cluster
107+
- cephadm.exec:
108+
host.d:
109+
- sleep 30
110+
- "{{ctx.samba_client_container_cmd|join(' ')}} smbclient -U user1%t3stP4ss1 //{{'host.c'|role_to_remote|attr('ip_address')}}/share1 -c ls"
111+
- "{{ctx.samba_client_container_cmd|join(' ')}} smbclient -U user2%t3stP4ss2 //{{'host.c'|role_to_remote|attr('ip_address')}}/share2 -c ls"
112+
113+
- cephadm.shell:
114+
host.a:
115+
- cmd: ceph smb apply -i -
116+
stdin: |
117+
# --- Begin Embedded YAML
118+
- resource_type: ceph.smb.cluster
119+
cluster_id: uctdb1
120+
intent: removed
121+
- resource_type: ceph.smb.usersgroups
122+
users_groups_id: ug1
123+
intent: removed
124+
- resource_type: ceph.smb.share
125+
cluster_id: uctdb1
126+
share_id: share1
127+
intent: removed
128+
- resource_type: ceph.smb.share
129+
cluster_id: uctdb1
130+
share_id: share2
131+
intent: removed
132+
# --- End Embedded YAML
133+
# Wait for the smb service to be removed
134+
- cephadm.wait_for_service_not_present:
135+
service: smb.uctdb1
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
roles:
2+
# Test is for basic smb deployment & functionality. one node cluster is OK
3+
- - host.a
4+
- mon.a
5+
- mgr.x
6+
- osd.0
7+
- osd.1
8+
- client.0
9+
- - host.b
10+
- mon.b
11+
- osd.2
12+
- osd.3
13+
- - host.c
14+
- mon.c
15+
- osd.4
16+
- osd.5
17+
# Reserve a host for acting as a domain controller and smb client
18+
- - host.d
19+
- cephadm.exclude
20+
overrides:
21+
ceph:
22+
log-only-match:
23+
- CEPHADM_
24+
tasks:
25+
- cephadm.deploy_samba_ad_dc:
26+
role: host.d
27+
- cephadm:
28+
29+
- cephadm.shell:
30+
host.a:
31+
- ceph fs volume create cephfs
32+
- cephadm.wait_for_service:
33+
service: mds.cephfs
34+
35+
- cephadm.shell:
36+
host.a:
37+
# add subvolgroup & subvolumes for test
38+
- cmd: ceph fs subvolumegroup create cephfs smb
39+
- cmd: ceph fs subvolume create cephfs sv1 --group-name=smb --mode=0777
40+
- cmd: ceph fs subvolume create cephfs sv2 --group-name=smb --mode=0777
41+
# set up smb cluster and shares
42+
- cmd: ceph mgr module enable smb
43+
# TODO: replace sleep with poll of mgr state?
44+
- cmd: sleep 30
45+
- cmd: ceph smb apply -i -
46+
stdin: |
47+
# --- Begin Embedded YAML
48+
- resource_type: ceph.smb.cluster
49+
cluster_id: adctdb1
50+
auth_mode: active-directory
51+
domain_settings:
52+
realm: DOMAIN1.SINK.TEST
53+
join_sources:
54+
- source_type: resource
55+
ref: join1-admin
56+
custom_dns:
57+
- "{{ctx.samba_ad_dc_ip}}"
58+
placement:
59+
count: 3
60+
- resource_type: ceph.smb.join.auth
61+
auth_id: join1-admin
62+
auth:
63+
username: Administrator
64+
password: Passw0rd
65+
- resource_type: ceph.smb.share
66+
cluster_id: adctdb1
67+
share_id: share1
68+
cephfs:
69+
volume: cephfs
70+
subvolumegroup: smb
71+
subvolume: sv1
72+
path: /
73+
- resource_type: ceph.smb.share
74+
cluster_id: adctdb1
75+
share_id: share2
76+
cephfs:
77+
volume: cephfs
78+
subvolumegroup: smb
79+
subvolume: sv2
80+
path: /
81+
# --- End Embedded YAML
82+
# Wait for the smb service to start
83+
- cephadm.wait_for_service:
84+
service: smb.adctdb1
85+
# Since this is a true cluster there should be a clustermeta in rados
86+
- cephadm.shell:
87+
host.a:
88+
- cmd: rados --pool=.smb -N adctdb1 get cluster.meta.json /dev/stdout
89+
90+
# Check if shares exist
91+
- cephadm.exec:
92+
host.d:
93+
- sleep 30
94+
- "{{ctx.samba_client_container_cmd|join(' ')}} smbclient -U DOMAIN1\\\\ckent%1115Rose. //{{'host.a'|role_to_remote|attr('ip_address')}}/share1 -c ls"
95+
- "{{ctx.samba_client_container_cmd|join(' ')}} smbclient -U DOMAIN1\\\\ckent%1115Rose. //{{'host.a'|role_to_remote|attr('ip_address')}}/share2 -c ls"
96+
97+
# verify CTDB is healthy, cluster well formed
98+
- cephadm.exec:
99+
host.a:
100+
- "{{ctx.cephadm}} ls --no-detail | {{ctx.cephadm}} shell jq -r 'map(select(.name | startswith(\"smb.adctdb1\")))[-1].name' > /tmp/svcname"
101+
- "{{ctx.cephadm}} enter -n $(cat /tmp/svcname) ctdb status > /tmp/ctdb_status"
102+
- cat /tmp/ctdb_status
103+
- grep 'pnn:0 .*OK' /tmp/ctdb_status
104+
- grep 'pnn:1 .*OK' /tmp/ctdb_status
105+
- grep 'pnn:2 .*OK' /tmp/ctdb_status
106+
- grep 'Number of nodes:3' /tmp/ctdb_status
107+
- rm -rf /tmp/svcname /tmp/ctdb_status
108+
109+
# Test a different host in the cluster
110+
- cephadm.exec:
111+
host.d:
112+
- sleep 30
113+
- "{{ctx.samba_client_container_cmd|join(' ')}} smbclient -U DOMAIN1\\\\ckent%1115Rose. //{{'host.c'|role_to_remote|attr('ip_address')}}/share1 -c ls"
114+
- "{{ctx.samba_client_container_cmd|join(' ')}} smbclient -U DOMAIN1\\\\ckent%1115Rose. //{{'host.c'|role_to_remote|attr('ip_address')}}/share2 -c ls"
115+
116+
- cephadm.shell:
117+
host.a:
118+
- cmd: ceph smb apply -i -
119+
stdin: |
120+
# --- Begin Embedded YAML
121+
- resource_type: ceph.smb.cluster
122+
cluster_id: adctdb1
123+
intent: removed
124+
- resource_type: ceph.smb.join.auth
125+
auth_id: join1-admin
126+
intent: removed
127+
- resource_type: ceph.smb.share
128+
cluster_id: adctdb1
129+
share_id: share1
130+
intent: removed
131+
- resource_type: ceph.smb.share
132+
cluster_id: adctdb1
133+
share_id: share2
134+
intent: removed
135+
# --- End Embedded YAML
136+
# Wait for the smb service to be removed
137+
- cephadm.wait_for_service_not_present:
138+
service: smb.adctdb1

0 commit comments

Comments
 (0)