fix: allow uncache deleted image (#24349)

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
Jian Qiu
2026-02-26 23:08:24 +08:00
committed by GitHub
parent d7b099efa0
commit 0ff2ef0e19
2 changed files with 6 additions and 3 deletions
+3
View File
@@ -432,6 +432,9 @@ func (manager *SCachedimageManager) getImageByName(ctx context.Context, userCred
s := auth.GetSession(ctx, userCred, options.Options.Region)
obj, err := image.Images.GetByName(s, imageId, nil)
if err != nil {
if httputils.ErrorCode(err) == 404 {
err = httperrors.ErrNotFound
}
return nil, errors.Wrap(err, "modules.Images.GetByName")
}
cachedImage, err := manager.cacheGlanceImageInfo(ctx, userCred, obj)
+3 -3
View File
@@ -588,10 +588,10 @@ func (sc *SStoragecache) PerformUncacheImage(ctx context.Context, userCred mccli
}
imageId = imgObj.GetId()
_, err := CachedimageManager.getImageInfo(ctx, userCred, imageStr, isForce)
if err != nil {
log.Infof("image %s not found %s", imageStr, err)
if err != nil && errors.Cause(err) != httperrors.ErrNotFound {
log.Infof("get image %s info error %s", imageStr, err)
if !isForce {
return nil, httperrors.NewImageNotFoundError(imageStr)
return nil, errors.Wrapf(err, "get image %s info", imageStr)
}
}
}