From 7dca09c4196eebdedd9f5bee2101a98e357d8fd1 Mon Sep 17 00:00:00 2001 From: wanyaoqi Date: Wed, 19 Dec 2018 15:02:29 +0800 Subject: [PATCH] fix sync storage status --- pkg/compute/models/storages.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/compute/models/storages.go b/pkg/compute/models/storages.go index a07af000dd..fde6a4d7cb 100644 --- a/pkg/compute/models/storages.go +++ b/pkg/compute/models/storages.go @@ -347,13 +347,16 @@ func (self *SStorage) SyncStatusWithHosts() { } var status string if !self.IsLocal() { - status = STORAGE_ENABLED + status = self.Status + if online == 0 { + status = STORAGE_OFFLINE + } } else if online > 0 { - status = STORAGE_ENABLED + status = STORAGE_ONLINE } else if offline > 0 { status = STORAGE_OFFLINE } else { - status = STORAGE_DISABLED + status = STORAGE_OFFLINE } if status != self.Status { self.SetStatus(nil, status, "SyncStatusWithHosts")