From ddde787707b944fbba1ccffdd32caf4054c093ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Thu, 3 Jan 2019 16:52:07 +0800 Subject: [PATCH] =?UTF-8?q?capabilities=20=E5=8F=AF=E7=94=A8storage?= =?UTF-8?q?=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/compute/models/capabilities.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/compute/models/capabilities.go b/pkg/compute/models/capabilities.go index f0bdff951f..d11e30b22f 100644 --- a/pkg/compute/models/capabilities.go +++ b/pkg/compute/models/capabilities.go @@ -11,9 +11,9 @@ import ( ) type SCapabilities struct { - Hypervisors []string `json:",allowempty"` - StorageTypes []string `json:",allowempty"` - GPUModels []string `json:",allowempty"` + Hypervisors []string `json:",allowempty"` + StorageTypes []string `json:",allowempty"` + GPUModels []string `json:",allowempty"` MinNicCount int MaxNicCount int MinDataDiskCount int @@ -52,6 +52,8 @@ func getHypervisors(zone *SZone) []string { q = q.Equals("zone_id", zone.Id) } q = q.IsNotEmpty("host_type").IsNotNull("host_type") + q = q.Equals("host_status", HOST_ONLINE) + q = q.IsTrue("enabled") q = q.Distinct() rows, err := q.Rows() if err != nil { @@ -75,6 +77,8 @@ func getStorageTypes(zone *SZone) []string { } q = q.IsNotEmpty("storage_type").IsNotNull("storage_type") q = q.IsNotEmpty("medium_type").IsNotNull("medium_type") + q = q.In("status", []string{STORAGE_ENABLED, STORAGE_ONLINE}) + q = q.IsTrue("enabled") q = q.Distinct() rows, err := q.Rows() if err != nil {