mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
e2e: add testcase for volume expansion with rbd-nbd mounter
The rbd-nbd resize volume support with its netlink interface needs linux kernel version >= v5.3.0 Hence define a defence check for the supported kernel version Fixes: #2234 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
parent
85a1fba0f4
commit
9669394b23
49
e2e/rbd.go
49
e2e/rbd.go
@ -9,6 +9,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/ceph/ceph-csi/internal/util"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo" // nolint
|
. "github.com/onsi/ginkgo" // nolint
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -429,6 +431,53 @@ var _ = Describe("RBD", func() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
By("Resize rbd-nbd PVC and check application directory size", func() {
|
||||||
|
kernelRelease, err := util.GetKernelVersion()
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to get kernel version with error %v", err)
|
||||||
|
}
|
||||||
|
if util.CheckKernelSupport(kernelRelease, nbdResizeSupport) {
|
||||||
|
err := deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to delete storageclass with error %v", err)
|
||||||
|
}
|
||||||
|
// Storage class with rbd-nbd mounter
|
||||||
|
err = createRBDStorageClass(
|
||||||
|
f.ClientSet,
|
||||||
|
f,
|
||||||
|
defaultSCName,
|
||||||
|
nil,
|
||||||
|
map[string]string{"mounter": "rbd-nbd"},
|
||||||
|
deletePolicy)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to create storageclass with error %v", err)
|
||||||
|
}
|
||||||
|
// Block PVC resize
|
||||||
|
err = resizePVCAndValidateSize(rawPvcPath, rawAppPath, f)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to resize block PVC with error %v", err)
|
||||||
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
validateRBDImageCount(f, 0, defaultRBDPool)
|
||||||
|
|
||||||
|
// FileSystem PVC resize
|
||||||
|
err = resizePVCAndValidateSize(pvcPath, appPath, f)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to resize filesystem PVC with error %v", err)
|
||||||
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
validateRBDImageCount(f, 0, defaultRBDPool)
|
||||||
|
err = deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to delete storageclass with error %v", err)
|
||||||
|
}
|
||||||
|
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to create storageclass with error %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
By("perform IO on rbd-nbd volume after nodeplugin restart", func() {
|
By("perform IO on rbd-nbd volume after nodeplugin restart", func() {
|
||||||
err := deleteResource(rbdExamplePath + "storageclass.yaml")
|
err := deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -10,6 +10,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/ceph/ceph-csi/internal/util"
|
||||||
|
|
||||||
snapapi "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
|
snapapi "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
scv1 "k8s.io/api/storage/v1"
|
scv1 "k8s.io/api/storage/v1"
|
||||||
@ -26,6 +28,18 @@ const (
|
|||||||
thickProvisionMetaKey = "rbd.csi.ceph.com/thick-provisioned"
|
thickProvisionMetaKey = "rbd.csi.ceph.com/thick-provisioned"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// nolint:gomnd // numbers specify Kernel versions.
|
||||||
|
var nbdResizeSupport = []util.KernelVersion{
|
||||||
|
{
|
||||||
|
Version: 5,
|
||||||
|
PatchLevel: 3,
|
||||||
|
SubLevel: 0,
|
||||||
|
ExtraVersion: 0,
|
||||||
|
Distribution: "",
|
||||||
|
Backport: false,
|
||||||
|
}, // standard 5.3+ versions
|
||||||
|
}
|
||||||
|
|
||||||
func imageSpec(pool, image string) string {
|
func imageSpec(pool, image string) string {
|
||||||
if radosNamespace != "" {
|
if radosNamespace != "" {
|
||||||
return pool + "/" + radosNamespace + "/" + image
|
return pool + "/" + radosNamespace + "/" + image
|
||||||
|
Loading…
Reference in New Issue
Block a user