#NEWLINE# def cleanup_volumes( self , instance ) : #NEWLINE# #INDENT# with RADOSClient ( self , self . pool ) as client : #NEWLINE# #INDENT# def belongs_to_instance( disk ) : #NEWLINE# #INDENT# if ( instance . task_state == task_states . RESIZE_REVERTING ) : #NEWLINE# #INDENT# return ( disk . startswith ( instance . uuid ) and disk . endswith ( 'disk.local' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return disk . startswith ( instance . uuid ) #NEWLINE# #UNINDENT# #UNINDENT# volumes = rbd . RBD ( ) . list ( client . ioctx ) #NEWLINE# for volume in filter ( belongs_to_instance , volumes ) : #NEWLINE# #INDENT# self . _destroy_volume ( client , self )