#NEWLINE# def hard_shutdown_vm( session , instance , vm_ref ) : #NEWLINE# #INDENT# if is_vm_shutdown ( instance , vm_ref ) : #NEWLINE# #INDENT# LOG . warning ( _LW ( 'VM already halted, skipping shutdown...' ) , instance = instance ) #NEWLINE# return True #NEWLINE# #UNINDENT# LOG . debug ( 'Shutting down VM (hard)' , instance = instance ) #NEWLINE# try : #NEWLINE# #INDENT# session . call_xenapi ( 'VM.hard_shutdown' , vm_ref ) #NEWLINE# #UNINDENT# except session . XenAPI . Failure : #NEWLINE# #INDENT# LOG . exception ( _LE ( 'Shutting down VM (hard) failed' ) ) #NEWLINE# return False #NEWLINE# #UNINDENT# return True