@@ -156,7 +156,7 @@ def cleanup(conn: openstack.connection.Connection, prefix=DEFAULT_PREFIX) -> boo
156156 logging .info (f"↳ deleting volume backup '{ backup .id } ' ..." )
157157 conn .block_storage .delete_backup (backup .id , ignore_missing = False )
158158 except Exception as e :
159- if isinstance (e , openstack .exceptions .ResourceNotFound ):
159+ if isinstance (e , ( openstack .exceptions .ResourceNotFound , openstack . exceptions . NotFoundException ) ):
160160 # if the resource has vanished on its own in the meantime ignore it
161161 # however, ResourceNotFound will also be thrown if the service 'cinder-backup' is missing
162162 if 'cinder-backup' in str (e ):
@@ -209,15 +209,19 @@ def compute_scs_0117_test_backup(conn, prefix=DEFAULT_PREFIX):
209209 the restored volume is correct (for the sake of simplicity, it only uses empty volumes
210210 and does not look at data).
211211 """
212- if not cleanup (conn , prefix = prefix ):
213- raise RuntimeError ("Initial cleanup failed" )
214212 try :
215- test_backup (conn , prefix = prefix )
216- except BaseException :
213+ if not cleanup (conn , prefix = prefix ):
214+ # what we're usually seeing here is either a problem with cinder-backup or with volumes
215+ # -- either way, consider this a FAIL, not an ABORT (these things have to work!)
216+ logging .error ("Initial cleanup failed" )
217+ return False
218+ try :
219+ test_backup (conn , prefix = prefix )
220+ finally :
221+ cleanup (conn , prefix = prefix )
222+ except BaseException as e :
217223 logging .error ('Backup test failed.' )
218224 logging .debug ('exception details' , exc_info = True )
219225 return False
220226 else :
221227 return True
222- finally :
223- cleanup (conn , prefix = prefix )
0 commit comments