2 # PDX-license-identifier: Apache-2.0
3 ##############################################################################
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 echo "[OPTANE-TEST] Check the NVDIMM hardware ..."
12 ndctl_region=`ndctl list -R`
13 if [[ $ndctl_region == "" ]] ; then
14 echo "No NVDIMM hardware, exit ..."
18 pod_sc_01=pod-sc-case-01
19 pod_pvc_01=pod-pvc-case-01
20 pod_app_01=pod-app-case-01
22 cat << POD > $HOME/$pod_sc_01.yaml
23 apiVersion: storage.k8s.io/v1
26 name: pmem-csi-sc-ext4
28 csi.storage.k8s.io/fstype: ext4
30 provisioner: pmem-csi.intel.com
32 volumeBindingMode: Immediate
35 cat << POD > $HOME/$pod_pvc_01.yaml
37 kind: PersistentVolumeClaim
39 name: pmem-csi-pvc-ext4
46 storageClassName: pmem-csi-sc-ext4
49 cat << POD > $HOME/$pod_app_01.yaml
58 command: [ "sleep", "100000" ]
64 persistentVolumeClaim:
65 claimName: pmem-csi-pvc-ext4
68 kubectl apply -f $HOME/$pod_sc_01.yaml
69 kubectl apply -f $HOME/$pod_pvc_01.yaml
70 kubectl apply -f $HOME/$pod_app_01.yaml
72 echo "Sleep for several minutes ..."
75 pvc_meta="$(kubectl get pvc -o jsonpath='{.items[0].metadata.name}')"
76 pvc_status="$(kubectl get pvc -o jsonpath='{.items[0].status.phase}')"
77 if [[ $pvc_meta == "pmem-csi-pvc-ext4" ]] && [[ $pvc_status == "Bound" ]] ; then
78 echo "[OPTANE] SUCCESS: created PMEM-CSI volume!"
80 echo "[OPTANE] FAILED: cannot create PMEM-CSI volume!"
83 echo "Wait and remove the test resource ..."
86 kubectl delete -f $HOME/$pod_sc_01.yaml
87 kubectl delete -f $HOME/$pod_pvc_01.yaml
88 kubectl delete -f $HOME/$pod_app_01.yaml