Пример #1
0
//!
//! Cleans up the network driver. This will work even if the initial initialization
//! fail for any reasons. This will reset anything that could have been half-way or
//! fully configured. If forceFlush is set, then a network flush will be performed.
//!
//! @param[in] pGni a pointer to the Global Network Information structure
//! @param[in] forceFlush set to TRUE if a network flush needs to be performed
//!
//! @return 0 on success or 1 if any failure occurred.
//!
//! @see
//!
//! @pre
//!     The driver should have been initialized already
//!
//! @post
//|     On success, the network driver has been cleaned up and the system flushed
//!     if forceFlush was set. On failure, the system state will be non-deterministic.
//!
//! @note
//!
static int network_driver_cleanup(globalNetworkInfo *pGni, boolean forceFlush)
{
    int ret = 0;

    if (forceFlush) {
        if (network_driver_system_flush(pGni)) {
            LOGERROR("Fail to flush network artifacts during network driver cleanup. See above log errors for details.\n");
            ret = 1;
        }
    }
    midonet_api_cleanup();
    gInitialized = FALSE;
    return (ret);
}
Пример #2
0
/**
 * Cleans up the network driver. This will work even if the initial initialization
 * fail for any reasons. This will reset anything that could have been half-way or
 * fully configured. If forceFlush is set, then a network flush will be performed.
 * @param pConfig [in] a pointer to eucanetd system-wide configuration
 * @param pGni [in] a pointer to the Global Network Information structure
 * @param forceFlush [in] set to TRUE if a network flush needs to be performed
 * @return 0 on success. Integer number on failure.
 */
static int network_driver_cleanup(eucanetdConfig *pConfig, globalNetworkInfo *pGni, boolean forceFlush) {
    int ret = 0;

    LOGINFO("Cleaning up '%s' network driver.\n", DRIVER_NAME());

    if (forceFlush) {
        if (network_driver_system_flush(pConfig, pGni)) {
            LOGERROR("Fail to flush network artifacts during network driver cleanup. See above log errors for details.\n");
            ret = 1;
        }
    }
    midonet_api_cleanup();
    free_mido_config(pMidoConfig);
    EUCA_FREE(pMidoConfig);
    gInitialized = FALSE;
    return (ret);
}