Skip to content

Commit 729cb0c

Browse files
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 6501879 commit 729cb0c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

server/src/main/java/com/cloud/server/StatsCollector.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,8 +1591,10 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
15911591
NicVO nic = _nicDao.search(sc_nic, null).get(0);
15921592
List<VlanVO> vlan = _vlanDao.listVlansByNetworkId(nic.getNetworkId());
15931593
NetworkVO networkVO = networkDao.findById(nic.getNetworkId());
1594-
if (CollectionUtils.isEmpty(vlan) || (vlan.get(0).getVlanType() != VlanType.DirectAttached
1595-
&& (networkVO == null || !routedIpv4Manager.isRoutedNetwork(networkVO)))) {
1594+
boolean isRoutedNetwork = networkVO != null && routedIpv4Manager.isRoutedNetwork(networkVO);
1595+
boolean isDirectAttachedNetwork = CollectionUtils.isNotEmpty(vlan)
1596+
&& vlan.get(0).getVlanType() == VlanType.DirectAttached;
1597+
if (!isRoutedNetwork && !isDirectAttachedNetwork) {
15961598
continue; // only get network statistics for Shared or Routed network
15971599
}
15981600
UserStatisticsVO previousvmNetworkStats = _userStatsDao.findBy(userVm.getAccountId(), userVm.getDataCenterId(), nic.getNetworkId(),

0 commit comments

Comments
 (0)