def set_vm_state_and_notify(context, instance_uuid, service, method, updates, ex, request_spec):
 LOG.warning(_LW('Failed to %(service)s_%(method)s: %(ex)s'), {'service': service, 'method': method, 'ex': ex})
 vm_state = updates['vm_state']
 properties = request_spec.get('instance_properties', {})
 notifier = rpc.get_notifier(service)
 state = vm_state.upper()
 LOG.warning(_LW('Setting instance to %s state.'), state, instance_uuid=instance_uuid)
 instance = objects.Instance(context=context, uuid=instance_uuid, **updates)
 instance.obj_reset_changes(['uuid'])
 instance.save()
 compute_utils.add_instance_fault_from_exc(context, instance, ex, sys.exc_info())
 payload = dict(request_spec=request_spec, instance_properties=properties, instance_id=instance_uuid, state=vm_state, method=method, reason=ex)
 event_type = ('%s.%s' % (service, method))
 notifier.error(context, event_type, payload)

def set_vm_state_and_notify ( context , instance_uuid , service , method , updates , ex , request_spec ) : LOG . warning ( _LW ( 'Failed to %(service)s_%(method)s: %(ex)s' ) , { 'service' : service , 'method' : method , 'ex' : ex } ) vm_state = updates [ 'vm_state' ] properties = request_spec . get ( 'instance_properties' , { } ) notifier = rpc . get_notifier ( service ) state = vm_state . upper ( ) LOG . warning ( _LW ( 'Setting instance to %s state.' ) , state , instance_uuid = instance_uuid ) instance = objects . Instance ( context = context , uuid = instance_uuid , ** updates ) instance . obj_reset_changes ( [ 'uuid' ] ) instance . save ( ) compute_utils . add_instance_fault_from_exc ( context , instance , ex , sys . exc_info ( ) ) payload = dict ( request_spec = request_spec , instance_properties = properties , instance_id = instance_uuid , state = vm_state , method = method , reason = ex ) event_type = ( '%s.%s' % ( service , method ) ) notifier . error ( context , event_type , payload )
changes vm state and notifies .