mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Merge pull request #1195 in YUNIONIO/onecloud from ~QUXUAN/onecloud:hotfix/qx-storage-attach-log to release/2.6.0
* commit '079e39def02adb336dc52390bae61c5f64e81c3d': 如果挂载磁盘失败, 记录失败日志
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user