Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement restart policy for VMs #83

Merged
merged 3 commits into from
Apr 24, 2023
Merged

Implement restart policy for VMs #83

merged 3 commits into from
Apr 24, 2023

Conversation

edigaryev
Copy link
Collaborator

Resolves #68.

internal/controller/scheduler/scheduler.go Show resolved Hide resolved
Comment on lines 110 to 112
vm.logger.Error(err)
vm.err = err
vm.Resource.Status = v1.VMStatusFailed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need for errMtx? A VM can only go in the failed state. If setErr will be called several times concurrently, the only race is the vm.err = err assignment which I think is fine not to have a lock on. Doesn't seem like it will make a lot of difference.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the code to use atomic.Pointer instead and compare-and-swap operation, check it out.

internal/worker/worker.go Show resolved Hide resolved
@edigaryev edigaryev merged commit 60e564d into main Apr 24, 2023
@edigaryev edigaryev deleted the restart-policy branch April 24, 2023 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VM Restart Policy
2 participants