Skip to content

Commit

Permalink
tasks: EipDissociateTask: lock associated model
Browse files Browse the repository at this point in the history
  • Loading branch information
yousong committed May 28, 2020
1 parent 035af9d commit 02ea7b4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/compute/tasks/eip_dissociate_task.go
Expand Up @@ -23,6 +23,7 @@ import (

api "yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/cloudcommon/db"
"yunion.io/x/onecloud/pkg/cloudcommon/db/lockman"
"yunion.io/x/onecloud/pkg/cloudcommon/db/taskman"
"yunion.io/x/onecloud/pkg/cloudprovider"
"yunion.io/x/onecloud/pkg/compute/models"
Expand Down Expand Up @@ -85,6 +86,8 @@ func (self *EipDissociateTask) OnInit(ctx context.Context, obj db.IStandaloneMod
self.TaskFail(ctx, eip, "unsupported associate type", nil)
return
}
lockman.LockObject(ctx, model)
defer lockman.ReleaseObject(ctx, model)

extEip, err := eip.GetIEip()
if err != nil && errors.Cause(err) != cloudprovider.ErrNotFound {
Expand Down

0 comments on commit 02ea7b4

Please sign in to comment.