diff --git a/pkg/util/esxi/host.go b/pkg/util/esxi/host.go index a63e8c238f..89495e5b2e 100644 --- a/pkg/util/esxi/host.go +++ b/pkg/util/esxi/host.go @@ -565,6 +565,7 @@ func (host *SHost) newLocalStorageCache() (*SDatastoreImageCache, error) { if err != nil { return nil, err } + var errmsg string var cacheDs *SDatastore var maxDs *SDatastore var maxCapacity int @@ -576,9 +577,12 @@ func (host *SHost) newLocalStorageCache() (*SDatastoreImageCache, error) { _, err := ds.CheckFile(ctx, IMAGE_CACHE_DIR_NAME) if err != nil { if err != cloudprovider.ErrNotFound { - return nil, err - } - if maxCapacity < ds.GetCapacityMB() { + // return nil, err + if len(errmsg) > 0 { + errmsg += "," + } + errmsg += err.Error() + } else if maxCapacity < ds.GetCapacityMB() { maxCapacity = ds.GetCapacityMB() maxDs = ds } @@ -592,6 +596,10 @@ func (host *SHost) newLocalStorageCache() (*SDatastoreImageCache, error) { cacheDs = maxDs } + if cacheDs == nil { + return nil, fmt.Errorf(errmsg) + } + return &SDatastoreImageCache{ datastore: cacheDs, host: host,