If bucket is not created by csi-s3, it will not be deleted by csi-s3 automatically
This commit is contained in:
parent
fae1210aaf
commit
fbc265dff7
1 changed files with 12 additions and 3 deletions
|
@ -145,9 +145,18 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if exists {
|
if exists {
|
||||||
if err := s3.removeBucket(volumeID); err != nil {
|
b, err := s3.getBucket(volumeID)
|
||||||
glog.V(3).Infof("Failed to remove volume %s: %v", volumeID, err)
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("Failed to get metadata of buckect %s", volumeID)
|
||||||
|
}
|
||||||
|
if b.CreatedByCsi {
|
||||||
|
if err := s3.removeBucket(volumeID); err != nil {
|
||||||
|
glog.V(3).Infof("Failed to remove volume %s: %v", volumeID, err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
glog.V(4).Infof("Bucket %s removed", volumeID)
|
||||||
|
} else {
|
||||||
|
glog.V(4).Infof("Bucket %s is not created by csi-s3, will not be deleted by csi-s3 automatically.", volumeID)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
glog.V(5).Infof("Bucket %s does not exist, ignoring request", volumeID)
|
glog.V(5).Infof("Bucket %s does not exist, ignoring request", volumeID)
|
||||||
|
|
Loading…
Reference in a new issue