The error reason that is being displayed now is passed in the variable: evt_details
The function create_event displays the status of the VNF alog with its ID and other parameters.
This part is mentioned in the function create vnf post, where the vnf status- be it ACTIVE or ERROR- the same event_status message is displayed.
1- Since a common message is displayed for all errors messages - we have to fisr identify the errors that are possible and accordingly display the error message
evt_details = ("Infra Instance ID created: %s and " "Mgmt URL set: %s") % (instance_id, mgmt_url)
As we can see, in the set_vnf_error_status_reason, six.text_type(e) parmeter is passed
this is a unicode or a string which passes the exception message or the error message,
The error reason that is being displayed now is passed in the variable: evt_details
The function create_event displays the status of the VNF alog with its ID and other parameters.
This part is mentioned in the function create vnf post, where the vnf status- be it ACTIVE or ERROR- the same event_status message is displayed.
1- Since a common message is displayed for all errors messages - we have to fisr identify the errors that are possible and accordingly display the error message
evt_details = ("Infra Instance ID created: %s and "
"Mgmt URL set: %s") % (instance_id, mgmt_url)
2 - Scenario for error- this is one of the possible reasons error can occur in the code:
try:
self. _vnf_manager. invoke(
driver_ name, 'create_wait', plugin=self, context=context,
vnf_dict= vnf_dict, vnf_id=instance_id,
auth_ attr=auth_ attr) aitFailed as e:
LOG. error(_ LE("VNF Create failed for vnf_id %s"), vnf_id)
create_ failed = True
vnf_ dict['status' ] = constants.ERROR
self. set_vnf_ error_status_ reason( context, vnf_id,
six. text_type( e))
except vnfm.VNFCreateW
As we can see, in the set_vnf_ error_status_ reason, six.text_type(e) parmeter is passed
this is a unicode or a string which passes the exception message or the error message,
3- def set_vnf_ error_status_ reason( self, context, vnf_id, new_reason): session. begin(subtransa ctions= True):
(self. _model_ query(context, VNF).
filter( VNF.id == vnf_id).
update( {'error_ reason' : new_reason}))
with context.
As we can see above, according to the errors- the key value error_reason is updated.
So, in order to display the errors reasons accordingly, the error_reason(in 3) has to be linked to the event details(in 1)