e2e: use io-timeout conditionally based on kernel version

We need
https://www.mail-archive.com/linux-block@vger.kernel.org/msg38060.html
inorder to use `--io-timeout=0`. This patch is part of kernel 5.4

Since minikube doesn't have a v5.4 kernel yet, lets use io-timeout value
conditionally based on kernel version at our e2e.

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
Prasanna Kumar Kalever 2021-08-23 18:40:22 +05:30 committed by mergify[bot]
parent 1bd2d46cdb
commit 55d3226d6b
2 changed files with 51 additions and 23 deletions

View File

@ -57,6 +57,8 @@ var (
appBlockSmartClonePath = rbdExamplePath + "block-pod-clone.yaml" appBlockSmartClonePath = rbdExamplePath + "block-pod-clone.yaml"
snapshotPath = rbdExamplePath + "snapshot.yaml" snapshotPath = rbdExamplePath + "snapshot.yaml"
defaultCloneCount = 10 defaultCloneCount = 10
nbdMapOptions = "debug-rbd=20"
) )
func deployRBDPlugin() { func deployRBDPlugin() {
@ -178,6 +180,7 @@ func validateRBDImageCount(f *framework.Framework, count int, pool string) {
var _ = Describe("RBD", func() { var _ = Describe("RBD", func() {
f := framework.NewDefaultFramework("rbd") f := framework.NewDefaultFramework("rbd")
var c clientset.Interface var c clientset.Interface
var kernelRelease string
// deploy RBD CSI // deploy RBD CSI
BeforeEach(func() { BeforeEach(func() {
if !testRBD || upgradeTesting { if !testRBD || upgradeTesting {
@ -232,6 +235,27 @@ var _ = Describe("RBD", func() {
e2elog.Failf("failed to create node secret with error %v", err) e2elog.Failf("failed to create node secret with error %v", err)
} }
deployVault(f.ClientSet, deployTimeout) deployVault(f.ClientSet, deployTimeout)
// wait for provisioner deployment
err = waitForDeploymentComplete(rbdDeploymentName, cephCSINamespace, f.ClientSet, deployTimeout)
if err != nil {
e2elog.Failf("timeout waiting for deployment %s with error %v", rbdDeploymentName, err)
}
// wait for nodeplugin deamonset pods
err = waitForDaemonSets(rbdDaemonsetName, cephCSINamespace, f.ClientSet, deployTimeout)
if err != nil {
e2elog.Failf("timeout waiting for daemonset %s with error %v", rbdDaemonsetName, err)
}
kernelRelease, err = getKernelVersionFromDaemonset(f, cephCSINamespace, rbdDaemonsetName, "csi-rbdplugin")
if err != nil {
e2elog.Failf("failed to get the kernel version with error %v", err)
}
// default io-timeout=0, needs kernel >= 5.4
if !util.CheckKernelSupport(kernelRelease, nbdZeroIOtimeoutSupport) {
nbdMapOptions = "debug-rbd=20,io-timeout=330"
}
}) })
AfterEach(func() { AfterEach(func() {
@ -302,20 +326,6 @@ var _ = Describe("RBD", func() {
Context("Test RBD CSI", func() { Context("Test RBD CSI", func() {
It("Test RBD CSI", func() { It("Test RBD CSI", func() {
By("checking provisioner deployment is running", func() {
err := waitForDeploymentComplete(rbdDeploymentName, cephCSINamespace, f.ClientSet, deployTimeout)
if err != nil {
e2elog.Failf("timeout waiting for deployment %s with error %v", rbdDeploymentName, err)
}
})
By("checking nodeplugin deamonset pods are running", func() {
err := waitForDaemonSets(rbdDaemonsetName, cephCSINamespace, f.ClientSet, deployTimeout)
if err != nil {
e2elog.Failf("timeout waiting for daemonset %s with error %v", rbdDaemonsetName, err)
}
})
// test only if ceph-csi is deployed via helm // test only if ceph-csi is deployed via helm
if helmTest { if helmTest {
By("verify PVC and app binding on helm installation", func() { By("verify PVC and app binding on helm installation", func() {
@ -412,7 +422,7 @@ var _ = Describe("RBD", func() {
nil, nil,
map[string]string{ map[string]string{
"mounter": "rbd-nbd", "mounter": "rbd-nbd",
"mapOptions": "debug-rbd=20", "mapOptions": nbdMapOptions,
}, },
deletePolicy) deletePolicy)
if err != nil { if err != nil {
@ -435,10 +445,6 @@ var _ = Describe("RBD", func() {
}) })
By("Resize rbd-nbd PVC and check application directory size", 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) { if util.CheckKernelSupport(kernelRelease, nbdResizeSupport) {
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
@ -452,7 +458,7 @@ var _ = Describe("RBD", func() {
nil, nil,
map[string]string{ map[string]string{
"mounter": "rbd-nbd", "mounter": "rbd-nbd",
"mapOptions": "debug-rbd=20", "mapOptions": nbdMapOptions,
}, },
deletePolicy) deletePolicy)
if err != nil { if err != nil {
@ -497,7 +503,7 @@ var _ = Describe("RBD", func() {
nil, nil,
map[string]string{ map[string]string{
"mounter": "rbd-nbd", "mounter": "rbd-nbd",
"mapOptions": "debug-rbd=20", "mapOptions": nbdMapOptions,
}, },
deletePolicy) deletePolicy)
if err != nil { if err != nil {
@ -651,7 +657,7 @@ var _ = Describe("RBD", func() {
nil, nil,
map[string]string{ map[string]string{
"mounter": "rbd-nbd", "mounter": "rbd-nbd",
"mapOptions": "debug-rbd=20", "mapOptions": nbdMapOptions,
"encrypted": "true", "encrypted": "true",
}, },
deletePolicy) deletePolicy)
@ -1009,7 +1015,7 @@ var _ = Describe("RBD", func() {
map[string]string{ map[string]string{
"imageFeatures": "layering,journaling,exclusive-lock", "imageFeatures": "layering,journaling,exclusive-lock",
"mounter": "rbd-nbd", "mounter": "rbd-nbd",
"mapOptions": "debug-rbd=20", "mapOptions": nbdMapOptions,
}, },
deletePolicy) deletePolicy)
if err != nil { if err != nil {

View File

@ -40,6 +40,28 @@ var nbdResizeSupport = []util.KernelVersion{
}, // standard 5.3+ versions }, // standard 5.3+ versions
} }
// To use `io-timeout=0` we need
// www.mail-archive.com/linux-block@vger.kernel.org/msg38060.html
// nolint:gomnd // numbers specify Kernel versions.
var nbdZeroIOtimeoutSupport = []util.KernelVersion{
{
Version: 5,
PatchLevel: 4,
SubLevel: 0,
ExtraVersion: 0,
Distribution: "",
Backport: false,
}, // standard 5.4+ versions
{
Version: 4,
PatchLevel: 18,
SubLevel: 0,
ExtraVersion: 305,
Distribution: ".el8",
Backport: true,
}, // CentOS 8.4
}
func imageSpec(pool, image string) string { func imageSpec(pool, image string) string {
if radosNamespace != "" { if radosNamespace != "" {
return pool + "/" + radosNamespace + "/" + image return pool + "/" + radosNamespace + "/" + image