-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/scaleway: fix scaleway_volume_attachment with count > 1 #9493
Conversation
I will give it a try tomorrow |
What do you think about the azure implementation that define a MutexKV in the provider and lock ressources. It take advantage of the terraform official helper mutexkv, that could be more "elegant" don't you think @nicolai86 ? |
|
||
var currentState string | ||
func waitForServerState(scaleway *api.ScalewayAPI, serverID string, targetState string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
great find, @dcharbonnier . I'll adjust the PR |
tests still pass:
|
Is it possible that there is some kind of race while executing I'm just running into another issue from Scaleway where a node is hanging from time to time at |
I can confirm that this patch correctly fixes the attachment of multiple volumes. It took nearly 8 minutes to launch one server of the type
|
And it took 11 minutes to destroy :D |
@tboerger at the moment all A future optimization would be to add a barrier on stop & start actions, then we could batch the attachments which would speed things up considerably. But we should leave this off to future PRs :) |
True, at least it should work now properly. |
what are we waiting to merge this ? |
Hi @nicolai86 Sorry for the time taken to get back to you on this one - can you rebase it for me and I can get it merged? You may have to change the timeout in the retry introduced by the other PR i merged today by you due to the 11 minutes above. Maybe make it a 20minute retry? Paul |
since scaleway requires servers to be powered off to attach volumes to, we need to make sure that we don't power down a server twice, or power up a server while it's supposed to be modified. sadly terraform doesn't seem to sport serialization primitives for usecases like this, but putting the code in question behind a `sync.Mutex` does the trick, too fixes #9417
following @dcharbonnier suggestion. thanks!
I've rebased the PR and also increased the timeouts 👍 thanks for looking after this :) |
This LGTM now @nicolai86 :) Tests are green (as always!) - will squash and merge - thanks for the awesome work as usual
|
<3 @stack72 |
…hicorp#9493) * provider/scaleway: fix scaleway_volume_attachment with count > 1 since scaleway requires servers to be powered off to attach volumes to, we need to make sure that we don't power down a server twice, or power up a server while it's supposed to be modified. sadly terraform doesn't seem to sport serialization primitives for usecases like this, but putting the code in question behind a `sync.Mutex` does the trick, too fixes hashicorp#9417 * provider/scaleway: use mutexkv to lock per-resource following @dcharbonnier suggestion. thanks! * provider/scaleway: cleanup waitForServerState signature * provider/scaleway: store serverID in var * provider/scaleway: correct imports * provider/scaleway: increase timeouts
…hicorp#9493) * provider/scaleway: fix scaleway_volume_attachment with count > 1 since scaleway requires servers to be powered off to attach volumes to, we need to make sure that we don't power down a server twice, or power up a server while it's supposed to be modified. sadly terraform doesn't seem to sport serialization primitives for usecases like this, but putting the code in question behind a `sync.Mutex` does the trick, too fixes hashicorp#9417 * provider/scaleway: use mutexkv to lock per-resource following @dcharbonnier suggestion. thanks! * provider/scaleway: cleanup waitForServerState signature * provider/scaleway: store serverID in var * provider/scaleway: correct imports * provider/scaleway: increase timeouts
…hicorp#9493) * provider/scaleway: fix scaleway_volume_attachment with count > 1 since scaleway requires servers to be powered off to attach volumes to, we need to make sure that we don't power down a server twice, or power up a server while it's supposed to be modified. sadly terraform doesn't seem to sport serialization primitives for usecases like this, but putting the code in question behind a `sync.Mutex` does the trick, too fixes hashicorp#9417 * provider/scaleway: use mutexkv to lock per-resource following @dcharbonnier suggestion. thanks! * provider/scaleway: cleanup waitForServerState signature * provider/scaleway: store serverID in var * provider/scaleway: correct imports * provider/scaleway: increase timeouts
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
since scaleway requires servers to be powered off to attach volumes to we need
to make sure that we don't power down a server twice, or power up a server while
it's supposed to be modified. classic race condition.
sadly terraform doesn't seem to sport serialization primitives for use cases like
this, but putting the code in question behind a
sync.Mutex
does the trick, too.this PR also migrates
waitForServerState
over to terraform's internal retry primitive.fixes #9417