Skip to content

Conversation

@lippirk
Copy link
Contributor

@lippirk lippirk commented Jun 21, 2021

This fixes parallel pool.ejects, and makes cert distribs a bit safer

Additional improvements (for a later PR):

  • add a lock for the 'create bundle' script
  • on startup, retrieve any missing certs from the master

Ben Anson added 2 commits June 21, 2021 16:16
This fixes parallel Pool.ejects - if we try to eject host B, but host C
is not contactable, we do not want to block the eject.

The price we pay for parallel ejects is that we might not clean up host
B's certificates on host C.

Signed-off-by: Ben Anson <[email protected]>
This prevents concurrent cert distribs interfering with each other.

Pool.join caveat: during a join, the joiner modifies /etc/stunnel
itself. This cannot be locked by the master, so some race conditions
still remain.  Additionally, the joiner goes offline for a portion of
the join, so could lose out on certificate updates during this time,
especially if multiple pool joins are happening at the same time.

Signed-off-by: Ben Anson <[email protected]>
@lippirk lippirk requested review from lindig and psafont June 21, 2021 15:30
@lippirk
Copy link
Contributor Author

lippirk commented Jun 21, 2021

@lindig eventually the cert refresh code will need to be locked with this mutex. I don't mind adding it later, but worth keeping in mind

@psafont
Copy link
Member

psafont commented Jun 21, 2021

This looks reasonable to me, has this been tested?

@lippirk
Copy link
Contributor Author

lippirk commented Jun 21, 2021

This looks reasonable to me, has this been tested?

I've tested pool join, eject and verification enable manually

* we apply this lock to all top level distribution calls, with the exception of
* the pool join functions that execute on the joiner.
*)
let lock (f : unit -> 'a) : 'a =
Copy link
Contributor

Choose a reason for hiding this comment

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

How about with_lock or locked as a name?

@lippirk lippirk merged commit 292c189 into xapi-project:master Jun 24, 2021
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.

4 participants