mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: esxi ignore check file failure in host.getIStoragecache (#335)
This commit is contained in:
committed by
yunion-ci-robot
parent
0c9fcb2ba4
commit
c07faba68b
+11
-3
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user