mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 06:20:11 +01:00
fix(pvc): fixing stale ZFSVolume CR issue when deleting pending PVC
PVC will not bound if there are wrong parameters/poolname in the storageclass, the ZFSVolume CR will be still created and will remain in Pending State, deletion of the PVC will delete PVC and since PVC is not bound, ZFS-LocalPV driver will not get the delete call and will leave the ZFSVolume CR hanging there. Reverting the behavior introduced in https://github.com/openebs/zfs-localpv/pull/121, Now PVC will be bound but still ZFSVolume will be in Pending state until the volume is created. Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
parent
0e2223985e
commit
45015bf063
4 changed files with 8 additions and 27 deletions
|
|
@ -194,12 +194,12 @@ func MountDataset(vol *apis.ZFSVolume, mount *apis.MountInfo) error {
|
|||
volume := vol.Spec.PoolName + "/" + vol.Name
|
||||
err := verifyMountRequest(vol, mount.MountPath)
|
||||
if err != nil {
|
||||
return status.Error(codes.Internal, "dataset can not be mounted")
|
||||
return status.Error(codes.Internal, "invalid mount request")
|
||||
}
|
||||
|
||||
err = MountZFSDataset(vol, mount.MountPath)
|
||||
if err != nil {
|
||||
return status.Error(codes.Internal, "not able to mount the dataset")
|
||||
return status.Errorf(codes.Internal, "zfs: mount failed err : %v", err.Error())
|
||||
}
|
||||
|
||||
logrus.Infof("dataset %v mounted %v", volume, mount.MountPath)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"os/exec"
|
||||
"path/filepath"
|
||||
|
||||
"fmt"
|
||||
"github.com/Sirupsen/logrus"
|
||||
apis "github.com/openebs/zfs-localpv/pkg/apis/openebs.io/zfs/v1"
|
||||
)
|
||||
|
|
@ -379,8 +380,9 @@ func SetDatasetMountProp(volume string, mountpath string) error {
|
|||
if err != nil {
|
||||
logrus.Errorf("zfs: could not set mountpoint on dataset %v cmd %v error: %s",
|
||||
volume, ZFSVolArg, string(out))
|
||||
return fmt.Errorf("could not set the mountpoint, %s", string(out))
|
||||
}
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
// MountZFSDataset mounts the dataset to the given mountpoint
|
||||
|
|
@ -412,7 +414,7 @@ func MountZFSDataset(vol *apis.ZFSVolume, mountpath string) error {
|
|||
if err != nil {
|
||||
logrus.Errorf("zfs: could not mount the dataset %v cmd %v error: %s",
|
||||
volume, MountVolArg, string(out))
|
||||
return err
|
||||
return fmt.Errorf("not able to mount, %s", string(out))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -452,7 +454,7 @@ func GetVolumeProperty(vol *apis.ZFSVolume, prop string) (string, error) {
|
|||
if err != nil {
|
||||
logrus.Errorf("zfs: could not get %s on dataset %v cmd %v error: %s",
|
||||
prop, volume, ZFSVolArg, string(out))
|
||||
return "", err
|
||||
return "", fmt.Errorf("get %s failed, %s", prop, string(out))
|
||||
}
|
||||
val := out[:len(out)-1]
|
||||
return string(val), nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue