Showing results for 
Search instead for 
Did you mean: 
Cisco Employee

'wait-for-lock' by config or ncs.conf

Hi. I want an advice from someone who are familiar with 'wait-for-lock' which has been implemented since NSO 4.4.2 as follows.

- ncs: 'sync-from'/'sync-to'/'check-sync'/'partial-sync-from' actions now
have a 'wait-for-lock' parameter that can be used to specify a timeout
that the action waits until the device lock is released and any commit
queue items that contain the device are done. If the 'wait-for-lock'
parameter is not specified, the action will fail immediately for the
device if the lock is taken for the device or if the device is placed
in the commit queue.

A commit now use the /devices/global-settings/commit-retries to wait
for any device lock to be released.

(Issue tracker: #27591)

When compare-config and sync-to are executed almost at the same time (compare-config first, sync-to second), sync-to fails as follows because device is locked in a compare-config-operation.

# devices device R1 sync-to
result false
info R1: Device is locked in a compare-config operation by session 328060

This can be solved by adding 'wait-for-lock' option as follows.

# devices device R1 sync-to wait-for-lock { timeout 60 }
# (Success after waiting for device unlocked)

I was expecting this is also achieved by /devices/global-settings/commit-retries setting because above statement says so.

(config)# devices global-settings commit-retries timeout 60
(config)# commit
Commit complete.

But it doesn't work as follows.

# devices device R1 sync-to
result false
info R1: Device is locked in a compare-config operation by session 328630

Is it any way to achieve it by config or ncs.conf setting?

Cisco Employee

Re: 'wait-for-lock' by config or ncs.conf

According to the YANG model in my NSO install for devices you can configure it at the global-settings level:

  revision 2019-04-09 {
      "Released as part of NCS-5.1.
       Added 'wait-for-lock' choice under



And the mentioned grouping:


    grouping device-profile-parameters {
        "A set of parameters to use when communicating with a device.

         These parameters can be set on:

           o  global-settings
           o  device-profile
           o  device

         If a parameter is set on the device, its value is used.
         Otherwise, if the paramater is set in the device's
         device-profile, its value is used.  Otherwise, the global
         setting is used, if set.  Otherwise, the value used depends on
         the NED type.";

      uses timeouts;

      uses wait-for-lock{
          refine wait-for-lock-choice{
              "When an action accepting the wait-for-lock parameter is
               called without providing the wait-for-lock parameter, the
               wait-for-lock-choice device setting is going to be used.";

I checked NSO YANG model and this is not present so it seems you can achieve what you want starting with NSO 5.1