diff --git a/pkg/compute/models/cachedimages.go b/pkg/compute/models/cachedimages.go index d634f37f81..10ff08b712 100644 --- a/pkg/compute/models/cachedimages.go +++ b/pkg/compute/models/cachedimages.go @@ -424,18 +424,22 @@ func (manager *SCachedimageManager) newFromCloudImage(ctx context.Context, userC func (image *SCachedimage) requestRefreshExternalImage(ctx context.Context, userCred mcclient.TokenCredential) (*cloudprovider.SImage, error) { caches := image.getValidStoragecache() if caches == nil || len(caches) == 0 { + log.Errorf("requestRefreshExternalImage: no valid storage cache") return nil, fmt.Errorf("no valid storage cache") } iCache, err := caches[0].GetIStorageCache() if err != nil { + log.Errorf("GetIStorageCache fail %s", err) return nil, err } iImage, err := iCache.GetIImageById(image.ExternalId) if err != nil { + log.Errorf("iCache.GetIImageById fail %s", err) return nil, err } err = image.syncWithCloudImage(ctx, userCred, iImage) if err != nil { + log.Errorf("image.syncWithCloudImage fail %s", err) return nil, err } return image.GetImage() diff --git a/pkg/util/huawei/client/modules/mod_images.go b/pkg/util/huawei/client/modules/mod_images.go index af4616125d..6004359965 100644 --- a/pkg/util/huawei/client/modules/mod_images.go +++ b/pkg/util/huawei/client/modules/mod_images.go @@ -41,6 +41,7 @@ func NewImageManager(regionId string, projectId string, signer auth.Signer, debu }} } +//https://support.huaweicloud.com/api-ims/zh-cn_topic_0020091566.html func (self *SImageManager) Get(id string, querys map[string]string) (jsonutils.JSONObject, error) { if querys == nil { querys = make(map[string]string, 0) @@ -48,9 +49,9 @@ func (self *SImageManager) Get(id string, querys map[string]string) (jsonutils.J querys["id"] = id // 这里默认使用private - if t, exists := querys["__imagetype"]; !exists || len(t) == 0 { - querys["__imagetype"] = "private" - } + // if t, exists := querys["__imagetype"]; !exists || len(t) == 0 { + // querys["__imagetype"] = "private" + // } ret, err := self.ListInContext(nil, querys) if err != nil { diff --git a/pkg/util/huawei/shell/image.go b/pkg/util/huawei/shell/image.go index 17ffc4db1c..661677e1cf 100644 --- a/pkg/util/huawei/shell/image.go +++ b/pkg/util/huawei/shell/image.go @@ -30,4 +30,13 @@ func init() { shellutils.R(&ImageDeleteOptions{}, "image-delete", "Delete image", func(cli *huawei.SRegion, args *ImageDeleteOptions) error { return cli.DeleteImage(args.ID) }) + + shellutils.R(&ImageDeleteOptions{}, "image-show", "Show image", func(cli *huawei.SRegion, args *ImageDeleteOptions) error { + img, err := cli.GetImage(args.ID) + if err != nil { + return err + } + printObject(img) + return nil + }) }