'Determine if nova needs to be notified due to port status change.'

def record_port_status_changed(self, port, current_port_status, previous_port_status, initiator):

    port._notify_event = None
    if (not self._can_notify(port)):
        return
    if ((previous_port_status == constants.PORT_STATUS_ACTIVE) and (current_port_status == constants.PORT_STATUS_DOWN)):
        event_name = VIF_UNPLUGGED
    elif ((previous_port_status in [sql_attr.NO_VALUE, constants.PORT_STATUS_DOWN, constants.PORT_STATUS_BUILD]) and (current_port_status in [constants.PORT_STATUS_ACTIVE, constants.PORT_STATUS_ERROR])):
        event_name = VIF_PLUGGED
    else:
        LOG.debug('Ignoring    state    change    previous_port_status:    %(pre_status)s    current_port_status:    %(cur_status)s    port_id    %(id)s', {'pre_status': previous_port_status, 'cur_status': current_port_status, 'id': port.id})
        return
    port._notify_event = {'server_uuid': port.device_id, 'name': event_name, 'status': NEUTRON_NOVA_EVENT_STATUS_MAP.get(current_port_status), 'tag': port.id}
