diff options
author | Peter Mikus <pmikus@cisco.com> | 2019-10-07 13:40:49 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2019-10-09 09:09:58 +0000 |
commit | 233fc0f58253694e8fc5417146758821b1c34e05 (patch) | |
tree | 1103a892d9d4dd374bad8ea5e517f29876b3ddcb /resources/tools/scripts/topo_cleanup.py | |
parent | 0f496f4c337d06032618e861ed6dfb8b51fc2a9f (diff) |
FIX: Add SRIOV cleanup
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Change-Id: I344cbab78e1491b1dc0b64598f1eae23c8d2cdcf
Diffstat (limited to 'resources/tools/scripts/topo_cleanup.py')
-rwxr-xr-x | resources/tools/scripts/topo_cleanup.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/resources/tools/scripts/topo_cleanup.py b/resources/tools/scripts/topo_cleanup.py index bf4bdfc557..89055944c5 100755 --- a/resources/tools/scripts/topo_cleanup.py +++ b/resources/tools/scripts/topo_cleanup.py @@ -46,6 +46,7 @@ def execute_command_ssh(ssh, cmd, sudo=False): return ret, stdout, stdout + def uninstall_package(ssh, package): """If there are packages installed, clean them up. @@ -64,6 +65,7 @@ def uninstall_package(ssh, package): execute_command_ssh(ssh, 'apt-get purge -y "*{package}*"'.format( package=package), sudo=True) + def kill_process(ssh, process): """If there are running processes, kill them. @@ -126,9 +128,9 @@ def main(): for interface in topology[node]['interfaces']: pci = topology[node]['interfaces'][interface]['pci_address'] execute_command_ssh( - ssh, "ip link set " - "$(basename /sys/bus/pci/devices/{pci}/net/*) down". - format(pci=pci), sudo=True) + ssh, "[[ -d {path}/{pci}/net ]] && " + "sudo ip link set $(basename {path}/{pci}/net/*) down". + format(pci=pci, path='/sys/bus/pci/devices')) if __name__ == "__main__": |