#NEWLINE# def instance_update_at_top( self , message , instance , **kwargs ) : #NEWLINE# #INDENT# "Update an instance in the DB if we're a top level cell." #NEWLINE# if ( not self . _at_the_top ( ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# items_to_remove = [ 'id' , 'security_groups' , 'volumes' , 'cell_name' , 'name' , 'metadata' ] #NEWLINE# instance . obj_reset_changes ( items_to_remove ) #NEWLINE# instance . cell_name = _reverse_path ( message . routing_path ) #NEWLINE# LOG . debug ( 'Got update for instance: %(instance)s' , { #NEWLINE# #INDENT# 'instance' : instance , #NEWLINE# #UNINDENT# } , instance_uuid = instance . uuid ) #NEWLINE# expected_vm_state = self . _get_expected_vm_state ( expected_vm_state ) #NEWLINE# expected_task_state = self . _get_expected_task_state ( instance ) #NEWLINE# with utils . temporary_mutation ( message . ctxt , read_deleted = 'yes' ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# with instance . skip_cells_sync ( ) : #NEWLINE# #INDENT# instance . save ( expected_vm_state = expected_vm_state , expected_task_state = expected_task_state ) #NEWLINE# #UNINDENT# #UNINDENT# except exception . InstanceNotFound : #NEWLINE# #INDENT# instance . create ( ) #NEWLINE# #UNINDENT# except exception . NotFound : #NEWLINE# #INDENT# pass