Merge pull request #1811 from sudhansu7/CLOUDSTACK-9649

CLOUDSTACK-9649: In the management server log there is an error
ISSUE
============
In the management server log there is an error

2016-10-01 00:07:31,670 ERROR [c.c.h.v.r.VmwareResource] (DirectAgent-417:ctx-e8c89b3f strmg-esx-01, cmd: GetRouterAlertsCommand) (logid:7beb3819) Command failed due to Exception: java.io.IOException
Message: There was a problem while connecting to 0.0.0.0:3922

In case of basic zone and VMWare ESXi host, the NIC 2 always gets 0.0.0.0 as IP address. Looks like we are generating an error for connecting through this invalid IP.

2016-10-01 04:37:31,680 DEBUG [c.c.a.m.AgentManagerImpl] (RouterStatusMonitor-1:ctx-8880f9c8) (logid:946838b8) Details from executing class com.cloud.agent.api.routing.GetRouterAlertsCommand: Command failed due to Exception: java.io.IOException
Message: There was a problem while connecting to 0.0.0.0:3922

2016-10-01 04:37:31,680 WARN  [c.c.n.r.VirtualNetworkApplianceManagerImpl] (RouterStatusMonitor-1:ctx-8880f9c8) (logid:946838b8) Unable to get alerts from router r-4-VM Command failed due to Exception: java.io.IOException
Message: There was a problem while connecting to 0.0.0.0:3922

2016-10-01 04:37:31,682 DEBUG [c.c.n.ExternalDeviceUsageManagerImpl] (ExternalNetworkMonitor-1:ctx-913c7bae) (logid:1b926a60) External devices stats collector is running...

Root Cause:
As Link local is not used in basic zone mode (vmware). 0.0.0.0 is just shown as a placeholder address. In getRouterAlerts before sending GetRouterAlertsCommand added check for ip and skip the command if ip is '0.0.0.0'.

* pr/1811:
  CLOUDSTACK-9649: In the management server log there is an error  related to 0.0.0.0 IP address

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2016-12-22 13:30:42 +05:30
commit 746998d162
1 changed files with 26 additions and 4 deletions

View File

@ -1208,10 +1208,9 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
if (!Boolean.parseBoolean(serviceMonitoringFlag) || router.getVpcId() != null) {
continue;
}
String controlIP = getRouterControlIP(router);
final String privateIP = router.getPrivateIpAddress();
if (privateIP != null) {
if (controlIP != null && !controlIP.equals("0.0.0.0")) {
OpRouterMonitorServiceVO opRouterMonitorServiceVO = _opRouterMonitorServiceDao.findById(router.getId());
GetRouterAlertsCommand command = null;
@ -1225,7 +1224,7 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
command = new GetRouterAlertsCommand(opRouterMonitorServiceVO.getLastAlertTimestamp());
}
command.setAccessDetail(NetworkElementCommand.ROUTER_IP, router.getPrivateIpAddress());
command.setAccessDetail(NetworkElementCommand.ROUTER_IP, controlIP);
try {
final Answer origAnswer = _agentMgr.easySend(router.getHostId(), command);
@ -1280,6 +1279,29 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
}
}
private String getRouterControlIP(DomainRouterVO router){
final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
String controlIP = null;
if(router.getHypervisorType() == HypervisorType.VMware && dcVo.getNetworkType() == NetworkType.Basic ){
final List<NicVO> nics = _nicDao.listByVmId(router.getId());
for (final NicVO nic : nics) {
final NetworkVO nc = _networkDao.findById(nic.getNetworkId());
if (nc.getTrafficType() == TrafficType.Guest && nic.getIPv4Address() != null) {
controlIP = nic.getIPv4Address();
break;
}
}
s_logger.debug("Vmware with Basic network selected Guest NIC ip as control IP " + controlIP );
}else{
controlIP = _routerControlHelper.getRouterControlIp(router.getId());
}
s_logger.debug("IP of control NIC " + controlIP );
return controlIP;
}
@Override
public boolean finalizeVirtualMachineProfile(final VirtualMachineProfile profile, final DeployDestination dest, final ReservationContext context) {