Viewing the status of the local datastores

An MD-CLI session in exclusive configuration mode acquires an explicit lock for both the global candidate and running configuration datastores. This is achieved by executing the configure exclusive command (in the implicit configuration workflow) or the edit-config exclusive command (in the explicit configuration workflow).

An explicit lock can also be obtained via:

To view the lock status of the datastores, the following show command is available:

show system management-interface datastore-locks [detail]

Example: Using the detail option to display information

The detail option displays information about any model-driven interface session that impacts the datastore locks. MD-CLI read-only sessions, for example, do not impact the datastore locks.

(ro)[/]
A:admin@node-2# show system management-interface datastore-locks detail
===============================================================================
Session ID  Region                 Datastore                     Lock State
   Username                        Session Mode                  Idle Time
   Session Type                    From
-------------------------------------------------------------------------------
 69         configure              Candidate, Running            Locked
   admin                           Exclusive                     0d 00:01:48
   MD-CLI                          192.168.144.87
-------------------------------------------------------------------------------
Number of sessions: 1
'#' indicates the current active session
===============================================================================

Example: Using the configuration-sessions command to display information

The configuration-sessions command displays the same information as the datastore-locks detail command, but for all configuration sessions regardless of whether the session has a lock on the datastore.

(ro)[/]
A:admin@node-2# show system management-interface configuration-sessions
===============================================================================
Session ID  Region                 Datastore                     Lock State
   Username                        Session Mode                  Idle Time
   Session Type                    From
-------------------------------------------------------------------------------
#65         configure              Candidate                     Unlocked
   admin                           Private                       0d 00:00:00
   MD-CLI                          192.168.144.87
 66         configure              Candidate                     Unlocked
   admin                           Private                       0d 00:05:41
   MD-CLI                          192.168.144.87
 67         configure              Candidate                     Unlocked
   admin                           Private                       0d 00:05:08
   MD-CLI                          192.168.144.87
 68         configure              Candidate                     Unlocked
   admin                           Read-Only                     0d 00:02:25
   MD-CLI                          192.168.144.87
 69         configure              Candidate, Running            Locked
   admin                           Exclusive                     0d 00:01:54
   MD-CLI                          192.168.144.87
-------------------------------------------------------------------------------
Number of sessions: 5
'#' indicates the current active session
===============================================================================

Unlocking a locked datastore

A datastore lock that has been acquired by any model-driven session can be administratively removed by using the following admin command:

admin disconnect session-id session-id

Example

For example, to disconnect the MD-CLI session indicated in the preceding show command output, issue the admin command as follows:

[/]
A:admin@node-2# admin disconnect session-id 10

Disconnecting an MD-CLI session (or any model-driven session, including NETCONF and gRPC) that acquired a datastore lock has the following results:

  • Any uncommitted changes in the candidate configuration datastore are discarded.

  • The session is terminated.

  • The explicit lock is released.