Skip to content

Commit

Permalink
Minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Jun 29, 2020
1 parent 333a15c commit 0fd7949
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion IM/connectors/OpenStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,17 +1307,19 @@ def finalize(self, vm, last, auth_data):
# First try to detach the volumes and the SGs
for vol_id in vm.volumes:
try:
self.log_debug("Dettaching volume %s." % vol_id)
volume = node.driver.ex_get_volume(vol_id)
node.driver.detach_volume(volume)
except Exception as ex:
self.log_exception("Error dettaching volume %s." % vol_id)

try:
for sg_name in self._get_security_names(vm.inf):
self.log_debug("Dettaching SG %s." % sg_name)
security_group = OpenStackSecurityGroup(None, None, sg_name, "", node.driver)
node.driver.ex_remove_security_group_from_node(security_group, node)
except Exception as ex:
self.log_exception("Error dettaching volume %s." % vol_id)
self.log_exception("Error dettaching SG %s." % sg_name)

res = node.destroy()
success.append(res)
Expand Down

0 comments on commit 0fd7949

Please sign in to comment.