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

endpoint: Do not skip datapath rewrites on duplicate regenerations #10949

Merged
merged 3 commits into from Apr 15, 2020

Commits on Apr 15, 2020

  1. endpoint: Remove pointless setState()

    Replace setState() with the current state with the corresponding
    status log to make it clearer that the state is not being changed in
    this case.
    
    Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
    jrajahalme committed Apr 15, 2020
    Configuration menu
    Copy the full SHA
    4431fcc View commit details
    Browse the repository at this point in the history
  2. endpoint: Default regeneration reason to "Invalid"

    Force explicit initialization of regeneration reason to avoid
    defaulting to regeneration without datapath.
    
    Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
    jrajahalme committed Apr 15, 2020
    Configuration menu
    Copy the full SHA
    7430e60 View commit details
    Browse the repository at this point in the history
  3. endpoint: Store the highest skipped regeneration level

    Store the highest skipped regeneration level so that the regeneration
    can be performed on the required level.
    
    This is achieved by refactoring Endpoint.RegenerateIfAlive() into three pieces:
    
    - setRegenerateStateLocked(): Change Endpoint state for regeneration,
      if not already done. If the current state indicates that a
      regeneration is already pending, store the current regenetion level
      to the new Endpoint.skippedRegenerationLevel, if higher so that the
      pending regeneration can be performed at that level.
    
    - SetRegenerateStateIfAlive(): Call setRegenerateStateLocked() if
      endpoint is still alive
    
    - RegenerateIfAlive(): Call SetRegenerateStateIfAlive() and
      Regenerate() if possible.
    
    All other sites that were previously manipulating Endpoint.state for
    regeneration are refactored to use one of the above three functions as
    appropriate. This allows the regeneration level recording of a skipped
    regeneration to be managed in a single function
    (setRegenerateStateLocked()) instead of copying the logic all over the
    place.
    
    Endpoint.RegenerateAfterCreation() used to condition regeneration on
    'e.getState() == StateReady' to avoid regeneting again if the endpoint
    has already been regenerated due to Endpoint's labels being received
    from the kv-store. However, Daemon.createEndpoint() expects endpoint
    regeneration only happen when it finally calls
    Endpoint.RegenerateAfterCreation(), after the call to UpdateLabels().
    Fix this by refactoring Daemon.createEndpoint() so that endpoint
    regeneration is OK right after calling Endpoint.UpdateLabels() and
    skipping endpoint regeneration trigger later if it was already
    triggered, and possibly already completely performed, thus avoiding
    unnecessary duplicate regeneration. Make this more explicit by
    inlining Endpoint.RegenerateAfterCreation() into
    Daemon.createEndpoint() which was it's only caller anyway.
    
    Suggested-by: Dan Wendlandt <dan@covalent.io>
    Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
    jrajahalme committed Apr 15, 2020
    Configuration menu
    Copy the full SHA
    a4dfaba View commit details
    Browse the repository at this point in the history