#NEWLINE# def get_this_vm_uuid( session ) : #NEWLINE# #INDENT# if ( session and session . is_local_connection ) : #NEWLINE# #INDENT# vms = session . call_xenapi ( 'VM.get_all_records_where' , ( 'field "is_control_domain"="true" and field "resident_on"="%s"' % session . host_ref ) ) #NEWLINE# return vms [ list ( vms . keys ( ) ) [ 0 ] ] [ 'uuid' ] #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# return _get_sys_hypervisor_uuid ( ) #NEWLINE# #UNINDENT# except IOError : #NEWLINE# #INDENT# ( domid , _ ) = utils . execute ( 'xenstore-read' , 'domid' , run_as_root = True ) #NEWLINE# ( vm_key , _ ) = utils . execute ( 'xenstore-read' , ( '/local/domain/%s/vm' % domid . strip ( ) ) , run_as_root = True ) #NEWLINE# return vm_key . strip ( ) [ 4 : ]