diff options
author | Steve McIntyre <steve.mcintyre@linaro.org> | 2015-07-21 17:54:58 +0100 |
---|---|---|
committer | Steve McIntyre <steve.mcintyre@linaro.org> | 2015-07-21 17:54:58 +0100 |
commit | 38a24e5ce867febf18189c9ce615e8f5bd183544 (patch) | |
tree | 8851c8e1c7e0095d388df084e5fec94fb0394267 /util.py | |
parent | 4e75c5b1c120abd8c2c74f45afaf3895fe27b36f (diff) |
Add logging in major failure paths in API calls
If we're at the point where we've found a major problem and think that
we need to reset the switches, actually write an error message to the
log first...
Change-Id: I1eed6691dd4331c6ced95ace80ffbf4a4f938417
Diffstat (limited to 'util.py')
-rw-r--r-- | util.py | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -266,6 +266,7 @@ class VlanUtil: # failed. To undo the changes safely, we'll need to reset # all the switches we managed to configure. This could # take some time! + logging.error('create_vlan failed, resetting all switches to recover') for switch_name in switches_done: s = self.get_switch_driver(switch_name, config) s.switch_connect(config.switches[switch_name].username, @@ -375,6 +376,7 @@ class VlanUtil: # failed. To undo the changes safely, we'll need to reset # all the switches we managed to configure. This could # take some time! + logging.error('delete_vlan failed, resetting all switches to recover') for switch_name in switches_done: s = self.get_switch_driver(switch_name, config) s.switch_connect(config.switches[switch_name].username, @@ -484,6 +486,7 @@ class VlanUtil: s.port_add_trunk_to_vlan(port.name, vlan.tag) except IOError: + logging.error('set_port_mode failed, resetting switch to recover') # Bugger. Looks like one of the switch calls above # failed. To undo the changes safely, we'll need to reset # all the config on this switch @@ -543,6 +546,7 @@ class VlanUtil: try: s.port_set_access_vlan(port.name, vlan.tag) except IOError: + logging.error('set_current_vlan failed, resetting switch to recover') # Bugger. Looks like one of the switch calls above # failed. To undo the changes safely, we'll need to reset # all the config on this switch @@ -605,6 +609,7 @@ class VlanUtil: try: s.port_set_access_vlan(port.name, vlan.tag) except IOError: + logging.error('restore_base_vlan failed, resetting switch to recover') # Bugger. Looks like one of the switch calls above # failed. To undo the changes safely, we'll need to reset # all the config on this switch |