From 079e39def02adb336dc52390bae61c5f64e81c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Fri, 8 Mar 2019 16:46:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=8C=82=E8=BD=BD=E7=A3=81?= =?UTF-8?q?=E7=9B=98=E5=A4=B1=E8=B4=A5,=20=E8=AE=B0=E5=BD=95=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/compute/tasks/host_storage_attach_task.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/compute/tasks/host_storage_attach_task.go b/pkg/compute/tasks/host_storage_attach_task.go index 2b189ea4f3..604908b70d 100644 --- a/pkg/compute/tasks/host_storage_attach_task.go +++ b/pkg/compute/tasks/host_storage_attach_task.go @@ -2,6 +2,7 @@ package tasks import ( "context" + "fmt" "yunion.io/x/jsonutils" "yunion.io/x/onecloud/pkg/cloudcommon/db" @@ -19,7 +20,10 @@ func init() { func (self *HostStorageAttachTask) taskFail(ctx context.Context, host *models.SHost, reason string) { if hoststorage := self.getHoststorage(host); hoststorage != nil { + storage := hoststorage.GetStorage() hoststorage.Detach(ctx, self.GetUserCred()) + note := fmt.Sprintf("attach host %s failed: %s", host.Name, reason) + db.OpsLog.LogEvent(storage, db.ACT_ATTACH, note, self.GetUserCred()) } self.SetStageFailed(ctx, reason) }