mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 22:30:23 +00:00
e2e: retry creation of the RBD StorageClass
On occasion the creation of the StorageClass can fail due to an etcdserver timeout. If that happens, the creation can be attempted after a delay. This has already been done for CephFS StorageClasses, but was missed for RBD. See-also: ceph/ceph-csi@8a0377ef02 Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
e8652ee366
commit
b235c171ba
@ -167,9 +167,22 @@ func createRBDStorageClass(
|
|||||||
sc.MountOptions = append(sc.MountOptions, mOpt...)
|
sc.MountOptions = append(sc.MountOptions, mOpt...)
|
||||||
}
|
}
|
||||||
sc.ReclaimPolicy = &policy
|
sc.ReclaimPolicy = &policy
|
||||||
_, err = c.StorageV1().StorageClasses().Create(context.TODO(), &sc, metav1.CreateOptions{})
|
|
||||||
|
|
||||||
return err
|
timeout := time.Duration(deployTimeout) * time.Minute
|
||||||
|
|
||||||
|
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
||||||
|
_, err = c.StorageV1().StorageClasses().Create(context.TODO(), &sc, metav1.CreateOptions{})
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Logf("error creating StorageClass %q: %v", sc.Name, err)
|
||||||
|
if isRetryableAPIError(err) {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return false, fmt.Errorf("failed to create StorageClass %q: %w", sc.Name, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func createRadosNamespace(f *framework.Framework) error {
|
func createRadosNamespace(f *framework.Framework) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user