util: remove the deleteLock acquistion check for clone and snapshot

At present while acquiring the deleteLock on the volume, we check
for ongoing clone and snapshot creation operations on the same.
Considering snapshot and clone controllers does not allow parent
volume deletion on subjected operations, we can be free from this
extra check.

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal 2021-07-20 13:16:33 +05:30 committed by mergify[bot]
parent 82557e3f34
commit c42d4768ca

View File

@ -130,20 +130,11 @@ func (ol *OperationLock) tryAcquire(op operation, volumeID string) error {
val := ol.locks[cloneOpt][volumeID]
ol.locks[cloneOpt][volumeID] = val + 1
case deleteOp:
// / During delete operation the volume should not be under expand,
// clone or snapshot operation.
// During delete operation the volume should not be under expand,
// check any expand operation is going on for given volume ID
if _, ok := ol.locks[expandOp][volumeID]; ok {
return fmt.Errorf("an Expand operation with given id %s already exists", volumeID)
}
// check any clone operation is going on for given volume ID
if _, ok := ol.locks[cloneOpt][volumeID]; ok {
return fmt.Errorf("a Clone operation with given id %s already exists", volumeID)
}
// check any delete operation is going on for given volume ID
if _, ok := ol.locks[createOp][volumeID]; ok {
return fmt.Errorf("a Create operation with given id %s already exists", volumeID)
}
// check any restore operation is going on for given volume ID
if _, ok := ol.locks[restoreOp][volumeID]; ok {
return fmt.Errorf("a Restore operation with given id %s already exists", volumeID)