From 1ca00c14c6d0e3e9342f8e2a0a5586f6b2fc7a2c Mon Sep 17 00:00:00 2001 From: Qiu Jian Date: Tue, 12 Mar 2019 21:48:40 +0800 Subject: [PATCH] fix: find image peer host with local storage only --- pkg/compute/models/cachedimages.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/compute/models/cachedimages.go b/pkg/compute/models/cachedimages.go index 631b3e1080..6421b4b06a 100644 --- a/pkg/compute/models/cachedimages.go +++ b/pkg/compute/models/cachedimages.go @@ -345,7 +345,8 @@ func (self *SCachedimage) ChooseSourceStoragecacheInRange(hostType string, exclu Filter(sqlchemy.IsTrue(host.Field("enabled"))). Filter(sqlchemy.Equals(host.Field("host_status"), HOST_ONLINE)). Filter(sqlchemy.IsTrue(storage.Field("enabled"))). - Filter(sqlchemy.In(storage.Field("status"), []string{STORAGE_ENABLED, STORAGE_ONLINE})) + Filter(sqlchemy.In(storage.Field("status"), []string{STORAGE_ENABLED, STORAGE_ONLINE})). + Filter(sqlchemy.Equals(storage.Field("storage_type"), STORAGE_LOCAL)) if len(excludes) > 0 { q = q.Filter(sqlchemy.NotIn(host.Field("id"), excludes))