fix problem: log format; fs meta;

This commit is contained in:
boxjan 2021-04-08 22:35:31 +08:00
parent 7b5a3f6f4d
commit fa9ef78362
2 changed files with 4 additions and 14 deletions

View file

@ -167,8 +167,8 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
}
if deleteErr != nil {
glog.Warning("remove volume failed, will ensure fsmeta exist, or may will lost control")
if err := client.EnsureFSMetaExist(meta, bucketName, prefix); err != nil {
glog.Warning("remove volume failed, will ensure fsmeta exists to avoid losing control over volume")
if err := client.SetFSMeta(meta); err != nil {
glog.Error(err)
}
return nil, deleteErr

View file

@ -100,7 +100,7 @@ func (client *s3Client) RemovePrefix(bucketName string, prefix string) error {
return client.minio.RemoveObject(client.ctx, bucketName, prefix, minio.RemoveObjectOptions{})
}
glog.Warning("removeObjects failed with: ", err, ", will try removeObjectsOneByOne")
glog.Warningf("removeObjects failed with: %s, will try removeObjectsOneByOne", err)
if err = client.removeObjectsOneByOne(bucketName, prefix); err == nil {
return client.minio.RemoveObject(client.ctx, bucketName, prefix, minio.RemoveObjectOptions{})
@ -116,7 +116,7 @@ func (client *s3Client) RemoveBucket(bucketName string) error {
return client.minio.RemoveBucket(client.ctx, bucketName)
}
glog.Warning("removeObjects failed with: ", err, ", will try removeObjectsOneByOne")
glog.Warningf("removeObjects failed with: %s, will try removeObjectsOneByOne", err)
if err = client.removeObjectsOneByOne(bucketName, ""); err == nil {
return client.minio.RemoveBucket(client.ctx, bucketName)
@ -254,13 +254,3 @@ func (client *s3Client) GetFSMeta(bucketName, prefix string) (*FSMeta, error) {
err = json.Unmarshal(b, &meta)
return &meta, err
}
func (client *s3Client) EnsureFSMetaExist(meta *FSMeta, bucketName, prefix string) error {
if _, err := client.GetFSMeta(bucketName, prefix); err != nil {
glog.Warningf("%s/%s get meta failed with: %s, will set meta of it", bucketName, prefix, err)
if err := client.SetFSMeta(meta); err != nil {
return fmt.Errorf("%s/%s get meta failed with: %s, may will lost control of it", bucketName, prefix, err)
}
}
return nil
}