#NEWLINE# def get_domain_info( libvirt , host , virt_dom ) : #NEWLINE# #INDENT# 'Method virDomain.info (libvirt version < 1.2.11) is\n    affected by a race condition. See bug #1372670 for more details.\n    This method detects it to perform a retry.\n    ' #NEWLINE# def is_race( e ) : #NEWLINE# #INDENT# code = e . get_error_code ( ) #NEWLINE# message = e . get_error_message ( ) #NEWLINE# return ( ( code == libvirt . VIR_ERR_OPERATION_FAILED ) and ( 'cannot read cputime for domain' in message ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# return virt_dom . info ( ) #NEWLINE# #UNINDENT# except e . libvirtError as e : #NEWLINE# #INDENT# if ( ( not host . has_min_version ( ( 1 , 2 , 11 ) ) ) and is_race ( e ) ) : #NEWLINE# #INDENT# LOG . warning ( _LW ( 'Race detected in libvirt.virDomain.info, trying one more time' ) ) #NEWLINE# return virt_dom . info ( ) #NEWLINE# #UNINDENT# raise