Merge pull request #3958 from wanyaoqi/bugfix/wyq/fix-host-ping-task

bugfix: add lock on host detected offline
This commit is contained in:
yunion-ci-robot
2019-11-28 14:11:29 +08:00
committed by GitHub
+5 -3
View File
@@ -4283,11 +4283,13 @@ func (manager *SHostManager) PingDetectionTask(ctx context.Context, userCred mcc
defer rows.Close()
for rows.Next() {
var host = SHost{}
q.Row2Struct(rows, &host)
host.SetModelManager(manager, &host)
var host = new(SHost)
q.Row2Struct(rows, host)
host.SetModelManager(manager, host)
lockman.LockObject(ctx, host)
host.PerformOffline(ctx, userCred, nil, nil)
host.MarkGuestUnknown(userCred)
lockman.ReleaseObject(ctx, host)
}
}