Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:openebs/cstor-csi into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek Agarwal committed Jul 1, 2022
2 parents e7d8d59 + 0dc9a87 commit 8b6ffa2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ func (ns *node) NodeUnstageVolume(
}
defer removeVolumeFromTransitionList(volumeID)

logrus.Infof("Volume with ID: %v after uninitialising is in '%v' state", volumeID, utils.TransitionVolList[volumeID])

if vol, err = utils.GetCStorVolumeAttachment(volumeID + "-" + utils.NodeIDENV); err != nil {
if k8serror.IsNotFound(err) {
logrus.Infof("cva for %s has already been deleted", volumeID)
Expand Down Expand Up @@ -281,6 +283,7 @@ func (ns *node) NodeUnstageVolume(
// so all the cases are handled
utils.TransitionVolListLock.Lock()
utils.TransitionVolList[volumeID] = apis.CStorVolumeAttachmentStatusUnmountUnderProgress
logrus.Infof("Volume with ID: %v after starting unmount is in '%v' state", volumeID, utils.TransitionVolList[volumeID])
utils.TransitionVolListLock.Unlock()

if err = iscsiutils.UnmountAndDetachDisk(vol, stagingTargetPath); err != nil {
Expand All @@ -289,6 +292,7 @@ func (ns *node) NodeUnstageVolume(

utils.TransitionVolListLock.Lock()
utils.TransitionVolList[volumeID] = apis.CStorVolumeAttachmentStatusUnmounted
logrus.Infof("Volume with ID: %v after successful unmount is in '%v' state", volumeID, utils.TransitionVolList[volumeID])
utils.TransitionVolListLock.Unlock()

vol.Finalizers = nil
Expand Down
2 changes: 2 additions & 0 deletions pkg/driver/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package driver

import (
"fmt"
"github.com/sirupsen/logrus"

"github.com/container-storage-interface/spec/lib/go/csi"
apisv1 "github.com/openebs/api/v3/pkg/apis/cstor/v1"
Expand Down Expand Up @@ -88,6 +89,7 @@ func removeVolumeFromTransitionList(volumeID string) {
utils.TransitionVolListLock.Lock()
defer utils.TransitionVolListLock.Unlock()
delete(utils.TransitionVolList, volumeID)
logrus.Infof("Volume with ID: %v has been successfully removed from the transition volume list: %v", volumeID, utils.TransitionVolList)
}

func addVolumeToTransitionList(volumeID string, status apisv1.CStorVolumeAttachmentStatus) error {
Expand Down
4 changes: 4 additions & 0 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ func MonitorMounts() {
for _, vol := range csivolList.Items {
// ignore monitoring for volumes with deletion timestamp set
if vol.DeletionTimestamp != nil {
logrus.Infof("CVA: %v for volume: %v has been marked for cleanup activity", vol.Name, vol.Spec.Volume.Name)
cleanupRequired = true
continue
}
Expand Down Expand Up @@ -372,6 +373,8 @@ func Cleanup() (err error) {
}
vol := Vol
TransitionVolList[vol.Spec.Volume.Name] = apis.CStorVolumeAttachmentStatusUnmountUnderProgress

logrus.Infof("Volume: %v marked as %v as part of cleanup activity", vol.Spec.Volume.Name, TransitionVolList[vol.Spec.Volume.Name])
// This is being run in a go routine so that if unmount and detach
// commands take time, the startup is not delayed
go func(vol *apis.CStorVolumeAttachment) {
Expand All @@ -388,6 +391,7 @@ func Cleanup() (err error) {

TransitionVolListLock.Lock()
delete(TransitionVolList, vol.Spec.Volume.Name)
logrus.Infof("Volume: %v has been successfully removed from the transition volume list after cleanup: %v", vol.Spec.Volume.Name, TransitionVolList)
TransitionVolListLock.Unlock()
}(&vol)
}
Expand Down

0 comments on commit 8b6ffa2

Please sign in to comment.