2021-12-21 14:23:26 +00:00
|
|
|
/*
|
|
|
|
Copyright 2021 The Ceph-CSI Authors.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2020-04-16 07:09:59 +00:00
|
|
|
package e2e
|
|
|
|
|
|
|
|
import (
|
2020-05-05 03:48:52 +00:00
|
|
|
"context"
|
2020-04-16 07:09:59 +00:00
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
2022-05-24 03:43:35 +00:00
|
|
|
snapapi "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1"
|
|
|
|
snapclient "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1"
|
2020-04-16 07:09:59 +00:00
|
|
|
. "github.com/onsi/gomega" // nolint
|
2021-12-16 05:27:46 +00:00
|
|
|
v1 "k8s.io/api/core/v1"
|
2020-04-16 07:09:59 +00:00
|
|
|
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
2021-12-16 05:27:46 +00:00
|
|
|
"k8s.io/apimachinery/pkg/api/resource"
|
2020-04-16 07:09:59 +00:00
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
|
|
"k8s.io/apimachinery/pkg/util/wait"
|
|
|
|
"k8s.io/kubernetes/test/e2e/framework"
|
|
|
|
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
|
|
|
|
)
|
|
|
|
|
|
|
|
func getSnapshotClass(path string) snapapi.VolumeSnapshotClass {
|
|
|
|
sc := snapapi.VolumeSnapshotClass{}
|
|
|
|
err := unmarshal(path, &sc)
|
|
|
|
Expect(err).Should(BeNil())
|
2021-07-22 05:45:17 +00:00
|
|
|
|
2020-04-16 07:09:59 +00:00
|
|
|
return sc
|
|
|
|
}
|
|
|
|
|
|
|
|
func getSnapshot(path string) snapapi.VolumeSnapshot {
|
|
|
|
sc := snapapi.VolumeSnapshot{}
|
|
|
|
err := unmarshal(path, &sc)
|
|
|
|
Expect(err).Should(BeNil())
|
2021-07-22 05:45:17 +00:00
|
|
|
|
2020-04-16 07:09:59 +00:00
|
|
|
return sc
|
|
|
|
}
|
|
|
|
|
2021-06-23 05:35:30 +00:00
|
|
|
func newSnapshotClient() (*snapclient.SnapshotV1Client, error) {
|
2020-04-16 07:09:59 +00:00
|
|
|
config, err := framework.LoadConfig()
|
|
|
|
if err != nil {
|
2021-06-25 11:19:37 +00:00
|
|
|
return nil, fmt.Errorf("error creating client: %w", err)
|
2020-04-16 07:09:59 +00:00
|
|
|
}
|
|
|
|
c, err := snapclient.NewForConfig(config)
|
|
|
|
if err != nil {
|
2021-06-25 11:19:37 +00:00
|
|
|
return nil, fmt.Errorf("error creating snapshot client: %w", err)
|
2020-04-16 07:09:59 +00:00
|
|
|
}
|
2021-07-22 05:45:17 +00:00
|
|
|
|
2020-04-16 07:09:59 +00:00
|
|
|
return c, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func createSnapshot(snap *snapapi.VolumeSnapshot, t int) error {
|
|
|
|
sclient, err := newSnapshotClient()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-06-25 13:02:50 +00:00
|
|
|
|
|
|
|
_, err = sclient.
|
|
|
|
VolumeSnapshots(snap.Namespace).
|
|
|
|
Create(context.TODO(), snap, metav1.CreateOptions{})
|
2020-04-16 07:09:59 +00:00
|
|
|
if err != nil {
|
2021-05-11 09:28:56 +00:00
|
|
|
return fmt.Errorf("failed to create volumesnapshot: %w", err)
|
2020-04-16 07:09:59 +00:00
|
|
|
}
|
|
|
|
e2elog.Logf("snapshot with name %v created in %v namespace", snap.Name, snap.Namespace)
|
|
|
|
|
|
|
|
timeout := time.Duration(t) * time.Minute
|
|
|
|
name := snap.Name
|
|
|
|
start := time.Now()
|
2020-05-15 08:34:59 +00:00
|
|
|
e2elog.Logf("waiting for %v to be in ready state", snap)
|
2020-04-16 07:09:59 +00:00
|
|
|
|
|
|
|
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
|
|
|
e2elog.Logf("waiting for snapshot %s (%d seconds elapsed)", snap.Name, int(time.Since(start).Seconds()))
|
2021-06-25 13:02:50 +00:00
|
|
|
snaps, err := sclient.
|
|
|
|
VolumeSnapshots(snap.Namespace).
|
|
|
|
Get(context.TODO(), name, metav1.GetOptions{})
|
2020-04-16 07:09:59 +00:00
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("Error getting snapshot in namespace: '%s': %v", snap.Namespace, err)
|
2020-12-17 13:00:02 +00:00
|
|
|
if isRetryableAPIError(err) {
|
2020-04-16 07:09:59 +00:00
|
|
|
return false, nil
|
|
|
|
}
|
|
|
|
if apierrs.IsNotFound(err) {
|
|
|
|
return false, nil
|
|
|
|
}
|
2021-07-22 05:45:17 +00:00
|
|
|
|
2021-05-11 09:28:56 +00:00
|
|
|
return false, fmt.Errorf("failed to get volumesnapshot: %w", err)
|
2020-04-16 07:09:59 +00:00
|
|
|
}
|
|
|
|
if snaps.Status == nil || snaps.Status.ReadyToUse == nil {
|
|
|
|
return false, nil
|
|
|
|
}
|
|
|
|
if *snaps.Status.ReadyToUse {
|
|
|
|
return true, nil
|
|
|
|
}
|
|
|
|
e2elog.Logf("snapshot %s in %v state", snap.Name, *snaps.Status.ReadyToUse)
|
2021-07-22 05:45:17 +00:00
|
|
|
|
2020-04-16 07:09:59 +00:00
|
|
|
return false, nil
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func deleteSnapshot(snap *snapapi.VolumeSnapshot, t int) error {
|
|
|
|
sclient, err := newSnapshotClient()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-06-25 13:02:50 +00:00
|
|
|
|
|
|
|
err = sclient.
|
|
|
|
VolumeSnapshots(snap.Namespace).
|
|
|
|
Delete(context.TODO(), snap.Name, metav1.DeleteOptions{})
|
2020-04-16 07:09:59 +00:00
|
|
|
if err != nil {
|
2021-05-11 09:28:56 +00:00
|
|
|
return fmt.Errorf("failed to delete volumesnapshot: %w", err)
|
2020-04-16 07:09:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
timeout := time.Duration(t) * time.Minute
|
|
|
|
name := snap.Name
|
|
|
|
start := time.Now()
|
|
|
|
e2elog.Logf("Waiting up to %v to be deleted", snap)
|
|
|
|
|
|
|
|
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
|
|
|
e2elog.Logf("deleting snapshot %s (%d seconds elapsed)", name, int(time.Since(start).Seconds()))
|
2021-06-25 13:02:50 +00:00
|
|
|
_, err := sclient.
|
|
|
|
VolumeSnapshots(snap.Namespace).
|
|
|
|
Get(context.TODO(), name, metav1.GetOptions{})
|
2020-04-16 07:09:59 +00:00
|
|
|
if err == nil {
|
|
|
|
return false, nil
|
|
|
|
}
|
|
|
|
|
2021-06-29 05:43:53 +00:00
|
|
|
if isRetryableAPIError(err) {
|
|
|
|
return false, nil
|
|
|
|
}
|
2020-04-16 07:09:59 +00:00
|
|
|
if !apierrs.IsNotFound(err) {
|
2021-06-25 13:02:50 +00:00
|
|
|
return false, fmt.Errorf(
|
2021-11-22 06:56:50 +00:00
|
|
|
"get on deleted snapshot %v failed : other than \"not found\": %w",
|
2021-06-25 13:02:50 +00:00
|
|
|
name,
|
|
|
|
err)
|
2020-04-16 07:09:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true, nil
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-09-03 09:34:29 +00:00
|
|
|
func createRBDSnapshotClass(f *framework.Framework) error {
|
2020-04-16 07:09:59 +00:00
|
|
|
scPath := fmt.Sprintf("%s/%s", rbdExamplePath, "snapshotclass.yaml")
|
|
|
|
sc := getSnapshotClass(scPath)
|
|
|
|
|
|
|
|
sc.Parameters["csi.storage.k8s.io/snapshotter-secret-namespace"] = cephCSINamespace
|
2021-02-22 11:13:40 +00:00
|
|
|
sc.Parameters["csi.storage.k8s.io/snapshotter-secret-name"] = rbdProvisionerSecretName
|
2020-04-16 07:09:59 +00:00
|
|
|
|
2022-04-08 11:08:32 +00:00
|
|
|
fsID, err := getClusterID(f)
|
2020-09-03 09:34:29 +00:00
|
|
|
if err != nil {
|
2022-04-08 11:08:32 +00:00
|
|
|
return fmt.Errorf("failed to get clusterID: %w", err)
|
2020-09-03 09:34:29 +00:00
|
|
|
}
|
2020-04-16 07:09:59 +00:00
|
|
|
sc.Parameters["clusterID"] = fsID
|
|
|
|
sclient, err := newSnapshotClient()
|
2020-09-03 09:34:29 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-06-23 05:35:30 +00:00
|
|
|
_, err = sclient.VolumeSnapshotClasses().Create(context.TODO(), &sc, metav1.CreateOptions{})
|
2021-07-22 05:45:17 +00:00
|
|
|
|
2020-09-03 09:34:29 +00:00
|
|
|
return err
|
2020-04-16 07:09:59 +00:00
|
|
|
}
|
2020-08-03 17:00:27 +00:00
|
|
|
|
2021-04-08 15:46:11 +00:00
|
|
|
func deleteRBDSnapshotClass() error {
|
|
|
|
scPath := fmt.Sprintf("%s/%s", rbdExamplePath, "snapshotclass.yaml")
|
|
|
|
sc := getSnapshotClass(scPath)
|
|
|
|
|
|
|
|
sclient, err := newSnapshotClient()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-07-22 05:45:17 +00:00
|
|
|
|
2021-06-23 05:35:30 +00:00
|
|
|
return sclient.VolumeSnapshotClasses().Delete(context.TODO(), sc.Name, metav1.DeleteOptions{})
|
2021-04-08 15:46:11 +00:00
|
|
|
}
|
|
|
|
|
2020-09-03 09:34:29 +00:00
|
|
|
func createCephFSSnapshotClass(f *framework.Framework) error {
|
2021-09-20 10:16:55 +00:00
|
|
|
scPath := fmt.Sprintf("%s/%s", cephFSExamplePath, "snapshotclass.yaml")
|
2020-08-03 17:00:27 +00:00
|
|
|
sc := getSnapshotClass(scPath)
|
|
|
|
sc.Parameters["csi.storage.k8s.io/snapshotter-secret-namespace"] = cephCSINamespace
|
2021-02-22 11:13:40 +00:00
|
|
|
sc.Parameters["csi.storage.k8s.io/snapshotter-secret-name"] = cephFSProvisionerSecretName
|
2022-04-08 11:08:32 +00:00
|
|
|
|
|
|
|
fsID, err := getClusterID(f)
|
2020-09-03 09:34:29 +00:00
|
|
|
if err != nil {
|
2022-04-08 11:08:32 +00:00
|
|
|
return fmt.Errorf("failed to get clusterID: %w", err)
|
2020-09-03 09:34:29 +00:00
|
|
|
}
|
2020-08-03 17:00:27 +00:00
|
|
|
sc.Parameters["clusterID"] = fsID
|
|
|
|
sclient, err := newSnapshotClient()
|
2020-09-03 09:34:29 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-06-23 05:35:30 +00:00
|
|
|
_, err = sclient.VolumeSnapshotClasses().Create(context.TODO(), &sc, metav1.CreateOptions{})
|
2021-05-11 09:28:56 +00:00
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to create volumesnapshotclass: %w", err)
|
|
|
|
}
|
2021-07-22 05:45:17 +00:00
|
|
|
|
2020-09-03 09:34:29 +00:00
|
|
|
return err
|
2020-08-03 17:00:27 +00:00
|
|
|
}
|
2021-04-26 13:15:18 +00:00
|
|
|
|
2022-05-16 09:38:35 +00:00
|
|
|
func createNFSSnapshotClass(f *framework.Framework) error {
|
|
|
|
scPath := fmt.Sprintf("%s/%s", nfsExamplePath, "snapshotclass.yaml")
|
|
|
|
sc := getSnapshotClass(scPath)
|
|
|
|
sc.Parameters["csi.storage.k8s.io/snapshotter-secret-namespace"] = cephCSINamespace
|
|
|
|
sc.Parameters["csi.storage.k8s.io/snapshotter-secret-name"] = cephFSProvisionerSecretName
|
|
|
|
|
|
|
|
fsID, err := getClusterID(f)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to get clusterID: %w", err)
|
|
|
|
}
|
|
|
|
sc.Parameters["clusterID"] = fsID
|
|
|
|
sclient, err := newSnapshotClient()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
timeout := time.Duration(deployTimeout) * time.Minute
|
|
|
|
|
|
|
|
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
|
|
|
_, err = sclient.VolumeSnapshotClasses().Create(context.TODO(), &sc, metav1.CreateOptions{})
|
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("error creating SnapshotClass %q: %v", sc.Name, err)
|
|
|
|
if apierrs.IsAlreadyExists(err) {
|
|
|
|
return true, nil
|
|
|
|
}
|
|
|
|
if isRetryableAPIError(err) {
|
|
|
|
return false, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return false, fmt.Errorf("failed to create SnapshotClass %q: %w", sc.Name, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return true, nil
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func deleteNFSSnapshotClass() error {
|
|
|
|
scPath := fmt.Sprintf("%s/%s", nfsExamplePath, "snapshotclass.yaml")
|
|
|
|
sc := getSnapshotClass(scPath)
|
|
|
|
|
|
|
|
sclient, err := newSnapshotClient()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
timeout := time.Duration(deployTimeout) * time.Minute
|
|
|
|
|
|
|
|
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
|
|
|
err = sclient.VolumeSnapshotClasses().Delete(context.TODO(), sc.Name, metav1.DeleteOptions{})
|
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("error deleting SnapshotClass %q: %v", sc.Name, err)
|
|
|
|
if apierrs.IsNotFound(err) {
|
|
|
|
return true, nil
|
|
|
|
}
|
|
|
|
if isRetryableAPIError(err) {
|
|
|
|
return false, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return false, fmt.Errorf("failed to delete SnapshotClass %q: %w", sc.Name, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return true, nil
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-04-26 13:15:18 +00:00
|
|
|
func getVolumeSnapshotContent(namespace, snapshotName string) (*snapapi.VolumeSnapshotContent, error) {
|
|
|
|
sclient, err := newSnapshotClient()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-06-25 13:02:50 +00:00
|
|
|
|
|
|
|
snapshot, err := sclient.
|
|
|
|
VolumeSnapshots(namespace).
|
|
|
|
Get(context.TODO(), snapshotName, metav1.GetOptions{})
|
2021-04-26 13:15:18 +00:00
|
|
|
if err != nil {
|
2021-05-11 09:28:56 +00:00
|
|
|
return nil, fmt.Errorf("failed to get volumesnapshot: %w", err)
|
2021-04-26 13:15:18 +00:00
|
|
|
}
|
|
|
|
|
2021-06-25 13:02:50 +00:00
|
|
|
volumeSnapshotContent, err := sclient.
|
|
|
|
VolumeSnapshotContents().
|
|
|
|
Get(context.TODO(), *snapshot.Status.BoundVolumeSnapshotContentName, metav1.GetOptions{})
|
2021-04-26 13:15:18 +00:00
|
|
|
if err != nil {
|
2021-05-11 09:28:56 +00:00
|
|
|
return nil, fmt.Errorf("failed to get volumesnapshotcontent: %w", err)
|
2021-04-26 13:15:18 +00:00
|
|
|
}
|
2021-07-22 05:45:17 +00:00
|
|
|
|
2021-04-26 13:15:18 +00:00
|
|
|
return volumeSnapshotContent, nil
|
|
|
|
}
|
2021-12-16 05:27:46 +00:00
|
|
|
|
2022-05-04 15:54:15 +00:00
|
|
|
// nolint:gocyclo,cyclop // reduce complexity
|
2021-12-16 05:27:46 +00:00
|
|
|
func validateBiggerPVCFromSnapshot(f *framework.Framework,
|
|
|
|
pvcPath,
|
|
|
|
appPath,
|
|
|
|
snapPath,
|
|
|
|
pvcClonePath,
|
2022-06-01 10:17:19 +00:00
|
|
|
appClonePath string,
|
|
|
|
) error {
|
2021-12-16 05:27:46 +00:00
|
|
|
const (
|
|
|
|
size = "1Gi"
|
|
|
|
newSize = "2Gi"
|
|
|
|
)
|
|
|
|
pvc, err := loadPVC(pvcPath)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to load PVC: %w", err)
|
|
|
|
}
|
|
|
|
label := make(map[string]string)
|
|
|
|
pvc.Namespace = f.UniqueName
|
|
|
|
pvc.Spec.Resources.Requests[v1.ResourceStorage] = resource.MustParse(size)
|
|
|
|
app, err := loadApp(appPath)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to load app: %w", err)
|
|
|
|
}
|
|
|
|
label[appKey] = appLabel
|
|
|
|
app.Namespace = f.UniqueName
|
|
|
|
app.Labels = label
|
|
|
|
opt := metav1.ListOptions{
|
|
|
|
LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]),
|
|
|
|
}
|
|
|
|
err = createPVCAndApp("", f, pvc, app, deployTimeout)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to create pvc and application: %w", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
snap := getSnapshot(snapPath)
|
|
|
|
snap.Namespace = f.UniqueName
|
|
|
|
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
|
|
|
|
err = createSnapshot(&snap, deployTimeout)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to create snapshot: %w", err)
|
|
|
|
}
|
|
|
|
err = deletePVCAndApp("", f, pvc, app)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to delete pvc and application: %w", err)
|
|
|
|
}
|
|
|
|
pvcClone, err := loadPVC(pvcClonePath)
|
|
|
|
if err != nil {
|
|
|
|
e2elog.Failf("failed to load PVC: %v", err)
|
|
|
|
}
|
|
|
|
pvcClone.Namespace = f.UniqueName
|
|
|
|
pvcClone.Spec.DataSource.Name = snap.Name
|
|
|
|
pvcClone.Spec.Resources.Requests[v1.ResourceStorage] = resource.MustParse(newSize)
|
|
|
|
appClone, err := loadApp(appClonePath)
|
|
|
|
if err != nil {
|
|
|
|
e2elog.Failf("failed to load application: %v", err)
|
|
|
|
}
|
|
|
|
appClone.Namespace = f.UniqueName
|
|
|
|
appClone.Labels = label
|
|
|
|
err = createPVCAndApp("", f, pvcClone, appClone, deployTimeout)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to create pvc clone and application: %w", err)
|
|
|
|
}
|
|
|
|
err = deleteSnapshot(&snap, deployTimeout)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to delete snapshot: %w", err)
|
|
|
|
}
|
|
|
|
if pvcClone.Spec.VolumeMode == nil || *pvcClone.Spec.VolumeMode == v1.PersistentVolumeFilesystem {
|
|
|
|
err = checkDirSize(appClone, f, &opt, newSize)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to validate directory size: %w", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if pvcClone.Spec.VolumeMode != nil && *pvcClone.Spec.VolumeMode == v1.PersistentVolumeBlock {
|
|
|
|
err = checkDeviceSize(appClone, f, &opt, newSize)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to validate device size: %w", err)
|
|
|
|
}
|
2022-05-04 15:54:15 +00:00
|
|
|
|
|
|
|
// make sure we had unset snapshot metadata on CreateVolume
|
|
|
|
// from snapshot
|
|
|
|
var (
|
|
|
|
volSnapName string
|
|
|
|
volSnapNamespace string
|
|
|
|
volSnapContentName string
|
|
|
|
stdErr string
|
|
|
|
imageList []string
|
|
|
|
)
|
|
|
|
imageList, err = listRBDImages(f, defaultRBDPool)
|
|
|
|
if err != nil {
|
|
|
|
e2elog.Failf("failed to list rbd images: %v", err)
|
|
|
|
}
|
|
|
|
e2elog.Logf("list of rbd images: %v", imageList)
|
|
|
|
volSnapName, stdErr, err = execCommandInToolBoxPod(f,
|
|
|
|
formatImageMetaGetCmd(defaultRBDPool, imageList[0], volSnapNameKey),
|
|
|
|
rookNamespace)
|
|
|
|
if checkGetKeyError(err, stdErr) {
|
|
|
|
e2elog.Failf("found volume snapshot name %s/%s %s=%s: err=%v stdErr=%q",
|
|
|
|
rbdOptions(defaultRBDPool), imageList[0], volSnapNameKey, volSnapName, err, stdErr)
|
|
|
|
}
|
|
|
|
volSnapNamespace, stdErr, err = execCommandInToolBoxPod(f,
|
|
|
|
formatImageMetaGetCmd(defaultRBDPool, imageList[0], volSnapNamespaceKey),
|
|
|
|
rookNamespace)
|
|
|
|
if checkGetKeyError(err, stdErr) {
|
|
|
|
e2elog.Failf("found volume snapshot namespace %s/%s %s=%s: err=%v stdErr=%q",
|
|
|
|
rbdOptions(defaultRBDPool), imageList[0], volSnapNamespaceKey, volSnapNamespace, err, stdErr)
|
|
|
|
}
|
|
|
|
volSnapContentName, stdErr, err = execCommandInToolBoxPod(f,
|
|
|
|
formatImageMetaGetCmd(defaultRBDPool, imageList[0], volSnapContentNameKey),
|
|
|
|
rookNamespace)
|
|
|
|
if checkGetKeyError(err, stdErr) {
|
|
|
|
e2elog.Failf("found snapshotcontent name %s/%s %s=%s: err=%v stdErr=%q",
|
|
|
|
rbdOptions(defaultRBDPool), imageList[0], volSnapContentNameKey,
|
|
|
|
volSnapContentName, err, stdErr)
|
|
|
|
}
|
2021-12-16 05:27:46 +00:00
|
|
|
}
|
|
|
|
err = deletePVCAndApp("", f, pvcClone, appClone)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to delete pvc and application: %w", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|