22
33This document provides more detail about curve-csi driver.
44
5+ - [ Deploy] ( #deploy )
6+ - [ Requirements] ( #requirements )
7+ - [ Using the helm chart] ( #using-the-helm-chart )
8+ - [ Using the kubernetes manifests] ( #using-the-kubernetes-manifests )
9+ - [ Debug] ( #debug )
10+ - [ Examples] ( #examples )
11+ - [ Create StorageClass] ( #create-storageclass )
12+ - [ Create PersistentVolumeClaim] ( #create-persistentvolumeclaim )
13+ - [ Create Test Pod] ( #create-test-pod )
14+ - [ Test block volume] ( #test-block-volume )
15+ - [ Test volume expanding] ( #test-volume-expanding )
16+ - [ Test snapshot] ( #test-snapshot )
17+ - [ Test volume clone] ( #test-volume-clone )
18+ - [ Test Using CSC Tool] ( #test-using-csc-tool )
19+
520## Deploy
621
722#### Requirements
@@ -36,7 +51,7 @@ and call:
3651curl -XPUT http://127.0.0.1:<debugPort>/debug/flags/v -d '5'
3752```
3853
39- ## Example
54+ ## Examples
4055
4156#### Create StorageClass
4257
93108
94109` ` `
95110# # create the pvc and pod:
96- kubectl create -f ../examples/block/ pvc.yaml
97- kubectl create -f ../examples/block/ pod.yaml
111+ kubectl create -f ../examples/pvc-block .yaml
112+ kubectl create -f ../examples/pod-block .yaml
98113
99114# # waiting for the pod running
100115kubectl exec -it csi-curve-test-block bash
@@ -111,8 +126,23 @@ kubectl exec -it csi-curve-test-block bash
111126
112127#### Test snapshot
113128
129+ Prerequisite: [ install snapshot-controller] ( https://kubernetes-csi.github.io/docs/snapshot-controller.html )
130+
131+
132+ Create snapshot:
133+
134+ ```
135+ kubectl create -f ../examples/snapshotclass.yaml
136+ kubectl create -f ../examples/snapshot.yaml
137+ ```
138+
114139#### Test volume clone
115140
141+ ```
142+ kubectl create -f ../examples/pvc.yaml
143+ kubectl create -f ../examples/pvc-clone.yaml
144+ kubectl create -f ../examples/pvc-restore.yaml
145+ ```
116146
117147## Test Using CSC Tool
118148
@@ -164,6 +194,8 @@ $ csc controller create --endpoint tcp://127.0.0.1:10000 \
164194"0003-k8s-csi-vol-volume-fa0c04c9-2e93-487e-8986-1e1625fd8c46" 10737418240 "user"="k8s"
165195```
166196
197+ If the volume is block type, set: ` --cap 5,1 `
198+
167199Check:
168200
169201``` text
@@ -190,16 +222,18 @@ $ csc node stage --endpoint tcp://127.0.0.1:10000 \
1902220003-k8s-csi-vol-volume-fa0c04c9-2e93-487e-8986-1e1625fd8c46
191223```
192224
225+ If the volume is block type, set: ` --cap 5,1 `
226+
193227Check:
194228
195229``` text
196230$ sudo curve-nbd list-mapped
197231id image device
19823297297 cbd:k8s//k8s/pvc-ce482926-91d8-11ea-bf6e-fa163e23ce53_k8s_ /dev/nbd0
199233
200- $ sudo findmnt /mnt/test-csi/volume-globalmount
234+ $ sudo findmnt /mnt/test-csi/volume-globalmount/0003-k8s-csi-vol-volume-fa0c04c9-2e93-487e-8986-1e1625fd8c46
201235TARGET SOURCE FSTYPE OPTIONS
202- /mnt/test-csi/volume-globalmount /dev/nbd0 ext4 rw,relatime,data=ordered
236+ /mnt/test-csi/volume-globalmount/0003-k8s-csi-vol-volume-fa0c04c9-2e93-487e-8986-1e1625fd8c46 /dev/nbd0 ext4 rw,relatime,data=ordered
203237```
204238
205239#### NodePublish a volume
@@ -253,8 +287,8 @@ $ csc controller expand --endpoint tcp://127.0.0.1:10000 \
253287
254288$ # nodeExpand:
255289$ csc node expand --endpoint tcp://127.0.0.1:10000 \
256- /mnt/test- csi/test-pod \
257- 0003-k8s- csi-vol-volume-fa0c04c9-2e93-487e-8986-1e1625fd8c46
290+ 0003-k8s- csi-vol-volume-fa0c04c9-2e93-487e-8986-1e1625fd8c46 \
291+ /mnt/test- csi/test-pod
2582920
259293```
260294
@@ -317,3 +351,18 @@ $ sudo curve stat --user k8s --filename /k8s/csi-vol-volume-fa0c04c9-2e93-487e-8
317351E 2020-08-24T13:57:55.946636+0800 58360 mds_client.cpp:395] GetFileInfo: filename = /k8s/volume-fa0c04c9-2e93-487e-8986-1e1625fd8c46, owner = k8s, errocde = 6, error msg = kFileNotExists, log id = 1
318352stat fail, ret = -6
319353```
354+
355+ #### Snapshot
356+
357+ ```
358+ ## create a snapshot
359+ $ csc controller create-snapshot --endpoint tcp://127.0.0.1:10000 \
360+ --source-volume 0003-k8s-csi-vol-volume-fa0c04c9-2e93-487e-8986-1e1625fd8c46 \
361+ snapshot-215d24ff-c04c-4b08-a1fb-692c94627c63
362+ "0024-9ea1a8fc-160d-47ef-b2ef-f0e09677b066-0003-k8s-csi-vol-volume-fa0c04c9-2e93-487e-8986-1e1625fd8c46" 23622320128 0003-k8s-csi-vol-volume-fa0c04c9-2e93-487e-8986-1e1625fd8c46 seconds:1639297566 nanos:780828000 true
363+
364+ ## delete a snapshot
365+ $ csc controller delete-snapshot --endpoint tcp://127.0.0.1:10000 \
366+ 0024-9ea1a8fc-160d-47ef-b2ef-f0e09677b066-0003-k8s-csi-vol-volume-fa0c04c9-2e93-487e-8986-1e1625fd8c46
367+ 0024-9ea1a8fc-160d-47ef-b2ef-f0e09677b066-0003-k8s-csi-vol-volume-fa0c04c9-2e93-487e-8986-1e1625fd8c46
368+ ```
0 commit comments