question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NXOS Save_Config Appears To Wait For Completion

See original GitHub issue

i have two threads connecting to the same box. Netmiko appears to be waiting till save_config() completes with proper response before moving down my code. I need my 2nd thread to execute WHILE a save is occuring. I have 1 min 8 secs to do this.

Im using threading + semaphore. so Im locking and unlocking threads.

Automation : Im trying to perform a config change in a 2nd session while saving in the 1st. I need the change to occur inside the window while its saving. I cannot get the 2nd session to do it.

BAD RESULT
Tue Aug 17 15:12:22 2021:type=update:id=10.24.63.196@pts/5:user=admin:cmd=Performing configuration copy.
Tue Aug 17 15:12:25 2021:type=start:id=vsh.bin.3792:user=admin:cmd=
Tue Aug 17 15:13:29 2021:type=update:id=10.24.63.196@pts/5:user=admin:cmd=copy running-config startup-config (SUCCESS)

GOOD RESULT
Tue Aug 17 15:05:23 2021:type=update:id=10.24.63.196@pts/0:user=admin:cmd=Performing configuration copy.
Tue Aug 17 15:05:26 2021:type=start:id=vsh.bin.18707:user=admin:cmd=
Tue Aug 17 15:05:28 2021:type=update:id=10.24.63.196@pts/3:user=admin:cmd=configure terminal ; no route-map CUSTOM_ROUTE_MAP
-OUT permit 5148 (SUCCESS)
Tue Aug 17 15:06:31 2021:type=update:id=10.24.63.196@pts/0:user=admin:cmd=copy running-config startup-config (SUCCESS)
hostname3#

THIS IS THE SAVE_CONFIG FUNCTION FOR NXOS

    def save_config(
        self,
        cmd="copy running-config startup-config",
        confirm=False,
        confirm_response="",
    ):
        self.enable()

        if confirm:
            output = self.send_command_timing(
                command_string=cmd, strip_prompt=False, strip_command=False
            )
            if confirm_response:
                output += self.send_command_timing(
                    confirm_response, strip_prompt=False, strip_command=False
                )
            else:
                # Send enter by default
                output += self.send_command_timing(
                    self.RETURN, strip_prompt=False, strip_command=False
                )
        else:
            # NX-OS is very slow on save_config ensure it waits long enough.
            # FIX: this is a hack as delay_factor will be set to .1 via fast_cli=True in
            # send_command so increase max_loops.
            output = self.send_command(
                command_string=cmd,
                strip_prompt=False,
                strip_command=False,
                max_loops=5000,
            )
        return output

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
snub-fightercommented, Aug 19, 2021

write_channel() worked. Thank you

On Tue, Aug 17, 2021 at 10:21 AM Kirk Byers @.***> wrote:

You could just use `write_channel(“copy run start\n”).

Note, any subsequent read_channel() call on this SSH session will still retrieve whatever that SSH session is doing (i.e. it won’t do anything else on that given SSH session until the copy run start is complete).

Note, it is possible/likely that NX-OS does not allow config changes while copy run start is underway (i.e. there is a good chance even multiple SSH sessions does not allow this at the NX-OS level).

Kirk

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ktbyers/netmiko/issues/2450#issuecomment-900440970, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHTXARS47BXWRX4DI473R3T5KD73ANCNFSM5CKF3I4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

– Nate Demers

0reactions
ktbyerscommented, Aug 17, 2021

You could just use write_channel("copy running-config startup-config\n")

Note, any subsequent read_channel() call on this SSH session will still retrieve whatever that SSH session is doing (i.e. it won’t do anything else on that given SSH session until the copy run start is complete).

Note, it is possible/likely that NX-OS does not allow config changes while copy run start is underway (i.e. there is a good chance even multiple SSH sessions does not allow this at the NX-OS level).

Kirk

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cisco Nexus 3000 Series NX-OS Software Upgrade and ...
Only after the BIOS upgrade is complete, it allows the system to perform fast-reload to Release 7.0(3)I2(1) or later releases.
Read more >
Installing NX-OS and Reference Configuration Files (RCFs)
Copy complete, now saving to disk (please wait)... Copy complete. 4. Verify the running version of the NX-OS software: cs2# show version.
Read more >
timeout trying to send command: copy running-config startup ...
SUMMARY On the NX-OS platform where save operations take more than 10 seconds the module fails with timeout trying to send command: copy ......
Read more >
4 Maintaining Other Exadata Database Machine Components
Restoring Settings on a Cisco Nexus 9336C-FX2 RoCE Network Fabric Switch You can restore the Cisco ... 100% Copy complete, now saving to...
Read more >
Developer Guide OpenShift Container Platform 3.11
Including builder here ensures this ImageStreamTag appears in the web ... The pipeline will wait until the deployment has completed to trigger the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found