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
|
|
@ -209,16 +209,6 @@ func (cs *controller) CreateVolume(
|
|||
return nil, err
|
||||
}
|
||||
|
||||
selected, state, err := zfs.GetZFSVolumeState(req.Name)
|
||||
|
||||
if err == nil {
|
||||
// ZFSVolume CR has been created, check if it is in Ready state
|
||||
if state == zfs.ZFSStatusReady {
|
||||
goto CreateVolumeResponse
|
||||
}
|
||||
return nil, status.Errorf(codes.Internal, "volume %s creation is Pending", volName)
|
||||
}
|
||||
|
||||
if contentSource != nil && contentSource.GetSnapshot() != nil {
|
||||
snapshotID := contentSource.GetSnapshot().GetSnapshotId()
|
||||
|
||||
|
|
@ -231,18 +221,6 @@ func (cs *controller) CreateVolume(
|
|||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
_, state, err = zfs.GetZFSVolumeState(req.Name)
|
||||
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "createvolume: failed to fetch the volume %v", err.Error())
|
||||
}
|
||||
|
||||
if state == zfs.ZFSStatusPending {
|
||||
return nil, status.Errorf(codes.Internal, "volume %s is being created", volName)
|
||||
}
|
||||
|
||||
CreateVolumeResponse:
|
||||
|
||||
sendEventOrIgnore(volName, strconv.FormatInt(int64(size), 10), "zfs-localpv", analytics.VolumeProvision)
|
||||
|
||||
topology := map[string]string{zfs.ZFSTopologyKey: selected}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue