mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
Implement NodeStage and NodeUnstage for rbd
in NodeStage RPC call we have to map the device to the node plugin and make sure the the device will be mounted to the global path in nodeUnstage request unmount the device from global path and unmap the device if the volume mode is block we will be creating a file inside a stageTargetPath and it will be considered as the global path Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
7d8f465746
commit
f4c80dec9a
@ -117,6 +117,13 @@ var _ = Describe("cephfs", func() {
|
||||
}
|
||||
})
|
||||
|
||||
By("check data persist after recreating pod with same pvc", func() {
|
||||
err := checkDataPersist(pvcPath, appPath, f)
|
||||
if err != nil {
|
||||
Fail(err.Error())
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
@ -189,6 +189,13 @@ var _ = Describe("RBD", func() {
|
||||
Fail("validate multiple pvc failed")
|
||||
}
|
||||
})
|
||||
|
||||
By("check data persist after recreating pod with same pvc", func() {
|
||||
err := checkDataPersist(pvcPath, appPath, f)
|
||||
if err != nil {
|
||||
Fail(err.Error())
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
49
e2e/utils.go
49
e2e/utils.go
@ -759,3 +759,52 @@ func GivePermToCephfsRoot(f *framework.Framework) {
|
||||
out = execCommandInPod(f, "chmod 777 /mnt/cephfs/", rookNS, &opt)
|
||||
e2elog.Logf("Setting chmod 777 on the cepfs root %s", out)
|
||||
}
|
||||
|
||||
func checkDataPersist(pvcPath, appPath string, f *framework.Framework) error {
|
||||
data := "checking data persist"
|
||||
pvc, err := loadPVC(pvcPath)
|
||||
if pvc == nil {
|
||||
return err
|
||||
}
|
||||
pvc.Namespace = f.UniqueName
|
||||
e2elog.Logf("The PVC template %+v", pvc)
|
||||
|
||||
app, err := loadApp(appPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
app.Labels = map[string]string{"app": "validate-data"}
|
||||
app.Namespace = f.UniqueName
|
||||
|
||||
err = createPVCAndApp("", f, pvc, app)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
opt := metav1.ListOptions{
|
||||
LabelSelector: "app=validate-data",
|
||||
}
|
||||
// write data to PVC
|
||||
filePath := app.Spec.Containers[0].VolumeMounts[0].MountPath + "/test"
|
||||
|
||||
execCommandInPod(f, fmt.Sprintf("echo %s > %s", data, filePath), app.Namespace, &opt)
|
||||
|
||||
// delete app
|
||||
err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// recreate app and check data persist
|
||||
err = createApp(f.ClientSet, app, deployTimeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
persistData := execCommandInPod(f, fmt.Sprintf("cat %s", filePath), app.Namespace, &opt)
|
||||
|
||||
if !strings.Contains(persistData, data) {
|
||||
return fmt.Errorf("data not persistent expected data %s received data %s ", data, persistData)
|
||||
}
|
||||
|
||||
err = deletePVCAndApp("", f, pvc, app)
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user