Esempio n. 1
0
//!
//! Maintenance activities to be executed when eucanetd is idle between polls.
//!
//! @param[in] pGni a pointer to the Global Network Information structure
//! @param[in] pLni a pointer to the Local Network Information structure
//!
//! @return 0 on success, 1 otherwise.
//!
//! @see
//!
//! @pre
//!     - pGni must not be NULL. pLni is ignored.
//!     - The driver must be initialized prior to calling this API.
//!
//! @post
//!
//! @note
//!
static int network_driver_system_maint(globalNetworkInfo *pGni, lni_t *pLni)
{
    int rc = 0;
    struct timeval tv;
    
    LOGTRACE("Running maintenance for '%s' network driver.\n", DRIVER_NAME());
    eucanetd_timer(&tv);

    // Is the driver initialized?
    if (!IS_INITIALIZED()) {
        LOGERROR("Failed to run maintenance activities. Driver '%s' not initialized.\n", DRIVER_NAME());
        return (1);
    }
    // Need a valid global network view
    if (!pGni) {
        LOGERROR("Failed to run maintenance for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME());
        return (1);
    }

    // Make sure midoname buffer is available
    midonet_api_cache_midos_init();

    rc = do_midonet_maint(pMidoConfig);
    return (rc);
}
Esempio n. 2
0
//!
//! Maintenance activities to be executed when eucanetd is idle between polls.
//!
//! @param[in] pGni a pointer to the Global Network Information structure
//! @param[in] pLni a pointer to the Local Network Information structure
//!
//! @return 0 on success, 1 otherwise.
//!
//! @see
//!
//! @pre
//!     - pGni must not be NULL. pLni is ignored.
//!     - The driver must be initialized prior to calling this API.
//!
//! @post
//!
//! @note
//!
static int network_driver_system_maint(globalNetworkInfo *pGni, lni_t *pLni)
{
    int rc = 0;
    struct timeval tv;
    
    LOGDEBUG("Running maintenance for '%s' network driver.\n", DRIVER_NAME());
    eucanetd_timer(&tv);

    // Is the driver initialized?
    if (!IS_INITIALIZED()) {
        LOGERROR("Failed to run maintenance activities. Driver '%s' not initialized.\n", DRIVER_NAME());
        return (1);
    }
    // Need a valid global network view
    if (!pGni) {
        LOGERROR("Failed to run maintenance for '%s' network driver. Invalid parameters provided.\n", DRIVER_NAME());
        return (1);
    }

    if (midonet_api_dirty_cache == 1) {
        // Cache is invalid. Let's pre-populate mido.
        rc = do_midonet_maint(pMidoConfig);
    }
    return (rc);
}