#NEWLINE# def _list_backing_images( self ) : #NEWLINE# #INDENT# 'List the backing images currently in use.' #NEWLINE# inuse_images = [ ] #NEWLINE# for ent in os . listdir ( CONF . instances_path ) : #NEWLINE# #INDENT# if ( ent in self . instance_names ) : #NEWLINE# #INDENT# LOG . debug ( '%s is a valid instance name' , ent ) #NEWLINE# disk_path = os . path . join ( CONF . instances_path , ent , 'disk' ) #NEWLINE# if os . path . exists ( disk_path ) : #NEWLINE# #INDENT# LOG . debug ( '%s has a disk file' , ent ) #NEWLINE# try : #NEWLINE# #INDENT# backing_file = libvirt_utils . get_disk_backing_file ( disk_path ) #NEWLINE# #UNINDENT# except processutils . ProcessExecutionError : #NEWLINE# #INDENT# if ( not os . path . exists ( disk_path ) ) : #NEWLINE# #INDENT# LOG . debug ( 'Failed to get disk backing file: %s' , disk_path ) #NEWLINE# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# LOG . debug ( 'Instance %(instance)s is backed by %(backing)s' , { #NEWLINE# #INDENT# 'instance' : ent , #NEWLINE# 'backing' : backing_file , #NEWLINE# #UNINDENT# } ) #NEWLINE# if backing_file : #NEWLINE# #INDENT# backing_path = os . path . join ( CONF . instances_path , CONF . image_cache_subdirectory_name , backing_file ) #NEWLINE# if ( backing_path not in inuse_images ) : #NEWLINE# #INDENT# inuse_images . append ( backing_path ) #NEWLINE# #UNINDENT# if ( backing_path in self . unexplained_images ) : #NEWLINE# #INDENT# LOG . warning ( _LW ( 'Instance %(instance)s is using a backing file %(backing)s which does not appear in the image service' ) , { #NEWLINE# #INDENT# 'instance' : ent , #NEWLINE# 'backing' : backing_file , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . unexplained_images . remove ( backing_path ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return inuse_images