Skip to content

Fix netlab down within the netlab restart command#3354

Open
sjhloco wants to merge 1 commit intoipspace:devfrom
sjhloco:fix_netlab_restart
Open

Fix netlab down within the netlab restart command#3354
sjhloco wants to merge 1 commit intoipspace:devfrom
sjhloco:fix_netlab_restart

Conversation

@sjhloco
Copy link
Copy Markdown

@sjhloco sjhloco commented May 6, 2026

When using netlab restart to restart a lab the netlab down part of it fails as the topology file name is being passed in to the command (only needed for netlab up)

ste@netlab-dev:~/labs$ netlab restart simple_topo.yml
usage: netlab down [-h] [-v] [--cleanup] [--dry-run] [--force] [-i INSTANCE] [--snapshot [SNAPSHOT]]
netlab down: error: unrecognized arguments: simple_topo.yml

Fixed in restart.py by adding the topology file to the filtering for netlab down.

ste@netlab-dev:~/labs$ netlab restart simple_topo.yml

┌──────────────────────────────────────────────────────────────────────────────────┐
│ CHECKING virtualization provider installation                                    │
└──────────────────────────────────────────────────────────────────────────────────┘
[SUCCESS] clab installed and working correctly

┌──────────────────────────────────────────────────────────────────────────────────┐
│ STOPPING clab nodes                                                              │
└──────────────────────────────────────────────────────────────────────────────────┘
provider clab: executing sudo -E containerlab destroy --cleanup -t clab.yml
warning: preserving the entire environment is not supported, `-E` is ignored
23:43:11 INFO Parsing & checking topology file=clab.yml
23:43:11 INFO Parsing & checking topology file=clab.yml
23:43:11 INFO Destroying lab name=labs
23:43:11 INFO Removed container name=ACCESS_SWI
23:43:11 INFO Removing host entries path=/etc/hosts
23:43:11 INFO Removing SSH config path=/etc/ssh/ssh_config.d/clab-labs.conf

┌──────────────────────────────────────────────────────────────────────────────────┐
│ CREATING configuration files                                                     │
└──────────────────────────────────────────────────────────────────────────────────┘
[CONFIG]  ACCESS_SWI: ifstate,normalize,initial,vlan
[CREATED] provider configuration file: clab.yml
[CREATED] pickled transformed topology data into netlab.snapshot.pickle
[GROUPS]  group_vars for all
[GROUPS]  group_vars for modules
[GROUPS]  group_vars for ioll2
[HOSTS]   host_vars for ACCESS_SWI
[CREATED] minimized Ansible inventory hosts.yml
[CREATED] Ansible configuration file: ansible.cfg

┌──────────────────────────────────────────────────────────────────────────────────┐
│ CHECKING virtualization provider installation                                    │
└──────────────────────────────────────────────────────────────────────────────────┘
[SUCCESS] clab installed and working correctly

┌──────────────────────────────────────────────────────────────────────────────────┐
│ STARTING clab nodes                                                              │
└──────────────────────────────────────────────────────────────────────────────────┘
provider clab: executing sudo -E containerlab deploy --reconfigure -t clab.yml
warning: preserving the entire environment is not supported, `-E` is ignored
23:43:12 INFO Containerlab started version=0.75.0

@ipspace
Copy link
Copy Markdown
Owner

ipspace commented May 7, 2026

Thanks a million. Never tried "restart" with a topology file name.

I would rewrite the whole parsing code to do parsing for "netlab down" and then remove the unparsed arguments from the arguments passed to "netlab down". Would you like to do the rewrite, or should I?

@sjhloco
Copy link
Copy Markdown
Author

sjhloco commented May 7, 2026

Am happy to rewrite it, but am not sure how you want it doing? Do you mean to try and grab the name of the topology first and then add it to up_only_args and then keep down.run([ arg ....... the same as it was originally?

@ipspace
Copy link
Copy Markdown
Owner

ipspace commented May 7, 2026

We (both) got it all wrong. The lab has to be restarted from the snapshot file, not from a lab topology (that could start a completely different lab). Details in #3359

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants