Hi,

Please find the latest report on new defect(s) introduced to cloudstack found 
with Coverity Scan.

11 new defect(s) introduced to cloudstack found with Coverity Scan.
18 defect(s), reported by Coverity Scan earlier, were marked fixed in the 
recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 11 of 11 defect(s)


** CID 1254843:  Copy-paste error  (COPY_PASTE_ERROR)
/server/src/com/cloud/capacity/CapacityManagerImpl.java: 712 in 
com.cloud.capacity.CapacityManagerImpl.updateCapacityForHost(com.cloud.host.Host)()

** CID 1254842:  Bx: Questionable Boxing of primitive value  
(FB.BX_UNBOXING_IMMEDIATELY_REBOXED)
/server/src/com/cloud/network/NetworkServiceImpl.java: 1409 in 
com.cloud.network.NetworkServiceImpl.commitNetwork(java.lang.Long, 
java.lang.String, java.lang.String, java.lang.String, java.lang.String, 
java.lang.String, java.lang.String, java.lang.String, java.lang.String, 
com.cloud.user.Account, java.lang.Long, java.lang.Long, java.lang.Long, 
boolean, java.lang.Boolean, java.lang.Long, java.lang.String, java.lang.String, 
java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Long, 
java.lang.String, com.cloud.offerings.NetworkOfferingVO, 
com.cloud.network.PhysicalNetwork, 
org.apache.cloudstack.acl.ControlledEntity$ACLType, com.cloud.user.Account, 
java.lang.String, boolean)()

** CID 1254841:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java: 
2577 in 
com.cloud.network.router.VirtualNetworkApplianceManagerImpl.postStateTransitionEvent(com.cloud.utils.fsm.StateMachine2$Transition,
 com.cloud.vm.VirtualMachine, boolean, java.lang.Object)()

** CID 1254840:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java:
 1054 in 
com.cloud.hypervisor.xenserver.resource.Xenserver625StorageProcessor.createTemplateFromSnapshot2(org.apache.cloudstack.storage.command.CopyCommand)()

** CID 1254839:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java: 86 in 
org.apache.cloudstack.graphite.GraphiteClient.sendMetrics(java.util.Map, long)()

** CID 1254838:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java:
 1102 in 
com.cloud.hypervisor.xenserver.resource.Xenserver625StorageProcessor.createTemplateFromSnapshot2(org.apache.cloudstack.storage.command.CopyCommand)()

** CID 1254837:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
/server/src/com/cloud/server/StatsCollector.java: 515 in 
com.cloud.server.StatsCollector$VmStatsCollector.runInContext()()

** CID 1254835:  Dereference after null check  (FORWARD_NULL)
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 63 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 69 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 80 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 91 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 110 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 121 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 135 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()

** CID 1254834:  Dereference after null check  (FORWARD_NULL)
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 62 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 68 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 78 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 92 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 115 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 127 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 138 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()

** CID 1254833:  Dereference after null check  (FORWARD_NULL)
/utils/src/com/cloud/utils/net/NetUtils.java: 1326 in 
com.cloud.utils.net.NetUtils.countIp6InRange(java.lang.String)()

** CID 1254832:  Resource leak on an exceptional path  (RESOURCE_LEAK)
/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java: 83 in 
org.apache.cloudstack.graphite.GraphiteClient.sendMetrics(java.util.Map, long)()


________________________________________________________________________________________________________
*** CID 1254843:  Copy-paste error  (COPY_PASTE_ERROR)
/server/src/com/cloud/capacity/CapacityManagerImpl.java: 712 in 
com.cloud.capacity.CapacityManagerImpl.updateCapacityForHost(com.cloud.host.Host)()
706                         host.getTotalMemory());
707                     memCap.setTotalCapacity(host.getTotalMemory());
708     
709                 }
710                 // Set the capacity state as per the host allocation state.
711                 if(capacityState != memCap.getCapacityState()){
>>>     CID 1254843:  Copy-paste error  (COPY_PASTE_ERROR)
>>>     "cpuCap" in "cpuCap.getTotalCapacity()" looks like a copy-paste error.  
>>> Should it say "memCap" instead?
712                     s_logger.debug("Calibrate memory capacity state for 
host: " + host.getId() + " old capacity state:" + cpuCap.getTotalCapacity() + " 
new capacity state:" + hostTotalCpu);
713                     memCap.setCapacityState(capacityState);
714                 }
715     
716                 if (memCap.getUsedCapacity() == usedMemory && 
memCap.getReservedCapacity() == reservedMemory) {
717                     s_logger.debug("No need to calibrate memory capacity, 
host:" + host.getId() + " usedMem: " + memCap.getUsedCapacity() + " 
reservedMem: " +

________________________________________________________________________________________________________
*** CID 1254842:  Bx: Questionable Boxing of primitive value  
(FB.BX_UNBOXING_IMMEDIATELY_REBOXED)
/server/src/com/cloud/network/NetworkServiceImpl.java: 1409 in 
com.cloud.network.NetworkServiceImpl.commitNetwork(java.lang.Long, 
java.lang.String, java.lang.String, java.lang.String, java.lang.String, 
java.lang.String, java.lang.String, java.lang.String, java.lang.String, 
com.cloud.user.Account, java.lang.Long, java.lang.Long, java.lang.Long, 
boolean, java.lang.Boolean, java.lang.Long, java.lang.String, java.lang.String, 
java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Long, 
java.lang.String, com.cloud.offerings.NetworkOfferingVO, 
com.cloud.network.PhysicalNetwork, 
org.apache.cloudstack.acl.ControlledEntity$ACLType, com.cloud.user.Account, 
java.lang.String, boolean)()
1403                 if (domainId != null && aclType == ACLType.Domain) {
1404                     // send event for storing the domain wide resource 
access
1405                     Map<String, Object> params = new HashMap<String, 
Object>();
1406                     params.put(ApiConstants.ENTITY_TYPE, Network.class);
1407                     params.put(ApiConstants.ENTITY_ID, network.getId());
1408                     params.put(ApiConstants.DOMAIN_ID, domainId);
>>>     CID 1254842:  Bx: Questionable Boxing of primitive value  
>>> (FB.BX_UNBOXING_IMMEDIATELY_REBOXED)
>>>     Boxed value is unboxed and then immediately reboxed
1409                     params.put(ApiConstants.SUBDOMAIN_ACCESS, 
subdomainAccessFinal == null ? true : subdomainAccessFinal);
1410                     _messageBus.publish(_name, 
EntityManager.MESSAGE_ADD_DOMAIN_WIDE_ENTITY_EVENT, PublishScope.LOCAL, params);
1411                 }
1412                 return network;
1413             } catch (Exception e) {
1414                 ExceptionUtil.rethrowRuntime(e);

________________________________________________________________________________________________________
*** CID 1254841:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java: 
2577 in 
com.cloud.network.router.VirtualNetworkApplianceManagerImpl.postStateTransitionEvent(com.cloud.utils.fsm.StateMachine2$Transition,
 com.cloud.vm.VirtualMachine, boolean, java.lang.Object)()
2571                 final Object opaque) {
2572             return true;
2573         }
2574     
2575         @Override
2576         public boolean postStateTransitionEvent(final 
StateMachine2.Transition<State, VirtualMachine.Event> transition, final 
VirtualMachine vo, final boolean status, final Object opaque) {
>>>     CID 1254841:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
>>>     Dead store to oldState
2577             final State oldState = transition.getCurrentState();
2578             final State newState = transition.getToState();
2579             final VirtualMachine.Event event = transition.getEvent();
2580             if (event == VirtualMachine.Event.FollowAgentPowerOnReport && 
newState == State.Running) {
2581                 if (vo.getType() == VirtualMachine.Type.DomainRouter) {
2582                     s_logger.info("Schedule a router reboot task as router 
" + vo.getId() + " is powered-on out-of-band. we need to reboot to refresh 
network rules");

________________________________________________________________________________________________________
*** CID 1254840:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java:
 1054 in 
com.cloud.hypervisor.xenserver.resource.Xenserver625StorageProcessor.createTemplateFromSnapshot2(org.apache.cloudstack.storage.command.CopyCommand)()
1048                 String chapInitiatorUsername = 
srcDetails.get(DiskTO.CHAP_INITIATOR_USERNAME);
1049                 String chapInitiatorSecret = 
srcDetails.get(DiskTO.CHAP_INITIATOR_SECRET);
1050     
1051                 srcSr = hypervisorResource.getIscsiSR(conn, iScsiName, 
storageHost, iScsiName, chapInitiatorUsername, chapInitiatorSecret, true);
1052     
1053                 String destNfsPath = destUri.getHost() + ":" + 
destUri.getPath();
>>>     CID 1254840:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
>>>     Found reliance on default encoding: String.getBytes()
1054                 String localDir = "/var/cloud_mount/" + 
UUID.nameUUIDFromBytes(destNfsPath.getBytes());
1055     
1056                 mountNfs(conn, destNfsPath, localDir);
1057                 makeDirectory(conn, localDir + "/" + destDir);
1058     
1059                 destSr = createFileSR(conn, localDir + "/" + destDir);

________________________________________________________________________________________________________
*** CID 1254839:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java: 86 in 
org.apache.cloudstack.graphite.GraphiteClient.sendMetrics(java.util.Map, long)()
80         public void sendMetrics(Map<String, Integer> metrics, long 
timeStamp) {
81             try {
82                 DatagramSocket sock = new DatagramSocket();
83                 InetAddress addr = InetAddress.getByName(this.graphiteHost);
84     
85                 for (Map.Entry<String, Integer> metric: metrics.entrySet()) {
>>>     CID 1254839:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
>>>     Found reliance on default encoding: String.getBytes()
86                     byte[] message = new String(metric.getKey() + " " + 
metric.getValue() + " " + timeStamp + "\n").getBytes();
87                     DatagramPacket packet = new DatagramPacket(message, 
message.length, addr, this.graphitePort);
88                     sock.send(packet);
89                 }
90     
91                 sock.close();

________________________________________________________________________________________________________
*** CID 1254838:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java:
 1102 in 
com.cloud.hypervisor.xenserver.resource.Xenserver625StorageProcessor.createTemplateFromSnapshot2(org.apache.cloudstack.storage.command.CopyCommand)()
1096                 newTemplate.setPhysicalSize(physicalSize);
1097                 newTemplate.setName(templateUuid);
1098     
1099                 result = true;
1100     
1101                 return new CopyCmdAnswer(newTemplate);
>>>     CID 1254838:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
>>>     Catching RuntimeExceptions, perhaps unintentionally, with a catch block 
>>> for Exception
1102             } catch (Exception ex) {
1103                 s_logger.error("Failed to create a template from a 
snapshot", ex);
1104     
1105                 return new CopyCmdAnswer("Failed to create a template from 
a snapshot: " + ex.toString());
1106             } finally {
1107                 if (!result) {

________________________________________________________________________________________________________
*** CID 1254837:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
/server/src/com/cloud/server/StatsCollector.java: 515 in 
com.cloud.server.StatsCollector$VmStatsCollector.runInContext()()
509     
510                                         metrics.clear();
511                                     }
512                                 }
513                             }
514     
>>>     CID 1254837:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
>>>     Catching RuntimeExceptions, perhaps unintentionally, with a catch block 
>>> for Exception
515                         } catch (Exception e) {
516                             s_logger.debug("Failed to get VM stats for host 
with ID: " + host.getId());
517                             continue;
518                         }
519                     }
520     

________________________________________________________________________________________________________
*** CID 1254835:  Dereference after null check  (FORWARD_NULL)
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 63 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
57             if (proxy == null && args.getProxyId() != 0)
58                 proxy = _consoleProxyDao.findById(args.getProxyId());
59     
60             switch (args.getType()) {
61                 case ConsoleProxyAlertEventArgs.PROXY_CREATED:
62                     if (s_logger.isDebugEnabled())
>>>     CID 1254835:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "proxy".
63                         s_logger.debug("New console proxy created, zone: " + 
dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + 
proxy.getPublicIpAddress() +
64                             ", private IP: " + proxy.getPrivateIpAddress());
65                     break;
66     
67                 case ConsoleProxyAlertEventArgs.PROXY_UP:
68                     if (s_logger.isDebugEnabled())
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 69 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
63                         s_logger.debug("New console proxy created, zone: " + 
dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + 
proxy.getPublicIpAddress() +
64                             ", private IP: " + proxy.getPrivateIpAddress());
65                     break;
66     
67                 case ConsoleProxyAlertEventArgs.PROXY_UP:
68                     if (s_logger.isDebugEnabled())
>>>     CID 1254835:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "proxy".
69                         s_logger.debug("Console proxy is up, zone: " + 
dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + 
proxy.getPublicIpAddress() +
70                             ", private IP: " + proxy.getPrivateIpAddress());
71     
72                     
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, 
args.getZoneId(), proxy.getPodIdToDeployIn(),
73                         "Console proxy up in zone: " + dc.getName() +
74                             ", proxy: " + proxy.getHostName() + ", public 
IP: " + proxy.getPublicIpAddress() + ", private IP: " +
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 80 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
74                             ", proxy: " + proxy.getHostName() + ", public 
IP: " + proxy.getPublicIpAddress() + ", private IP: " +
75                             (proxy.getPrivateIpAddress() == null ? "N/A" : 
proxy.getPrivateIpAddress()), "Console proxy up (zone " + dc.getName() + ")");
76                     break;
77     
78                 case ConsoleProxyAlertEventArgs.PROXY_DOWN:
79                     if (s_logger.isDebugEnabled())
>>>     CID 1254835:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "proxy".
80                         s_logger.debug("Console proxy is down, zone: " + 
dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + 
proxy.getPublicIpAddress() +
81                             ", private IP: " + (proxy.getPrivateIpAddress() 
== null ? "N/A" : proxy.getPrivateIpAddress()));
82     
83                     
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, 
args.getZoneId(), proxy.getPodIdToDeployIn(),
84                         "Console proxy down in zone: " + dc.getName() +
85                             ", proxy: " + proxy.getHostName() + ", public 
IP: " + proxy.getPublicIpAddress() + ", private IP: " +
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 91 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
85                             ", proxy: " + proxy.getHostName() + ", public 
IP: " + proxy.getPublicIpAddress() + ", private IP: " +
86                             (proxy.getPrivateIpAddress() == null ? "N/A" : 
proxy.getPrivateIpAddress()), "Console proxy down (zone " + dc.getName() + ")");
87                     break;
88     
89                 case ConsoleProxyAlertEventArgs.PROXY_REBOOTED:
90                     if (s_logger.isDebugEnabled())
>>>     CID 1254835:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "proxy".
91                         s_logger.debug("Console proxy is rebooted, zone: " + 
dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + 
proxy.getPublicIpAddress() +
92                             ", private IP: " + (proxy.getPrivateIpAddress() 
== null ? "N/A" : proxy.getPrivateIpAddress()));
93     
94                     
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, 
args.getZoneId(), proxy.getPodIdToDeployIn(),
95                         "Console proxy rebooted in zone: " + dc.getName() + 
", proxy: " + proxy.getHostName() + ", public IP: " + 
proxy.getPublicIpAddress() +
96                             ", private IP: " + (proxy.getPrivateIpAddress() 
== null ? "N/A" : proxy.getPrivateIpAddress()), "Console proxy rebooted (zone " 
+ dc.getName() +
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 110 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
104                         "Console proxy creation failure. zone: " + 
dc.getName() + ", error details: " + args.getMessage(),
105                         "Console proxy creation failure (zone " + 
dc.getName() + ")");
106                     break;
107     
108                 case ConsoleProxyAlertEventArgs.PROXY_START_FAILURE:
109                     if (s_logger.isDebugEnabled())
>>>     CID 1254835:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "proxy".
110                         s_logger.debug("Console proxy startup failure, 
zone: " + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " +
111                             proxy.getPublicIpAddress() + ", private IP: " + 
(proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()));
112     
113                     
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY, 
args.getZoneId(), proxy.getPodIdToDeployIn(),
114                         "Console proxy startup failure. zone: " + 
dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " + 
proxy.getPublicIpAddress() +
115                             ", private IP: " + (proxy.getPrivateIpAddress() 
== null ? "N/A" : proxy.getPrivateIpAddress()) + ", error details: " + 
args.getMessage(),
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 121 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
115                             ", private IP: " + (proxy.getPrivateIpAddress() 
== null ? "N/A" : proxy.getPrivateIpAddress()) + ", error details: " + 
args.getMessage(),
116                         "Console proxy startup failure (zone " + 
dc.getName() + ")");
117                     break;
118     
119                 case ConsoleProxyAlertEventArgs.PROXY_FIREWALL_ALERT:
120                     if (s_logger.isDebugEnabled())
>>>     CID 1254835:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "proxy".
121                         s_logger.debug("Console proxy firewall alert, zone: 
" + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " +
122                             proxy.getPublicIpAddress() + ", private IP: " + 
(proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()));
123     
124                     _alertMgr.sendAlert(
125                         AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY,
126                         args.getZoneId(),
/server/src/com/cloud/alert/ConsoleProxyAlertAdapter.java: 135 in 
com.cloud.alert.ConsoleProxyAlertAdapter.onProxyAlert(java.lang.Object, 
com.cloud.consoleproxy.ConsoleProxyAlertEventArgs)()
129                             proxy.getPublicIpAddress() + ", private IP: " + 
(proxy.getPrivateIpAddress() == null ? "N/A" : proxy.getPrivateIpAddress()),
130                         "Console proxy alert (zone " + dc.getName() + ")");
131                     break;
132     
133                 case ConsoleProxyAlertEventArgs.PROXY_STORAGE_ALERT:
134                     if (s_logger.isDebugEnabled())
>>>     CID 1254835:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "proxy".
135                         s_logger.debug("Console proxy storage alert, zone: 
" + dc.getName() + ", proxy: " + proxy.getHostName() + ", public IP: " +
136                             proxy.getPublicIpAddress() + ", private IP: " + 
proxy.getPrivateIpAddress() + ", message: " + args.getMessage());
137     
138                     
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC, 
args.getZoneId(), proxy.getPodIdToDeployIn(),
139                         "Console proxy storage issue. zone: " + 
dc.getName() + ", message: " + args.getMessage(), "Console proxy alert (zone " 
+ dc.getName() + ")");
140                     break;

________________________________________________________________________________________________________
*** CID 1254834:  Dereference after null check  (FORWARD_NULL)
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 62 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
56             if (secStorageVm == null && args.getSecStorageVmId() != 0)
57                 secStorageVm = _ssvmDao.findById(args.getSecStorageVmId());
58     
59             switch (args.getType()) {
60                 case SecStorageVmAlertEventArgs.SSVM_CREATED:
61                     if (s_logger.isDebugEnabled())
>>>     CID 1254834:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "secStorageVm".
62                         s_logger.debug("New secondary storage vm created, 
zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", 
public IP: " +
63                             secStorageVm.getPublicIpAddress() + ", private 
IP: " + secStorageVm.getPrivateIpAddress());
64                     break;
65     
66                 case SecStorageVmAlertEventArgs.SSVM_UP:
67                     if (s_logger.isDebugEnabled())
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 68 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
62                         s_logger.debug("New secondary storage vm created, 
zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", 
public IP: " +
63                             secStorageVm.getPublicIpAddress() + ", private 
IP: " + secStorageVm.getPrivateIpAddress());
64                     break;
65     
66                 case SecStorageVmAlertEventArgs.SSVM_UP:
67                     if (s_logger.isDebugEnabled())
>>>     CID 1254834:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "secStorageVm".
68                         s_logger.debug("Secondary Storage Vm is up, zone: " 
+ dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public 
IP: " +
69                             secStorageVm.getPublicIpAddress() + ", private 
IP: " + secStorageVm.getPrivateIpAddress());
70     
71                     
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), 
secStorageVm.getPodIdToDeployIn(), "Secondary Storage Vm up in zone: " +
72                         dc.getName() + ", secStorageVm: " + 
secStorageVm.getHostName() + ", public IP: " + 
secStorageVm.getPublicIpAddress() + ", private IP: " +
73                         (secStorageVm.getPrivateIpAddress() == null ? "N/A" 
: secStorageVm.getPrivateIpAddress()), "Secondary Storage Vm up (zone " + 
dc.getName() + ")");
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 78 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
72                         dc.getName() + ", secStorageVm: " + 
secStorageVm.getHostName() + ", public IP: " + 
secStorageVm.getPublicIpAddress() + ", private IP: " +
73                         (secStorageVm.getPrivateIpAddress() == null ? "N/A" 
: secStorageVm.getPrivateIpAddress()), "Secondary Storage Vm up (zone " + 
dc.getName() + ")");
74                     break;
75     
76                 case SecStorageVmAlertEventArgs.SSVM_DOWN:
77                     if (s_logger.isDebugEnabled())
>>>     CID 1254834:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "secStorageVm".
78                         s_logger.debug("Secondary Storage Vm is down, zone: 
" + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public 
IP: " +
79                             secStorageVm.getPublicIpAddress() + ", private 
IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : 
secStorageVm.getPrivateIpAddress()));
80     
81                     _alertMgr.sendAlert(
82                         AlertManager.AlertType.ALERT_TYPE_SSVM,
83                         args.getZoneId(),
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 92 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
86                             secStorageVm.getPublicIpAddress() + ", private 
IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : 
secStorageVm.getPrivateIpAddress()),
87                         "Secondary Storage Vm down (zone " + dc.getName() + 
")");
88                     break;
89     
90                 case SecStorageVmAlertEventArgs.SSVM_REBOOTED:
91                     if (s_logger.isDebugEnabled())
>>>     CID 1254834:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "secStorageVm".
92                         s_logger.debug("Secondary Storage Vm is rebooted, 
zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", 
public IP: " +
93                             secStorageVm.getPublicIpAddress() + ", private 
IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : 
secStorageVm.getPrivateIpAddress()));
94     
95                     _alertMgr.sendAlert(
96                         AlertManager.AlertType.ALERT_TYPE_SSVM,
97                         args.getZoneId(),
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 115 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
109                         "Secondary Storage Vm creation failure. zone: " + 
dc.getName() + ", error details: " + args.getMessage(),
110                         "Secondary Storage Vm creation failure (zone " + 
dc.getName() + ")");
111                     break;
112     
113                 case SecStorageVmAlertEventArgs.SSVM_START_FAILURE:
114                     if (s_logger.isDebugEnabled())
>>>     CID 1254834:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "secStorageVm".
115                         s_logger.debug("Secondary Storage Vm startup 
failure, zone: " + dc.getName() + ", secStorageVm: " + 
secStorageVm.getHostName() + ", public IP: " +
116                             secStorageVm.getPublicIpAddress() + ", private 
IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : 
secStorageVm.getPrivateIpAddress()));
117     
118                     
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), 
secStorageVm.getPodIdToDeployIn(),
119                         "Secondary Storage Vm startup failure. zone: " +
120                             dc.getName() + ", secStorageVm: " + 
secStorageVm.getHostName() + ", public IP: " + 
secStorageVm.getPublicIpAddress() + ", private IP: " +
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 127 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
121                             (secStorageVm.getPrivateIpAddress() == null ? 
"N/A" : secStorageVm.getPrivateIpAddress()) + ", error details: " + 
args.getMessage(),
122                         "Secondary Storage Vm startup failure (zone " + 
dc.getName() + ")");
123                     break;
124     
125                 case SecStorageVmAlertEventArgs.SSVM_FIREWALL_ALERT:
126                     if (s_logger.isDebugEnabled())
>>>     CID 1254834:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "secStorageVm".
127                         s_logger.debug("Secondary Storage Vm firewall 
alert, zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() 
+ ", public IP: " +
128                             secStorageVm.getPublicIpAddress() + ", private 
IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : 
secStorageVm.getPrivateIpAddress()));
129     
130                     
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_SSVM, args.getZoneId(), 
secStorageVm.getPodIdToDeployIn(),
131                         "Failed to open secondary storage vm firewall port. 
zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", 
public IP: " +
132                             secStorageVm.getPublicIpAddress() + ", private 
IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : 
secStorageVm.getPrivateIpAddress()),
/server/src/com/cloud/alert/SecondaryStorageVmAlertAdapter.java: 138 in 
com.cloud.alert.SecondaryStorageVmAlertAdapter.onSSVMAlert(java.lang.Object, 
com.cloud.storage.secondary.SecStorageVmAlertEventArgs)()
132                             secStorageVm.getPublicIpAddress() + ", private 
IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : 
secStorageVm.getPrivateIpAddress()),
133                         "Secondary Storage Vm alert (zone " + dc.getName() 
+ ")");
134                     break;
135     
136                 case SecStorageVmAlertEventArgs.SSVM_STORAGE_ALERT:
137                     if (s_logger.isDebugEnabled())
>>>     CID 1254834:  Dereference after null check  (FORWARD_NULL)
>>>     Calling a method on null object "secStorageVm".
138                         s_logger.debug("Secondary Storage Vm storage alert, 
zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", 
public IP: " +
139                             secStorageVm.getPublicIpAddress() + ", private 
IP: " + secStorageVm.getPrivateIpAddress() + ", message: " + args.getMessage());
140     
141                     
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC, 
args.getZoneId(), secStorageVm.getPodIdToDeployIn(),
142                         "Secondary Storage Vm storage issue. zone: " + 
dc.getName() + ", message: " + args.getMessage(), "Secondary Storage Vm alert 
(zone " + dc.getName() +
143                             ")");

________________________________________________________________________________________________________
*** CID 1254833:  Dereference after null check  (FORWARD_NULL)
/utils/src/com/cloud/utils/net/NetUtils.java: 1326 in 
com.cloud.utils.net.NetUtils.countIp6InRange(java.lang.String)()
1320                 if (startInt != null)
1321                 {
1322                     if(startInt.compareTo(endInt) > 0) {
1323                         return null;
1324                     }
1325                 }
>>>     CID 1254833:  Dereference after null check  (FORWARD_NULL)
>>>     Passing null pointer "startInt" to function 
>>> "java.math.BigInteger.subtract(java.math.BigInteger)", which dereferences 
>>> it.
1326                 return endInt.subtract(startInt).add(BigInteger.ONE);
1327             }
1328             return null;
1329         }
1330     
1331         public static boolean isIp6InRange(String ip6, String ip6Range) {

________________________________________________________________________________________________________
*** CID 1254832:  Resource leak on an exceptional path  (RESOURCE_LEAK)
/utils/src/org/apache/cloudstack/utils/graphite/GraphiteClient.java: 83 in 
org.apache.cloudstack.graphite.GraphiteClient.sendMetrics(java.util.Map, long)()
77          * @param metrics the metrics as key-value-pairs
78          * @param timeStamp the timestamp
79          */
80         public void sendMetrics(Map<String, Integer> metrics, long 
timeStamp) {
81             try {
82                 DatagramSocket sock = new DatagramSocket();
>>>     CID 1254832:  Resource leak on an exceptional path  (RESOURCE_LEAK)
>>>     Variable "sock" going out of scope leaks the resource it refers to.
83                 InetAddress addr = InetAddress.getByName(this.graphiteHost);
84     
85                 for (Map.Entry<String, Integer> metric: metrics.entrySet()) {
86                     byte[] message = new String(metric.getKey() + " " + 
metric.getValue() + " " + timeStamp + "\n").getBytes();
87                     DatagramPacket packet = new DatagramPacket(message, 
message.length, addr, this.graphitePort);
88                     sock.send(packet);


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, 
http://scan.coverity.com/projects/943?tab=overview

To unsubscribe from the email notification for new defects, 
http://scan5.coverity.com/cgi-bin/unsubscribe.py



Reply via email to