Network Id for direct-network should not be included in usage record response. Direct network stats have network_id = 0. Ignore network with id = 0 in usage record

This commit is contained in:
Kishan Kavala 2014-11-24 11:35:36 +05:30
parent 30ab4d3d66
commit 01a325b2bf
1 changed files with 5 additions and 3 deletions

View File

@ -3169,9 +3169,11 @@ public class ApiResponseHelper implements ResponseGenerator {
}
}
//Network ID
NetworkVO network = _entityMgr.findByIdIncludingRemoved(NetworkVO.class, usageRecord.getNetworkId().toString());
if (network != null) {
usageRecResponse.setNetworkId(network.getUuid());
if((usageRecord.getNetworkId() != null) && (usageRecord.getNetworkId() != 0)) {
NetworkVO network = _entityMgr.findByIdIncludingRemoved(NetworkVO.class, usageRecord.getNetworkId().toString());
if (network != null) {
usageRecResponse.setNetworkId(network.getUuid());
}
}
} else if (usageRecord.getUsageType() == UsageTypes.VM_DISK_IO_READ || usageRecord.getUsageType() == UsageTypes.VM_DISK_IO_WRITE