示例#1
0
//!
//! This API is invoked when eucanetd catches an USR1 or USR2 signal.
//!
//! @param[in] pGni a pointer to the Global Network Information structure
//! @param[in] signal received signal
//!
//! @return 0 on success, 1 otherwise.
//!
//! @see
//!
//! @pre
//!     - pGni must not be NULL
//!     - The driver must be initialized prior to calling this API.
//!
//! @post
//!
//! @note
//!
static int network_driver_handle_signal(globalNetworkInfo *pGni, int signal) {
    LOGTRACE("Handling singal %d for '%s' network driver.\n", signal, DRIVER_NAME());

    // Is the driver initialized?
    if (!IS_INITIALIZED()) {
        LOGERROR("Failed to handle signal. Driver '%s' not initialized.\n", DRIVER_NAME());
        return (1);
    }
    // Is the global network view structure NULL?
    if (!pGni) {
        LOGERROR("Failed to handle signal for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME());
        return (1);
    }

    switch (signal) {
        case SIGUSR1:
            mido_info_midonetapi();
            mido_info_http_count_total();
            mido_info_midocache();
            char *bgprecovery = NULL;
            bgprecovery = discover_mido_bgps(pMidoConfig);
            if (bgprecovery && strlen(bgprecovery)) {
                LOGINFO("\nmido BGP configuration (for manual recovery):\n%s\n", bgprecovery);
            }
            EUCA_FREE(bgprecovery);
            break;
        case SIGUSR2:
            LOGINFO("Going to invalidate midocache\n");
            midocache_invalid = 1;
            break;
        default:
            break;
    }
    return (0);
}
示例#2
0
//!
//! This API is invoked when eucanetd catches an USR1 or USR2 signal.
//!
//! @param[in] pGni a pointer to the Global Network Information structure
//! @param[in] signal received signal
//!
//! @return 0 on success, 1 otherwise.
//!
//! @see
//!
//! @pre
//!     - pGni must not be NULL
//!     - The driver must be initialized prior to calling this API.
//!
//! @post
//!
//! @note
//!
static int network_driver_handle_signal(globalNetworkInfo *pGni, int signal) {
    int rc = 0;
    LOGTRACE("Handling singal %d for '%s' network driver.\n", signal, DRIVER_NAME());

    // Is the driver initialized?
    if (!IS_INITIALIZED()) {
        LOGERROR("Failed to handle signal. Driver '%s' not initialized.\n", DRIVER_NAME());
        return (1);
    }
    // Is the global network view structure NULL?
    if (!pGni) {
        LOGERROR("Failed to handle signal for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME());
        return (1);
    }

    switch (signal) {
        case SIGUSR1:
            mido_info_http_count_total();
            mido_info_midocache();
            break;
        case SIGUSR2:
            LOGINFO("Going to invalidate midocache\n");
            rc = do_midonet_populate(pMidoConfig);
            if (rc) {
                LOGERROR("failed to populate euca VPC models\n");
                midocache_invalid = 1;
            }
            break;
        default:
            break;
    }
    return (0);
}