#NEWLINE# def _find_iso_sr( session ) : #NEWLINE# #INDENT# 'Return the storage repository to hold ISO images.' #NEWLINE# host = session . host_ref #NEWLINE# for ( sr_ref , sr_rec ) in session . get_all_refs_and_recs ( 'SR' ) : #NEWLINE# #INDENT# LOG . debug ( 'ISO: looking at SR %s' , sr_rec ) #NEWLINE# if ( not ( sr_ref [ 'content_type' ] == 'iso' ) ) : #NEWLINE# #INDENT# LOG . debug ( 'ISO: not iso content' ) #NEWLINE# continue #NEWLINE# #UNINDENT# if ( 'i18n-key' not in sr_rec [ 'other_config' ] ) : #NEWLINE# #INDENT# LOG . debug ( "ISO: iso content_type, no 'i18n-key' key" ) #NEWLINE# continue #NEWLINE# #UNINDENT# if ( not ( sr_rec [ 'other_config' ] [ 'i18n-key' ] == 'local-storage-iso' ) ) : #NEWLINE# #INDENT# LOG . debug ( "ISO: iso content_type, i18n-key value not 'local-storage-iso'" ) #NEWLINE# continue #NEWLINE# #UNINDENT# LOG . debug ( 'ISO: SR MATCHing our criteria' ) #NEWLINE# for pbd_ref in sr_rec [ 'PBDs' ] : #NEWLINE# #INDENT# LOG . debug ( 'ISO: ISO, looking to see if it is host local' ) #NEWLINE# pbd_rec = session . get_rec ( 'PBD' , pbd_ref ) #NEWLINE# if ( not pbd_rec ) : #NEWLINE# #INDENT# LOG . debug ( 'ISO: PBD %s disappeared' , pbd_ref ) #NEWLINE# continue #NEWLINE# #UNINDENT# pbd_rec_host = pbd_rec [ 'host' ] #NEWLINE# LOG . debug ( 'ISO: PBD matching, want %(pbd_rec)s, have %(host)s' , { #NEWLINE# #INDENT# 'pbd_rec' : pbd_rec , #NEWLINE# 'host' : host , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( pbd_rec_host == host ) : #NEWLINE# #INDENT# LOG . debug ( 'ISO: SR with local PBD' ) #NEWLINE# return sr_ref #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return None