Merge pull request #2896 from ioito/hotfix/qx-image-cache

fix: avoid nil pointer
This commit is contained in:
yunion-ci-robot
2019-09-12 17:18:23 +08:00
committed by GitHub
@@ -18,6 +18,7 @@ package storageman
import (
"context"
"fmt"
"strings"
"sync"
@@ -116,6 +117,9 @@ func (c *SRbdImageCacheManager) PrefetchImageCache(ctx context.Context, data int
zone, _ := body.GetString("zone")
cache := c.AcquireImage(ctx, imageId, zone, srcUrl, format)
if cache == nil {
return nil, fmt.Errorf("failed to cache image %s.%s", imageId, format)
}
res := map[string]interface{}{
"image_id": imageId,