fix invalid memory address or nil pointer error

This commit is contained in:
ioito
2019-06-19 16:51:36 +08:00
parent c1b5f1f0c8
commit 3423557ac1
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -378,7 +378,7 @@ func (self *SStoragecache) StartImageUncacheTask(ctx context.Context, userCred m
func (self *SStoragecache) GetIStorageCache() (cloudprovider.ICloudStoragecache, error) {
storages := self.getValidStorages()
if len(storages) == 0 {
msg := "no storages for this storagecache???"
msg := fmt.Sprintf("no storages for this storagecache %s(%s)???", self.Name, self.Id)
log.Errorf(msg)
return nil, fmt.Errorf(msg)
}
+1
View File
@@ -123,6 +123,7 @@ func (self *SStoragecache) uploadImage(ctx context.Context, userCred mcclient.To
if err != nil {
return "", err
}
img.storageCache = self
err = cloudprovider.WaitStatus(img, api.CACHED_IMAGE_STATUS_READY, time.Second*5, time.Minute*10) //windows镜像转换比较慢,等待时间稍微设长一些
if err != nil {
log.Errorf("waitting for image %s(%s) status ready timeout", img.Name, img.UUID)