mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix(host): check image desc is empty (#22057)
image.inf record chksum or image id not matched will cause image desc empty
This commit is contained in:
@@ -2709,7 +2709,7 @@ func (h *SHostInfo) getProcessesPids(processesPrefix []string) (map[string]strin
|
||||
segs := strings.Split(cmdline, "\x00")
|
||||
if utils.IsInStringArray(segs[0], processesPrefix) {
|
||||
res[segs[0]] = f.Name()
|
||||
log.Infof("getProcessesPids append %s %s", segs[0], f.Name())
|
||||
log.Debugf("getProcessesPids append %s %s", segs[0], f.Name())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +150,8 @@ func (l *SLocalImageCache) Load() error {
|
||||
if len(desc.Chksum) > 0 && len(desc.Id) > 0 && desc.Id == l.imageId {
|
||||
l.Desc = desc
|
||||
return nil
|
||||
} else {
|
||||
log.Errorf("image %s desc not correct, desc.Chksum %s desc.Id %s l.imageId %s", imgPath, desc.Chksum, desc.Id, l.imageId)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -192,8 +192,11 @@ func (c *SLocalImageCacheManager) getTotalSize(ctx context.Context) (int64, map[
|
||||
images := make(map[string]IImageCache)
|
||||
c.cachedImages.Range(func(imgId, imgObj any) bool {
|
||||
img := imgObj.(IImageCache)
|
||||
total += img.GetDesc().SizeMb
|
||||
images[imgId.(string)] = img
|
||||
imgDesc := img.GetDesc()
|
||||
if imgDesc != nil {
|
||||
total += img.GetDesc().SizeMb
|
||||
images[imgId.(string)] = img
|
||||
}
|
||||
return true
|
||||
})
|
||||
return total, images
|
||||
|
||||
Reference in New Issue
Block a user