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

feat: Add support for waiting until config update is done #1734

Merged
merged 1 commit into from
Oct 2, 2020

Conversation

ondrej-fabry
Copy link
Member

@ondrej-fabry ondrej-fabry commented Oct 2, 2020

Fixes #1732

This introduces new field WaitDone for UpdateRequest in ligato.configurator.Configurator service,
which when enabled will wait until config update is non-PENDING state.

Test this with agentctl:

agentctl config update --waitdone update.yaml
# update.yaml
vppConfig:
  interfaces:
  - name: "afpacket1"
    type: AF_PACKET
    enabled: true
    ipAddresses:
    - 192.168.99.1/30
    afpacket:
      host_if_name: "veth-1"
linuxConfig:
  interfaces:
  - name: "veth1"
    type: VETH
    enabled: true
    ip_addresses:
    - 10.0.2.1/30
    host_if_name: "veth-1"
    veth:
      peer_if_name: "veth2"
  - name: "veth2"
    type: VETH
    enabled: true
    ip_addresses:
    - 10.0.3.1/30
    veth:
      peer_if_name: "veth1"

From agent log:

finished waiting for pending keys to be done (took 594.582676ms) 
full agent log output
DEBU[0004] dispatcher: Push data with 3 KV pairs (source: grpc) 
DEBU[0004] dispatcher:  - UPDATE: "config/vpp/v2/interfaces/afpacket1"  
DEBU[0004] dispatcher:  - UPDATE: "config/linux/interfaces/v2/interface/veth1"  
DEBU[0004] dispatcher:  - UPDATE: "config/linux/interfaces/v2/interface/veth2"  
+======================================================================================================================+
| #3 - NBTransaction                                                                                                   |
+======================================================================================================================+
  * transaction arguments:
      - seqNum: 3
      - type: NB Transaction
      - values:
          - key: config/linux/interfaces/v2/interface/veth1
            val: { name:"veth1"  type:VETH  host_if_name:"veth-1"  enabled:true  ip_addresses:"10.0.2.1/30"  veth:{peer_if_name:"veth2"} }
          - key: config/linux/interfaces/v2/interface/veth2
            val: { name:"veth2"  type:VETH  enabled:true  ip_addresses:"10.0.3.1/30"  veth:{peer_if_name:"veth1"} }
          - key: config/vpp/v2/interfaces/afpacket1
            val: { name:"afpacket1"  type:AF_PACKET  enabled:true  ip_addresses:"192.168.99.1/30"  afpacket:{host_if_name:"veth-1"} }

o----------------------------------------------------------------------------------------------------------------------o
  * executed operations (2020-10-02 08:45:44.816 +0000 UTC -> 2020-10-02 08:45:44.875 +0000 UTC, dur: 59ms):
      1. CREATE:
          - key: config/linux/interfaces/v2/interface/veth2
          - value: { name:"veth2"  type:VETH  enabled:true  ip_addresses:"10.0.3.1/30"  veth:{peer_if_name:"veth1"} } 
      2. CREATE:
          - key: config/linux/interfaces/v2/interface/veth1
          - value: { name:"veth1"  type:VETH  host_if_name:"veth-1"  enabled:true  ip_addresses:"10.0.2.1/30"  veth:{peer_if_name:"veth2"} } 
      3. CREATE [PROPERTY]:
          - key: linux/interface/state/veth1/UP
          - value: <EMPTY> 
      4. CREATE [DERIVED]:
          - key: linux/interface/veth1/address/static/10.0.2.1/30
          - value: <EMPTY> 
      5. CREATE [PROPERTY]:
          - key: linux/interface/state/veth2/UP
          - value: <EMPTY> 
      6. CREATE [DERIVED]:
          - key: linux/interface/veth2/address/static/10.0.3.1/30
          - value: <EMPTY> 
      7. CREATE [NOOP IS-PENDING]:
          - key: config/vpp/v2/interfaces/afpacket1
          - value: { name:"afpacket1"  type:AF_PACKET  enabled:true  ip_addresses:"192.168.99.1/30"  afpacket:{host_if_name:"veth-1"} } 
x----------------------------------------------------------------------------------------------------------------------x
| #3 - NBTransaction                                                                                       took 58.6ms |
x----------------------------------------------------------------------------------------------------------------------x

INFO[0004] dispatcher: Transaction #3 successful! (took 61ms) 
INFO[0004] configurator.configurator: waiting for 1 pending keys to be done 
INFO[0005] status-check: Agent plugin state update.      lastErr="<nil>" plugin=etcd state=ok
+======================================================================================================================+
| #4 - SBNotification                                                                                                  |
+======================================================================================================================+
  * transaction arguments:
      - seqNum: 4
      - type: SB Notification
      - values:
          - key: linux/interface/host-name/veth2
            val: <EMPTY>

o----------------------------------------------------------------------------------------------------------------------o
  * executed operations (2020-10-02 08:45:45.335 +0000 UTC -> 2020-10-02 08:45:45.335 +0000 UTC, dur: 0s):
      1. CREATE [OBTAINED]:
          - key: linux/interface/host-name/veth2
          - value: <EMPTY> 
x----------------------------------------------------------------------------------------------------------------------x
| #4 - SBNotification                                                                                       took 100µs |
x----------------------------------------------------------------------------------------------------------------------x

DEBU[0005] kvscheduler: Transaction 4 successful        
+======================================================================================================================+
| #5 - SBNotification                                                                                                  |
+======================================================================================================================+
  * transaction arguments:
      - seqNum: 5
      - type: SB Notification
      - values:
          - key: linux/interface/host-name/veth-1
            val: <EMPTY>

