decouple the volume.Destroy() from the operation of unmountVolume()

This commit is contained in:
stlpmo
2019-12-24 17:20:34 +08:00
parent a18f62bbe7
commit 38e4b79125
2 changed files with 62 additions and 17 deletions

View File

@@ -169,3 +169,17 @@ func (l *DiskLocation) deleteEcVolumeById(vid needle.VolumeId) (e error) {
delete(l.ecVolumes, vid)
return
}
func (l *DiskLocation) unmountEcVolumeByCollection(collectionName string) map[needle.VolumeId]*erasure_coding.EcVolume {
deltaVols := make(map[needle.VolumeId]*erasure_coding.EcVolume, 0)
for k, v := range l.ecVolumes {
if v.Collection == collectionName {
deltaVols[k] = v
}
}
for k, _ := range deltaVols {
delete(l.ecVolumes, k)
}
return deltaVols
}