http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git
a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index c7bc61c..c32aeba 100644
---
a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++
b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -62,6 +62,7 @@ import org.apache.cloudstack.network.topology.NetworkTopology;
import org.apache.cloudstack.network.topology.NetworkTopologyContext;
import org.apache.cloudstack.utils.identity.ManagementServerNode;
import org.apache.cloudstack.utils.usage.UsageUtils;
+import org.apache.log4j.Logger;
import org.cloud.network.router.deployment.RouterDeploymentDefinitionBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -251,6 +252,7 @@ import com.cloud.vm.dao.VMInstanceDao;
@Local(value = { VirtualNetworkApplianceManager.class,
VirtualNetworkApplianceService.class })
public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements
VirtualNetworkApplianceManager, VirtualNetworkApplianceService,
VirtualMachineGuru, Listener,
Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
+ private static final Logger s_logger =
Logger.getLogger(VirtualNetworkApplianceManagerImpl.class);
@Inject
EntityManager _entityMgr;
@@ -426,7 +428,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
_accountMgr.checkAccess(caller, null, true, router);
if (router.getServiceOfferingId() == serviceOfferingId) {
- logger.debug("Router: " + routerId + "already has service
offering: " + serviceOfferingId);
+ s_logger.debug("Router: " + routerId + "already has service
offering: " + serviceOfferingId);
return _routerDao.findById(routerId);
}
@@ -443,7 +445,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
// Check that the router is stopped
if (!router.getState().equals(State.Stopped)) {
- logger.warn("Unable to upgrade router " + router.toString() + " in
state " + router.getState());
+ s_logger.warn("Unable to upgrade router " + router.toString() + "
in state " + router.getState());
throw new InvalidParameterValueException("Unable to upgrade router
" + router.toString() + " in state " + router.getState()
+ "; make sure the router is stopped and not in an error
state before upgrading.");
}
@@ -490,7 +492,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
// Clear stop pending flag after stopped successfully
if (router.isStopPending()) {
- logger.info("Clear the stop pending flag of router " +
router.getHostName() + " after stop router successfully");
+ s_logger.info("Clear the stop pending flag of router " +
router.getHostName() + " after stop router successfully");
router.setStopPending(false);
_routerDao.persist(router);
virtualRouter.setStopPending(false);
@@ -518,9 +520,9 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
userStats.setCurrentBytesSent(0);
userStats.setNetBytesSent(userStats.getNetBytesSent()
+ currentBytesSent);
_userStatsDao.update(userStats.getId(), userStats);
- logger.debug("Successfully updated user statistics as
a part of domR " + router + " reboot/stop");
+ s_logger.debug("Successfully updated user statistics
as a part of domR " + router + " reboot/stop");
} else {
- logger.warn("User stats were not created for account "
+ router.getAccountId() + " and dc " + router.getDataCenterId());
+ s_logger.warn("User stats were not created for account
" + router.getAccountId() + " and dc " + router.getDataCenterId());
}
}
}
@@ -543,12 +545,12 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
// Can reboot domain router only in Running state
if (router == null || router.getState() != State.Running) {
- logger.warn("Unable to reboot, virtual router is not in the right
state " + router.getState());
+ s_logger.warn("Unable to reboot, virtual router is not in the
right state " + router.getState());
throw new ResourceUnavailableException("Unable to reboot domR, it
is not in right state " + router.getState(), DataCenter.class,
router.getDataCenterId());
}
final UserVO user =
_userDao.findById(CallContext.current().getCallingUserId());
- logger.debug("Stopping and starting router " + router + " as a part of
router reboot");
+ s_logger.debug("Stopping and starting router " + router + " as a part
of router reboot");
if (stop(router, false, user, caller) != null) {
return startRouter(routerId, reprogramNetwork);
@@ -623,7 +625,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
_dnsBasicZoneUpdates =
String.valueOf(_configDao.getValue(Config.DnsBasicZoneUpdates.key()));
- logger.info("Router configurations: " + "ramsize=" + _routerRamSize);
+ s_logger.info("Router configurations: " + "ramsize=" + _routerRamSize);
_agentMgr.registerForHostEvents(new SshKeysDistriMonitor(_agentMgr,
_hostDao, _configDao), true, false, false);
@@ -633,7 +635,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
// this can sometimes happen, if DB is manually or programmatically
manipulated
if (offerings == null || offerings.size() < 2) {
final String msg = "Data integrity problem : System Offering For
Software router VM has been removed?";
- logger.error(msg);
+ s_logger.error(msg);
throw new ConfigurationException(msg);
}
@@ -648,7 +650,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
_agentMgr.registerForHostEvents(this, true, false, false);
- logger.info("DomainRouterManager is configured.");
+ s_logger.info("DomainRouterManager is configured.");
return true;
}
@@ -658,7 +660,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
if (_routerStatsInterval > 0) {
_executor.scheduleAtFixedRate(new NetworkUsageTask(),
_routerStatsInterval, _routerStatsInterval, TimeUnit.SECONDS);
} else {
- logger.debug("router.stats.interval - " + _routerStatsInterval + "
so not scheduling the router stats thread");
+ s_logger.debug("router.stats.interval - " + _routerStatsInterval +
" so not scheduling the router stats thread");
}
//Schedule Network stats update task
@@ -695,7 +697,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
}
if (_usageAggregationRange < UsageUtils.USAGE_AGGREGATION_RANGE_MIN) {
- logger.warn("Usage stats job aggregation range is to small, using
the minimum value of " + UsageUtils.USAGE_AGGREGATION_RANGE_MIN);
+ s_logger.warn("Usage stats job aggregation range is to small,
using the minimum value of " + UsageUtils.USAGE_AGGREGATION_RANGE_MIN);
_usageAggregationRange = UsageUtils.USAGE_AGGREGATION_RANGE_MIN;
}
@@ -703,7 +705,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
final long initialDelay = aggDate - System.currentTimeMillis();
if( initialDelay < 0){
- logger.warn("Initial delay for network usage stats update task is
incorrect. Stats update task will run immediately");
+ s_logger.warn("Initial delay for network usage stats update task
is incorrect. Stats update task will run immediately");
}
_networkStatsUpdateExecutor.scheduleAtFixedRate(new
NetworkStatsUpdateTask(), initialDelay, _usageAggregationRange * 60 * 1000,
@@ -715,14 +717,14 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
_rvrStatusUpdateExecutor.execute(new RvRStatusUpdateTask());
}
} else {
- logger.debug("router.check.interval - " + _routerCheckInterval + "
so not scheduling the redundant router checking thread");
+ s_logger.debug("router.check.interval - " + _routerCheckInterval +
" so not scheduling the redundant router checking thread");
}
final int routerAlertsCheckInterval =
RouterAlertsCheckInterval.value();
if (routerAlertsCheckInterval > 0) {
_checkExecutor.scheduleAtFixedRate(new CheckRouterAlertsTask(),
routerAlertsCheckInterval, routerAlertsCheckInterval, TimeUnit.SECONDS);
} else {
- logger.debug("router.alerts.check.interval - " +
routerAlertsCheckInterval + " so not scheduling the router alerts checking
thread");
+ s_logger.debug("router.alerts.check.interval - " +
routerAlertsCheckInterval + " so not scheduling the router alerts checking
thread");
}
return true;
@@ -745,7 +747,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
protected void runInContext() {
try {
final List<DomainRouterVO> routers =
_routerDao.listByStateAndNetworkType(State.Running, GuestType.Isolated,
mgmtSrvrId);
- logger.debug("Found " + routers.size() + " running routers. ");
+ s_logger.debug("Found " + routers.size() + " running routers.
");
for (final DomainRouterVO router : routers) {
final String privateIP = router.getPrivateIpAddress();
@@ -760,7 +762,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
//[TODO] Avoiding the NPE now, but I have to find
out what is going on with the network. - Wilder Rodrigues
if (network == null) {
- logger.error("Could not find a network with ID
=> " + routerNic.getNetworkId() + ". It might be a problem!");
+ s_logger.error("Could not find a network with
ID => " + routerNic.getNetworkId() + ". It might be a problem!");
continue;
}
if (forVpc && network.getTrafficType() ==
TrafficType.Public || !forVpc && network.getTrafficType() == TrafficType.Guest
@@ -773,19 +775,19 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
try {
answer = (NetworkUsageAnswer)
_agentMgr.easySend(router.getHostId(), usageCmd);
} catch (final Exception e) {
- logger.warn("Error while collecting
network stats from router: " + router.getInstanceName() + " from host: " +
router.getHostId(), e);
+ s_logger.warn("Error while collecting
network stats from router: " + router.getInstanceName() + " from host: " +
router.getHostId(), e);
continue;
}
if (answer != null) {
if (!answer.getResult()) {
- logger.warn("Error while collecting
network stats from router: " + router.getInstanceName() + " from host: " +
router.getHostId()
+ s_logger.warn("Error while collecting
network stats from router: " + router.getInstanceName() + " from host: " +
router.getHostId()
+ "; details: " +
answer.getDetails());
continue;
}
try {
if (answer.getBytesReceived() == 0 &&
answer.getBytesSent() == 0) {
- logger.debug("Recieved and Sent
bytes are both 0. Not updating user_statistics");
+ s_logger.debug("Recieved and Sent
bytes are both 0. Not updating user_statistics");
continue;
}
final NetworkUsageAnswer answerFinal =
answer;
@@ -795,21 +797,21 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
final UserStatisticsVO stats =
_userStatsDao.lock(router.getAccountId(), router.getDataCenterId(),
network.getId(),
forVpc ?
routerNic.getIPv4Address() : null, router.getId(), routerType);
if (stats == null) {
- logger.warn("unable to
find stats for account: " + router.getAccountId());
+ s_logger.warn("unable to
find stats for account: " + router.getAccountId());
return;
}
if (previousStats != null
&&
(previousStats.getCurrentBytesReceived() != stats.getCurrentBytesReceived() ||
previousStats.getCurrentBytesSent() != stats
.getCurrentBytesSent())) {
- logger.debug("Router stats
changed from the time NetworkUsageCommand was sent. " + "Ignoring current
answer. Router: "
+ s_logger.debug("Router
stats changed from the time NetworkUsageCommand was sent. " + "Ignoring current
answer. Router: "
+
answerFinal.getRouterName() + " Rcvd: " + answerFinal.getBytesReceived() +
"Sent: " + answerFinal.getBytesSent());
return;
}
if
(stats.getCurrentBytesReceived() > answerFinal.getBytesReceived()) {
- if
(logger.isDebugEnabled()) {
- logger.debug("Received
# of bytes that's less than the last one. "
+ if
(s_logger.isDebugEnabled()) {
+
s_logger.debug("Received # of bytes that's less than the last one. "
+ "Assuming
something went wrong and persisting it. Router: " + answerFinal.getRouterName()
+ " Reported: "
+
answerFinal.getBytesReceived() + " Stored: " + stats.getCurrentBytesReceived());
}
@@ -817,8 +819,8 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
}
stats.setCurrentBytesReceived(answerFinal.getBytesReceived());
if
(stats.getCurrentBytesSent() > answerFinal.getBytesSent()) {
- if
(logger.isDebugEnabled()) {
- logger.debug("Received
# of bytes that's less than the last one. "
+ if
(s_logger.isDebugEnabled()) {
+
s_logger.debug("Received # of bytes that's less than the last one. "
+ "Assuming
something went wrong and persisting it. Router: " + answerFinal.getRouterName()
+ " Reported: "
+
answerFinal.getBytesSent() + " Stored: " + stats.getCurrentBytesSent());
}
@@ -835,7 +837,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
});
} catch (final Exception e) {
- logger.warn("Unable to update user
statistics for account: " + router.getAccountId() + " Rx: " +
answer.getBytesReceived() + "; Tx: "
+ s_logger.warn("Unable to update user
statistics for account: " + router.getAccountId() + " Rx: " +
answer.getBytesReceived() + "; Tx: "
+ answer.getBytesSent());
}
}
@@ -844,7 +846,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
}
}
} catch (final Exception e) {
- logger.warn("Error while collecting network stats", e);
+ s_logger.warn("Error while collecting network stats", e);
}
}
}
@@ -863,7 +865,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
// msHost in UP state with min id should run the job
final ManagementServerHostVO msHost =
_msHostDao.findOneInUpState(new Filter(ManagementServerHostVO.class, "id",
false, 0L, 1L));
if (msHost == null || msHost.getMsid() != mgmtSrvrId) {
- logger.debug("Skipping aggregate network stats
update");
+ s_logger.debug("Skipping aggregate network stats
update");
scanLock.unlock();
return;
}
@@ -884,17 +886,17 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
.getCurrentBytesReceived(),
stat.getCurrentBytesSent(), stat.getAggBytesReceived(), stat.getAggBytesSent(),
updatedTime);
_userStatsLogDao.persist(statsLog);
}
- logger.debug("Successfully updated aggregate
network stats");
+ s_logger.debug("Successfully updated aggregate
network stats");
}
});
} catch (final Exception e) {
- logger.debug("Failed to update aggregate network
stats", e);
+ s_logger.debug("Failed to update aggregate network
stats", e);
} finally {
scanLock.unlock();
}
}
} catch (final Exception e) {
- logger.debug("Exception while trying to acquire network stats
lock", e);
+ s_logger.debug("Exception while trying to acquire network
stats lock", e);
} finally {
scanLock.releaseRef();
}
@@ -942,11 +944,11 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
if (origAnswer instanceof CheckS2SVpnConnectionsAnswer) {
answer = (CheckS2SVpnConnectionsAnswer) origAnswer;
} else {
- logger.warn("Unable to update router " +
router.getHostName() + "'s VPN connection status");
+ s_logger.warn("Unable to update router " +
router.getHostName() + "'s VPN connection status");
continue;
}
if (!answer.getResult()) {
- logger.warn("Unable to update router " +
router.getHostName() + "'s VPN connection status");
+ s_logger.warn("Unable to update router " +
router.getHostName() + "'s VPN connection status");
continue;
}
for (final Site2SiteVpnConnectionVO conn : conns) {
@@ -970,7 +972,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
final String title = "Site-to-site Vpn Connection
to " + gw.getName() + " just switch from " + oldState + " to " +
conn.getState();
final String context = "Site-to-site Vpn
Connection to " + gw.getName() + " on router " + router.getHostName() + "(id: "
+ router.getId() + ") "
+ " just switch from " + oldState + " to "
+ conn.getState();
- logger.info(context);
+ s_logger.info(context);
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER,
router.getDataCenterId(), router.getPodIdToDeployIn(), title, context);
}
} finally {
@@ -1008,13 +1010,13 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
if (origAnswer instanceof CheckRouterAnswer) {
answer = (CheckRouterAnswer) origAnswer;
} else {
- logger.warn("Unable to update router " +
router.getHostName() + "'s status");
+ s_logger.warn("Unable to update router " +
router.getHostName() + "'s status");
}
RedundantState state = RedundantState.UNKNOWN;
if (answer != null && answer.getResult()) {
state = answer.getState();
} else {
- logger.info("Agent response doesn't seem to be correct
==> " + answer.getResult());
+ s_logger.info("Agent response doesn't seem to be
correct ==> " + answer.getResult());
}
router.setRedundantState(state);
updated = true;
@@ -1028,7 +1030,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
final String title = "Redundant virtual router " +
router.getInstanceName() + " just switch from " + prevState + " to " +
currState;
final String context = "Redundant virtual router (name: " +
router.getHostName() + ", id: " + router.getId() + ") " + " just switch from "
+ prevState + " to "
+ currState;
- logger.info(context);
+ s_logger.info(context);
if (currState == RedundantState.MASTER) {
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER,
router.getDataCenterId(), router.getPodIdToDeployIn(), title, context);
}
@@ -1044,18 +1046,18 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
final HostVO backupHost =
_hostDao.findById(backupRouter.getHostId());
if (masterHost.getState() == Status.Up && backupHost.getState() ==
Status.Up) {
final String title = "Reboot " +
backupRouter.getInstanceName() + " to ensure redundant virtual routers work";
- if (logger.isDebugEnabled()) {
- logger.debug(title);
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug(title);
}
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER,
backupRouter.getDataCenterId(), backupRouter.getPodIdToDeployIn(), title,
title);
try {
rebootRouter(backupRouter.getId(), true);
} catch (final ConcurrentOperationException e) {
- logger.warn("Fail to reboot " +
backupRouter.getInstanceName(), e);
+ s_logger.warn("Fail to reboot " +
backupRouter.getInstanceName(), e);
} catch (final ResourceUnavailableException e) {
- logger.warn("Fail to reboot " +
backupRouter.getInstanceName(), e);
+ s_logger.warn("Fail to reboot " +
backupRouter.getInstanceName(), e);
} catch (final InsufficientCapacityException e) {
- logger.warn("Fail to reboot " +
backupRouter.getInstanceName(), e);
+ s_logger.warn("Fail to reboot " +
backupRouter.getInstanceName(), e);
}
}
}
@@ -1136,7 +1138,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
+ ", id: " + router.getId() + ") are both
in MASTER state! If the problem persist, restart both of routers. ";
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER,
router.getDataCenterId(), router.getPodIdToDeployIn(), title, context);
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER,
dupRouter.getDataCenterId(), dupRouter.getPodIdToDeployIn(), title, context);
- logger.warn(context);
+ s_logger.warn(context);
} else {
networkRouterMaps.put(routerGuestNtwkId, router);
}
@@ -1188,19 +1190,19 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
}
// && router.getState() == State.Stopped
if (router.getHostId() == null && router.getState() ==
State.Running) {
- logger.debug("Skip router pair (" +
router0.getInstanceName() + "," + router1.getInstanceName() + ") due to can't
find host");
+ s_logger.debug("Skip router pair (" +
router0.getInstanceName() + "," + router1.getInstanceName() + ") due to can't
find host");
continue;
}
final HostVO host = _hostDao.findById(router.getHostId());
if (host == null || host.getManagementServerId() == null
|| host.getManagementServerId() !=
ManagementServerNode.getManagementServerId()) {
- logger.debug("Skip router pair (" +
router0.getInstanceName() + "," + router1.getInstanceName() + ") due to not
belong to this mgmt server");
+ s_logger.debug("Skip router pair (" +
router0.getInstanceName() + "," + router1.getInstanceName() + ") due to not
belong to this mgmt server");
continue;
}
updateRoutersRedundantState(routers);
checkDuplicateMaster(routers);
checkSanity(routers);
} catch (final Exception ex) {
- logger.error("Fail to complete the RvRStatusUpdateTask! ",
ex);
+ s_logger.error("Fail to complete the RvRStatusUpdateTask!
", ex);
}
}
}
@@ -1215,26 +1217,26 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
protected void runInContext() {
try {
final List<DomainRouterVO> routers =
_routerDao.listIsolatedByHostId(null);
- logger.debug("Found " + routers.size() + " routers to update
status. ");
+ s_logger.debug("Found " + routers.size() + " routers to update
status. ");
updateSite2SiteVpnConnectionState(routers);
List<NetworkVO> networks = _networkDao.listVpcNetworks();
- logger.debug("Found " + networks.size() + " VPC networks to
update Redundant State. ");
+ s_logger.debug("Found " + networks.size() + " VPC networks to
update Redundant State. ");
pushToUpdateQueue(networks);
networks = _networkDao.listRedundantNetworks();
- logger.debug("Found " + networks.size() + " networks to update
RvR status. ");
+ s_logger.debug("Found " + networks.size() + " networks to
update RvR status. ");
pushToUpdateQueue(networks);
} catch (final Exception ex) {
- logger.error("Fail to complete the CheckRouterTask! ", ex);
+ s_logger.error("Fail to complete the CheckRouterTask! ", ex);
}
}
protected void pushToUpdateQueue(final List<NetworkVO> networks)
throws InterruptedException {
for (final NetworkVO network : networks) {
if (!_vrUpdateQueue.offer(network.getId(), 500,
TimeUnit.MILLISECONDS)) {
- logger.warn("Cannot insert into virtual router update
queue! Adjustment of router.check.interval and router.check.poolsize maybe
needed.");
+ s_logger.warn("Cannot insert into virtual router update
queue! Adjustment of router.check.interval and router.check.poolsize maybe
needed.");
break;
}
}
@@ -1250,7 +1252,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
try {
getRouterAlerts();
} catch (final Exception ex) {
- logger.error("Fail to complete the CheckRouterAlertsTask! ",
ex);
+ s_logger.error("Fail to complete the CheckRouterAlertsTask! ",
ex);
}
}
}
@@ -1259,7 +1261,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
try {
final List<DomainRouterVO> routers =
_routerDao.listByStateAndManagementServer(State.Running, mgmtSrvrId);
- logger.debug("Found " + routers.size() + " running routers. ");
+ s_logger.debug("Found " + routers.size() + " running routers. ");
for (final DomainRouterVO router : routers) {
final String serviceMonitoringFlag =
SetServiceMonitor.valueIn(router.getDataCenterId());
@@ -1292,17 +1294,17 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
GetRouterAlertsAnswer answer = null;
if (origAnswer == null) {
- logger.warn("Unable to get alerts from router " +
router.getHostName());
+ s_logger.warn("Unable to get alerts from router "
+ router.getHostName());
continue;
}
if (origAnswer instanceof GetRouterAlertsAnswer) {
answer = (GetRouterAlertsAnswer) origAnswer;
} else {
- logger.warn("Unable to get alerts from router " +
router.getHostName());
+ s_logger.warn("Unable to get alerts from router "
+ router.getHostName());
continue;
}
if (!answer.getResult()) {
- logger.warn("Unable to get alerts from router " +
router.getHostName() + " " + answer.getDetails());
+ s_logger.warn("Unable to get alerts from router "
+ router.getHostName() + " " + answer.getDetails());
continue;
}
@@ -1314,7 +1316,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
try {
sdfrmt.parse(lastAlertTimeStamp);
} catch (final ParseException e) {
- logger.warn("Invalid last alert timestamp
received while collecting alerts from router: " + router.getInstanceName());
+ s_logger.warn("Invalid last alert timestamp
received while collecting alerts from router: " + router.getInstanceName());
continue;
}
for (final String alert : alerts) {
@@ -1330,13 +1332,13 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
}
}
} catch (final Exception e) {
- logger.warn("Error while collecting alerts from
router: " + router.getInstanceName(), e);
+ s_logger.warn("Error while collecting alerts from
router: " + router.getInstanceName(), e);
continue;
}
}
}
} catch (final Exception e) {
- logger.warn("Error while collecting alerts from router", e);
+ s_logger.warn("Error while collecting alerts from router", e);
}
}
@@ -1404,12 +1406,12 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
// DOMR control command is sent over management server in
VMware
if (dest.getHost().getHypervisorType() ==
HypervisorType.VMware || dest.getHost().getHypervisorType() ==
HypervisorType.Hyperv) {
- logger.info("Check if we need to add management server
explicit route to DomR. pod cidr: " + dest.getPod().getCidrAddress() + "/"
+ s_logger.info("Check if we need to add management server
explicit route to DomR. pod cidr: " + dest.getPod().getCidrAddress() + "/"
+ dest.getPod().getCidrSize() + ", pod gateway: "
+ dest.getPod().getGateway() + ", management host: "
+
ApiServiceConfiguration.ManagementHostIPAdr.value());
- if (logger.isInfoEnabled()) {
- logger.info("Add management server explicit route to
DomR.");
+ if (s_logger.isInfoEnabled()) {
+ s_logger.info("Add management server explicit route to
DomR.");
}
// always add management explicit route, for basic
@@ -1512,7 +1514,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
acntq.and(acntq.entity().getUsername(), SearchCriteria.Op.EQ,
"baremetal-system-account");
final UserVO user = acntq.find();
if (user == null) {
- logger.warn(String
+ s_logger.warn(String
.format("global
setting[baremetal.provision.done.notification] is enabled but user
baremetal-system-account is not found. Baremetal provision done notification
will not be enabled"));
} else {
buf.append(String.format("
baremetalnotificationsecuritykey=%s", user.getSecretKey()));
@@ -1522,8 +1524,8 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
}
}
- if (logger.isDebugEnabled()) {
- logger.debug("Boot Args for " + profile + ": " + buf.toString());
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("Boot Args for " + profile + ": " + buf.toString());
}
return true;
@@ -1614,7 +1616,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
buf.append(" router_password=").append(password);
} catch (final NoSuchAlgorithmException e) {
- logger.error("Failed to pssword! Will use the plan B
instead.");
+ s_logger.error("Failed to pssword! Will use the plan B
instead.");
buf.append(" router_password=").append(vpc.getUuid());
}
@@ -1669,7 +1671,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
final NicProfile controlNic = getControlNic(profile);
if (controlNic == null) {
- logger.error("Control network doesn't exist for the router " +
router);
+ s_logger.error("Control network doesn't exist for the router " +
router);
return false;
}
@@ -1730,7 +1732,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
final NetworkVO network = _networkDao.findById(networkId);
- logger.debug("Creating monitoring services on " + router + "
start...");
+ s_logger.debug("Creating monitoring services on " + router + "
start...");
// get the list of sevices for this network to monitor
final List<MonitoringServiceVO> services = new
ArrayList<MonitoringServiceVO>();
@@ -1820,19 +1822,19 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
protected void finalizeUserDataAndDhcpOnStart(final Commands cmds, final
DomainRouterVO router, final Provider provider, final Long guestNetworkId) {
if (_networkModel.isProviderSupportServiceInNetwork(guestNetworkId,
Service.Dhcp, provider)) {
// Resend dhcp
- logger.debug("Reapplying dhcp entries as a part of domR " + router
+ " start...");
+ s_logger.debug("Reapplying dhcp entries as a part of domR " +
router + " start...");
_commandSetupHelper.createDhcpEntryCommandsForVMs(router, cmds,
guestNetworkId);
}
if (_networkModel.isProviderSupportServiceInNetwork(guestNetworkId,
Service.UserData, provider)) {
// Resend user data
- logger.debug("Reapplying vm data (userData and metaData) entries
as a part of domR " + router + " start...");
+ s_logger.debug("Reapplying vm data (userData and metaData) entries
as a part of domR " + router + " start...");
_commandSetupHelper.createVmDataCommandForVMs(router, cmds,
guestNetworkId);
}
}
protected void finalizeNetworkRulesForNetwork(final Commands cmds, final
DomainRouterVO router, final Provider provider, final Long guestNetworkId) {
- logger.debug("Resending ipAssoc, port forwarding, load balancing rules
as a part of Virtual router start");
+ s_logger.debug("Resending ipAssoc, port forwarding, load balancing
rules as a part of Virtual router start");
final ArrayList<? extends PublicIpAddress> publicIps =
getPublicIpsToApply(router, provider, guestNetworkId);
final List<FirewallRule> firewallRulesEgress = new
ArrayList<FirewallRule>();
@@ -1847,7 +1849,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
}
// Re-apply firewall Egress rules
- logger.debug("Found " + firewallRulesEgress.size() + " firewall Egress
rule(s) to apply as a part of domR " + router + " start.");
+ s_logger.debug("Found " + firewallRulesEgress.size() + " firewall
Egress rule(s) to apply as a part of domR " + router + " start.");
if (!firewallRulesEgress.isEmpty()) {
_commandSetupHelper.createFirewallRulesCommands(firewallRulesEgress, router,
cmds, guestNetworkId);
}
@@ -1888,25 +1890,25 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
}
// Re-apply static nats
- logger.debug("Found " + staticNats.size() + " static nat(s) to
apply as a part of domR " + router + " start.");
+ s_logger.debug("Found " + staticNats.size() + " static nat(s) to
apply as a part of domR " + router + " start.");
if (!staticNats.isEmpty()) {
_commandSetupHelper.createApplyStaticNatCommands(staticNats,
router, cmds, guestNetworkId);
}
// Re-apply firewall Ingress rules
- logger.debug("Found " + firewallRulesIngress.size() + " firewall
Ingress rule(s) to apply as a part of domR " + router + " start.");
+ s_logger.debug("Found " + firewallRulesIngress.size() + " firewall
Ingress rule(s) to apply as a part of domR " + router + " start.");
if (!firewallRulesIngress.isEmpty()) {
_commandSetupHelper.createFirewallRulesCommands(firewallRulesIngress, router,
cmds, guestNetworkId);
}
// Re-apply port forwarding rules
- logger.debug("Found " + pfRules.size() + " port forwarding rule(s)
to apply as a part of domR " + router + " start.");
+ s_logger.debug("Found " + pfRules.size() + " port forwarding
rule(s) to apply as a part of domR " + router + " start.");
if (!pfRules.isEmpty()) {
_commandSetupHelper.createApplyPortForwardingRulesCommands(pfRules, router,
cmds, guestNetworkId);
}
// Re-apply static nat rules
- logger.debug("Found " + staticNatFirewallRules.size() + " static
nat rule(s) to apply as a part of domR " + router + " start.");
+ s_logger.debug("Found " + staticNatFirewallRules.size() + " static
nat rule(s) to apply as a part of domR " + router + " start.");
if (!staticNatFirewallRules.isEmpty()) {
final List<StaticNatRule> staticNatRules = new
ArrayList<StaticNatRule>();
for (final FirewallRule rule : staticNatFirewallRules) {
@@ -1916,7 +1918,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
}
// Re-apply vpn rules
- logger.debug("Found " + vpns.size() + " vpn(s) to apply as a part
of domR " + router + " start.");
+ s_logger.debug("Found " + vpns.size() + " vpn(s) to apply as a
part of domR " + router + " start.");
if (!vpns.isEmpty()) {
for (final RemoteAccessVpn vpn : vpns) {
_commandSetupHelper.createApplyVpnCommands(true, vpn,
router, cmds);
@@ -1938,7 +1940,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
}
}
- logger.debug("Found " + lbRules.size() + " load balancing rule(s)
to apply as a part of domR " + router + " start.");
+ s_logger.debug("Found " + lbRules.size() + " load balancing
rule(s) to apply as a part of domR " + router + " start.");
if (!lbRules.isEmpty()) {
_commandSetupHelper.createApplyLoadBalancingRulesCommands(lbRules, router,
cmds, guestNetworkId);
}
@@ -1951,11 +1953,11 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
final String supportsMultipleSubnets =
dhcpCapabilities.get(Network.Capability.DhcpAccrossMultipleSubnets);
if (supportsMultipleSubnets != null &&
Boolean.valueOf(supportsMultipleSubnets)) {
final List<NicIpAliasVO> revokedIpAliasVOs =
_nicIpAliasDao.listByNetworkIdAndState(guestNetworkId,
NicIpAlias.state.revoked);
- logger.debug("Found" + revokedIpAliasVOs.size() + "ip Aliases
to revoke on the router as a part of dhcp configuration");
+ s_logger.debug("Found" + revokedIpAliasVOs.size() + "ip
Aliases to revoke on the router as a part of dhcp configuration");
removeRevokedIpAliasFromDb(revokedIpAliasVOs);
final List<NicIpAliasVO> aliasVOs =
_nicIpAliasDao.listByNetworkIdAndState(guestNetworkId, NicIpAlias.state.active);
- logger.debug("Found" + aliasVOs.size() + "ip Aliases to apply
on the router as a part of dhcp configuration");
+ s_logger.debug("Found" + aliasVOs.size() + "ip Aliases to
apply on the router as a part of dhcp configuration");
final List<IpAliasTO> activeIpAliasTOs = new
ArrayList<IpAliasTO>();
for (final NicIpAliasVO aliasVO : aliasVOs) {
activeIpAliasTOs.add(new
IpAliasTO(aliasVO.getIp4Address(), aliasVO.getNetmask(),
aliasVO.getAliasCount().toString()));
@@ -1989,7 +1991,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
rules.add(rule);
} else {
- logger.debug(" Egress policy for the Network "+ networkId +" is
"+defaultEgressPolicy + " So no need"+
+ s_logger.debug(" Egress policy for the Network "+ networkId +" is
"+defaultEgressPolicy + " So no need"+
" of default rule is needed. ");
}
}
@@ -2007,7 +2009,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
final ArrayList<? extends PublicIpAddress> publicIps =
getPublicIpsToApply(router, provider, guestNetworkId);
if (publicIps != null && !publicIps.isEmpty()) {
- logger.debug("Found " + publicIps.size() + " ip(s) to apply as a
part of domR " + router + " start.");
+ s_logger.debug("Found " + publicIps.size() + " ip(s) to apply as a
part of domR " + router + " start.");
// Re-apply public ip addresses - should come before PF/LB/VPN
if
(_networkModel.isProviderSupportServiceInNetwork(guestNetworkId,
Service.Firewall, provider)) {
_commandSetupHelper.createAssociateIPCommands(router,
publicIps, cmds, 0);
@@ -2035,7 +2037,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
if (skipInStates != null) {
for (final IpAddress.State stateToSkip : skipInStates) {
if (userIp.getState() == stateToSkip) {
- logger.debug("Skipping ip address " + userIp + "
in state " + userIp.getState());
+ s_logger.debug("Skipping ip address " + userIp + "
in state " + userIp.getState());
addIp = false;
break;
}
@@ -2074,8 +2076,8 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
final String errorDetails = "Details: " + answer.getDetails()
+ " " + answer.toString();
// add alerts for the failed commands
_alertMgr.sendAlert(AlertService.AlertType.ALERT_TYPE_DOMAIN_ROUTER,
router.getDataCenterId(), router.getPodIdToDeployIn(), errorMessage,
errorDetails);
- logger.error(answer.getDetails());
- logger.warn(errorMessage);
+ s_logger.error(answer.getDetails());
+ s_logger.warn(errorMessage);
// Stop the router if any of the commands failed
return false;
}
@@ -2101,7 +2103,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
try {
result = networkTopology.setupDhcpForPvlan(true,
router, router.getHostId(), nicProfile);
} catch (final ResourceUnavailableException e) {
- logger.debug("ERROR in finalizeStart: ", e);
+ s_logger.debug("ERROR in finalizeStart: ", e);
}
}
}
@@ -2134,7 +2136,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
try {
networkTopology.setupDhcpForPvlan(false, domR,
domR.getHostId(), nicProfile);
} catch (final ResourceUnavailableException e) {
- logger.debug("ERROR in finalizeStop: ", e);
+ s_logger.debug("ERROR in finalizeStop: ", e);
}
}
}
@@ -2149,13 +2151,13 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
@Override
public boolean startRemoteAccessVpn(final Network network, final
RemoteAccessVpn vpn, final List<? extends VirtualRouter> routers) throws
ResourceUnavailableException {
if (routers == null || routers.isEmpty()) {
- logger.warn("Failed to start remote access VPN: no router found
for account and zone");
+ s_logger.warn("Failed to start remote access VPN: no router found
for account and zone");
throw new ResourceUnavailableException("Failed to start remote
access VPN: no router found for account and zone", DataCenter.class,
network.getDataCenterId());
}
for (final VirtualRouter router : routers) {
if (router.getState() != State.Running) {
- logger.warn("Failed to start remote access VPN: router not in
right state " + router.getState());
+ s_logger.warn("Failed to start remote access VPN: router not
in right state " + router.getState());
throw new ResourceUnavailableException("Failed to start remote
access VPN: router not in right state " + router.getState(), DataCenter.class,
network.getDataCenterId());
}
@@ -2169,14 +2171,14 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
Answer answer = cmds.getAnswer("users");
if (!answer.getResult()) {
- logger.error("Unable to start vpn: unable add users to vpn in
zone " + router.getDataCenterId() + " for account " + vpn.getAccountId() + " on
domR: "
+ s_logger.error("Unable to start vpn: unable add users to vpn
in zone " + router.getDataCenterId() + " for account " + vpn.getAccountId() + "
on domR: "
+ router.getInstanceName() + " due to " +
answer.getDetails());
throw new ResourceUnavailableException("Unable to start vpn:
Unable to add users to vpn in zone " + router.getDataCenterId() + " for account
"
+ vpn.getAccountId() + " on domR: " +
router.getInstanceName() + " due to " + answer.getDetails(), DataCenter.class,
router.getDataCenterId());
}
answer = cmds.getAnswer("startVpn");
if (!answer.getResult()) {
- logger.error("Unable to start vpn in zone " +
router.getDataCenterId() + " for account " + vpn.getAccountId() + " on domR: "
+ router.getInstanceName()
+ s_logger.error("Unable to start vpn in zone " +
router.getDataCenterId() + " for account " + vpn.getAccountId() + " on domR: "
+ router.getInstanceName()
+ " due to " + answer.getDetails());
throw new ResourceUnavailableException("Unable to start vpn in
zone " + router.getDataCenterId() + " for account " + vpn.getAccountId() + " on
domR: "
+ router.getInstanceName() + " due to " +
answer.getDetails(), DataCenter.class, router.getDataCenterId());
@@ -2189,7 +2191,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
@Override
public boolean deleteRemoteAccessVpn(final Network network, final
RemoteAccessVpn vpn, final List<? extends VirtualRouter> routers) throws
ResourceUnavailableException {
if (routers == null || routers.isEmpty()) {
- logger.warn("Failed to delete remote access VPN: no router found
for account and zone");
+ s_logger.warn("Failed to delete remote access VPN: no router found
for account and zone");
throw new ResourceUnavailableException("Failed to delete remote
access VPN", DataCenter.class, network.getDataCenterId());
}
@@ -2200,10 +2202,10 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
_commandSetupHelper.createApplyVpnCommands(false, vpn, router,
cmds);
result = result && _nwHelper.sendCommandsToRouter(router,
cmds);
} else if (router.getState() == State.Stopped) {
- logger.debug("Router " + router + " is in Stopped state, not
sending deleteRemoteAccessVpn command to it");
+ s_logger.debug("Router " + router + " is in Stopped state, not
sending deleteRemoteAccessVpn command to it");
continue;
} else {
- logger.warn("Failed to delete remote access VPN: domR " +
router + " is not in right state " + router.getState());
+ s_logger.warn("Failed to delete remote access VPN: domR " +
router + " is not in right state " + router.getState());
throw new ResourceUnavailableException("Failed to delete
remote access VPN: domR is not in right state " + router.getState(),
DataCenter.class,
network.getDataCenterId());
}
@@ -2215,7 +2217,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
@Override
public DomainRouterVO stop(final VirtualRouter router, final boolean
forced, final User user, final Account caller) throws
ConcurrentOperationException,
ResourceUnavailableException {
- logger.debug("Stopping router " + router);
+ s_logger.debug("Stopping router " + router);
try {
_itMgr.advanceStop(router.getUuid(), forced);
return _routerDao.findById(router.getId());
@@ -2227,26 +2229,26 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
@Override
public boolean removeDhcpSupportForSubnet(final Network network, final
List<DomainRouterVO> routers) throws ResourceUnavailableException {
if (routers == null || routers.isEmpty()) {
- logger.warn("Failed to add/remove VPN users: no router found for
account and zone");
+ s_logger.warn("Failed to add/remove VPN users: no router found for
account and zone");
throw new ResourceUnavailableException("Unable to assign ip
addresses, domR doesn't exist for network " + network.getId(),
DataCenter.class, network.getDataCenterId());
}
for (final DomainRouterVO router : routers) {
if (router.getState() != State.Running) {
- logger.warn("Failed to add/remove VPN users: router not in
running state");
+ s_logger.warn("Failed to add/remove VPN users: router not in
running state");
throw new ResourceUnavailableException("Unable to assign ip
addresses, domR is not in right state " + router.getState(), DataCenter.class,
network.getDataCenterId());
}
final Commands cmds = new Commands(Command.OnError.Continue);
final List<NicIpAliasVO> revokedIpAliasVOs =
_nicIpAliasDao.listByNetworkIdAndState(network.getId(),
NicIpAlias.state.revoked);
- logger.debug("Found" + revokedIpAliasVOs.size() + "ip Aliases to
revoke on the router as a part of dhcp configuration");
+ s_logger.debug("Found" + revokedIpAliasVOs.size() + "ip Aliases to
revoke on the router as a part of dhcp configuration");
final List<IpAliasTO> revokedIpAliasTOs = new
ArrayList<IpAliasTO>();
for (final NicIpAliasVO revokedAliasVO : revokedIpAliasVOs) {
revokedIpAliasTOs.add(new
IpAliasTO(revokedAliasVO.getIp4Address(), revokedAliasVO.getNetmask(),
revokedAliasVO.getAliasCount().toString()));
}
final List<NicIpAliasVO> aliasVOs =
_nicIpAliasDao.listByNetworkIdAndState(network.getId(),
NicIpAlias.state.active);
- logger.debug("Found" + aliasVOs.size() + "ip Aliases to apply on
the router as a part of dhcp configuration");
+ s_logger.debug("Found" + aliasVOs.size() + "ip Aliases to apply on
the router as a part of dhcp configuration");
final List<IpAliasTO> activeIpAliasTOs = new
ArrayList<IpAliasTO>();
for (final NicIpAliasVO aliasVO : aliasVOs) {
activeIpAliasTOs.add(new IpAliasTO(aliasVO.getIp4Address(),
aliasVO.getNetmask(), aliasVO.getAliasCount().toString()));
@@ -2305,7 +2307,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
for (final NicVO nic : nics) {
if (!_networkMgr.startNetwork(nic.getNetworkId(), dest, context)) {
- logger.warn("Failed to start network id=" + nic.getNetworkId()
+ " as a part of domR start");
+ s_logger.warn("Failed to start network id=" +
nic.getNetworkId() + " as a part of domR start");
throw new CloudRuntimeException("Failed to start network id="
+ nic.getNetworkId() + " as a part of domR start");
}
}
@@ -2370,16 +2372,16 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
final List<DomainRouterVO> routers =
_routerDao.listIsolatedByHostId(host.getId());
for (DomainRouterVO router : routers) {
if (router.isStopPending()) {
- logger.info("Stopping router " + router.getInstanceName() + "
due to stop pending flag found!");
+ s_logger.info("Stopping router " + router.getInstanceName() +
" due to stop pending flag found!");
final State state = router.getState();
if (state != State.Stopped && state != State.Destroyed) {
try {
stopRouter(router.getId(), false);
} catch (final ResourceUnavailableException e) {
- logger.warn("Fail to stop router " +
router.getInstanceName(), e);
+ s_logger.warn("Fail to stop router " +
router.getInstanceName(), e);
throw new ConnectionException(false, "Fail to stop
router " + router.getInstanceName());
} catch (final ConcurrentOperationException e) {
- logger.warn("Fail to stop router " +
router.getInstanceName(), e);
+ s_logger.warn("Fail to stop router " +
router.getInstanceName(), e);
throw new ConnectionException(false, "Fail to stop
router " + router.getInstanceName());
}
}
@@ -2433,19 +2435,19 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
try {
answer = (NetworkUsageAnswer)
_agentMgr.easySend(router.getHostId(), usageCmd);
} catch (final Exception e) {
- logger.warn("Error while collecting network stats from
router: " + router.getInstanceName() + " from host: " + router.getHostId(), e);
+ s_logger.warn("Error while collecting network stats
from router: " + router.getInstanceName() + " from host: " +
router.getHostId(), e);
continue;
}
if (answer != null) {
if (!answer.getResult()) {
- logger.warn("Error while collecting network stats
from router: " + router.getInstanceName() + " from host: " + router.getHostId()
+ "; details: "
+ s_logger.warn("Error while collecting network
stats from router: " + router.getInstanceName() + " from host: " +
router.getHostId() + "; details: "
+ answer.getDetails());
continue;
}
try {
if (answer.getBytesReceived() == 0 &&
answer.getBytesSent() == 0) {
- logger.debug("Recieved and Sent bytes are both
0. Not updating user_statistics");
+ s_logger.debug("Recieved and Sent bytes are
both 0. Not updating user_statistics");
continue;
}
@@ -2456,29 +2458,29 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
final UserStatisticsVO stats =
_userStatsDao.lock(router.getAccountId(), router.getDataCenterId(),
network.getId(),
forVpc ?
routerNic.getIPv4Address() : null, router.getId(), routerType);
if (stats == null) {
- logger.warn("unable to find stats for
account: " + router.getAccountId());
+ s_logger.warn("unable to find stats
for account: " + router.getAccountId());
return;
}
if (previousStats != null
&&
(previousStats.getCurrentBytesReceived() != stats.getCurrentBytesReceived() ||
previousStats.getCurrentBytesSent() != stats
.getCurrentBytesSent())) {
- logger.debug("Router stats changed
from the time NetworkUsageCommand was sent. " + "Ignoring current answer.
Router: "
+ s_logger.debug("Router stats changed
from the time NetworkUsageCommand was sent. " + "Ignoring current answer.
Router: "
+ answerFinal.getRouterName()
+ " Rcvd: " + answerFinal.getBytesReceived() + "Sent: " +
answerFinal.getBytesSent());
return;
}
if (stats.getCurrentBytesReceived() >
answerFinal.getBytesReceived()) {
- if (logger.isDebugEnabled()) {
- logger.debug("Received # of bytes
that's less than the last one. " + "Assuming something went wrong and
persisting it. Router: "
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("Received # of
bytes that's less than the last one. " + "Assuming something went wrong and
persisting it. Router: "
+
answerFinal.getRouterName() + " Reported: " + answerFinal.getBytesReceived() +
" Stored: " + stats.getCurrentBytesReceived());
}
stats.setNetBytesReceived(stats.getNetBytesReceived() +
stats.getCurrentBytesReceived());
}
stats.setCurrentBytesReceived(answerFinal.getBytesReceived());
if (stats.getCurrentBytesSent() >
answerFinal.getBytesSent()) {
- if (logger.isDebugEnabled()) {
- logger.debug("Received # of bytes
that's less than the last one. " + "Assuming something went wrong and
persisting it. Router: "
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("Received # of
bytes that's less than the last one. " + "Assuming something went wrong and
persisting it. Router: "
+
answerFinal.getRouterName() + " Reported: " + answerFinal.getBytesSent() + "
Stored: " + stats.getCurrentBytesSent());
}
stats.setNetBytesSent(stats.getNetBytesSent() + stats.getCurrentBytesSent());
@@ -2493,7 +2495,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
}
});
} catch (final Exception e) {
- logger.warn("Unable to update user statistics for
account: " + router.getAccountId() + " Rx: " + answer.getBytesReceived() + ";
Tx: "
+ s_logger.warn("Unable to update user statistics
for account: " + router.getAccountId() + " Rx: " + answer.getBytesReceived() +
"; Tx: "
+ answer.getBytesSent());
}
}
@@ -2572,7 +2574,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
final List<Long> jobIds = new ArrayList<Long>();
for (final DomainRouterVO router : routers) {
if (!_nwHelper.checkRouterVersion(router)) {
- logger.debug("Upgrading template for router: " +
router.getId());
+ s_logger.debug("Upgrading template for router: " +
router.getId());
final Map<String, String> params = new HashMap<String,
String>();
params.put("ctxUserId", "1");
params.put("ctxAccountId", "" + router.getAccountId());
@@ -2587,7 +2589,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
final long jobId = _asyncMgr.submitAsyncJob(job);
jobIds.add(jobId);
} else {
- logger.debug("Router: " + router.getId() + " is already at the
latest version. No upgrade required");
+ s_logger.debug("Router: " + router.getId() + " is already at
the latest version. No upgrade required");
}
}
return jobIds;
@@ -2617,7 +2619,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
event == VirtualMachine.Event.FollowAgentPowerOnReport &&
newState == State.Running &&
isOutOfBandMigrated(opaque)) {
- logger.debug("Virtual router " + vo.getInstanceName() + " is
powered-on out-of-band");
+ s_logger.debug("Virtual router " + vo.getInstanceName() + " is
powered-on out-of-band");
}
return true;
@@ -2658,10 +2660,10 @@ Configurable, StateListener<State,
VirtualMachine.Event, VirtualMachine> {
@Override
protected void runInContext() {
try {
- logger.info("Reboot router " + _routerId + " to refresh
network rules");
+ s_logger.info("Reboot router " + _routerId + " to refresh
network rules");
rebootRouter(_routerId, true);
} catch (final Exception e) {
- logger.warn("Error while rebooting the router", e);
+ s_logger.warn("Error while rebooting the router", e);
}
}
}
@@ -2678,7 +2680,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
if (routerIpInNetwork == null) {
// Nic hasn't been created in this router yet. Try to
configure the next one.
- logger.warn("The Network is not configured in the router " +
router.getHostName() + " yet. Try the next router!");
+ s_logger.warn("The Network is not configured in the router " +
router.getHostName() + " yet. Try the next router!");
errors++;
continue;
}
@@ -2690,7 +2692,7 @@ Configurable, StateListener<State, VirtualMachine.Event,
VirtualMachine> {
}
}
if (errors == routers.size()) {
- logger.error("aggregationExecution() on " + getClass().getName() +
" failed! Network is not configured in any router.");
+ s_logger.error("aggregationExecution() on " + getClass().getName()
+ " failed! Network is not configured in any router.");
return false;
}
return true;