DEBU[0005] vpp-ifplugin.if-descriptor: publish add to ifplugin_ifstate{{afpacket1 false false vpp-interface-index} 0xc00013a500} 
DEBU[0005] vpp-ifplugin: Interface 1 set to VRF 0       
o----------------------------------------------------------------------------------------------------------------------o
  * executed operations (2020-10-02 08:45:45.376 +0000 UTC -> 2020-10-02 08:45:45.469 +0000 UTC, dur: 94ms):
      1. CREATE [OBTAINED]:
          - key: linux/interface/host-name/veth-1
          - value: <EMPTY> 
      2. CREATE [WAS-PENDING]:
          - key: config/vpp/v2/interfaces/afpacket1
          - value: { name:"afpacket1"  type:AF_PACKET  enabled:true  ip_addresses:"192.168.99.1/30"  afpacket:{host_if_name:"veth-1"} } 
      3. CREATE [DERIVED]:
          - key: vpp/interface/afpacket1/vrf/0/ip-version/v4
          - value: <EMPTY> 
      4. CREATE [DERIVED]:
          - key: vpp/interface/afpacket1/address/static/192.168.99.1/30
          - value: <EMPTY> 
      5. CREATE [DERIVED]:
          - key: vpp/interface/afpacket1/has-IP-address
          - value: <EMPTY> 
x----------------------------------------------------------------------------------------------------------------------x
| #5 - SBNotification                                                                                      took 93.8ms |
x----------------------------------------------------------------------------------------------------------------------x

DEBU[0005] kvscheduler: Transaction 5 successful        
INFO[0005] configurator.configurator: finished waiting for pending keys to be done (took 594.582676ms) 
DEBU[0005] configurator.configurator: config update finished with 4 results 
+======================================================================================================================+
| #6 - SBNotification                                                                                                  |
+======================================================================================================================+
  * transaction arguments:
      - seqNum: 6
      - type: SB Notification
      - values:
          - key: vpp/interface/afpacket1/link-state/DOWN
            val: <EMPTY>
          - key: vpp/interface/afpacket1/link-state/UP
            val: <NIL>

o----------------------------------------------------------------------------------------------------------------------o
  * executed operations (2020-10-02 08:45:45.471 +0000 UTC -> 2020-10-02 08:45:45.471 +0000 UTC, dur: 0s):
      1. DELETE [WAS-OBTAINED]:
          - key: vpp/interface/afpacket1/link-state/UP
          - value: <EMPTY> 
      2. CREATE [OBTAINED]:
          - key: vpp/interface/afpacket1/link-state/DOWN
          - value: <EMPTY> 
x----------------------------------------------------------------------------------------------------------------------x
| #6 - SBNotification                                                                                       took 100µs |
x----------------------------------------------------------------------------------------------------------------------x

DEBU[0005] kvscheduler: Transaction 6 successful        
DEBU[0009] vpp-ifplugin.if-state: updating interface states for 2 interfaces 
INFO[0009] status-check: Agent plugin state update.      lastErr="<nil>" plugin=vpp-ifplugin state=ok
DEBU[0009] status-check: Global interface state data added: internal_name:"local0" status:"DOWN" mac_address:"00:00:00:00:00:00"  
DEBU[0009] status-check: Global interface state data added: internal_name:"host-veth-1" index:1 status:"UP" mac_address:"02:fe:31:28:69:60"  
+======================================================================================================================+
| #7 - SBNotification                                                                                                  |
+======================================================================================================================+
  * transaction arguments:
      - seqNum: 7
      - type: SB Notification
      - values:
          - key: vpp/interface/afpacket1/link-state/DOWN
            val: <NIL>
          - key: vpp/interface/afpacket1/link-state/UP
            val: <EMPTY>

o----------------------------------------------------------------------------------------------------------------------o
  * executed operations (2020-10-02 08:45:49.258 +0000 UTC -> 2020-10-02 08:45:49.258 +0000 UTC, dur: 0s):
      1. DELETE [WAS-OBTAINED]:
          - key: vpp/interface/afpacket1/link-state/DOWN
          - value: <EMPTY> 
      2. CREATE [OBTAINED]:
          - key: vpp/interface/afpacket1/link-state/UP
          - value: <EMPTY> 
x----------------------------------------------------------------------------------------------------------------------x
| #7 - SBNotification                                                                                       took 100µs |
x----------------------------------------------------------------------------------------------------------------------x

This introduces new field WaitDone for UpdateRequest in Configurator service,
which when enabled will wait until config update is non-pending state.

Fixes ligato#1732

Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
@codecov
Copy link

codecov bot commented Oct 2, 2020

Codecov Report

Merging #1734 into master will decrease coverage by 1.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1734      +/-   ##
==========================================
- Coverage   57.37%   56.34%   -1.04%     
==========================================
  Files         684      444     -240     
  Lines       49344    32687   -16657     
==========================================
- Hits        28310    18416    -9894     
+ Misses      17818    12521    -5297     
+ Partials     3216     1750    -1466     
Flag Coverage Δ
#e2e ?
#unittests 56.34% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@edwarnicke
Copy link
Contributor

finished waiting for pending keys to be done (took 594.582676ms)

Do we know why it took almost 600ms for config to be done? That's an enormous amount of time.

@ondrej-fabry
Copy link
Member Author

finished waiting for pending keys to be done (took 594.582676ms)

Do we know why it took almost 600ms for config to be done? That's an enormous amount of time.

Perhaps my slow hardware? Developing in a VM on Windows laptop? 😭

Can I merged this as it is? Or do you want to test it first?

@edwarnicke
Copy link
Contributor

This is fine as is :)

If perf is really terribly slow, we can address it separately... but a VM on a Windows laptop could totally be it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option to wait until config is fully configured
3 participants