Fixed the bug when networkRate for the domR's guest network wasn't taken from the service offering

This commit is contained in:
alena 2011-08-30 10:37:09 -07:00
parent c59d843cc5
commit 09f8d8ee4c
1 changed files with 3 additions and 3 deletions

View File

@ -3128,7 +3128,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
vm = _vmDao.findById(vmId);
}
Network network = getNetwork(networkId);
NetworkOffering networkOffering = _configMgr.getNetworkOffering(network.getNetworkOfferingId());
NetworkOffering ntwkOff = _configMgr.getNetworkOffering(network.getNetworkOfferingId());
// For default userVm Default network and domR guest/public network, get rate information from the service offering; for other situations get information
// from the network offering
@ -3137,14 +3137,14 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
if (vm != null) {
if (vm.getType() == Type.User && network.isDefault()) {
isUserVmsDefaultNetwork = true;
} else if (vm.getType() == Type.DomainRouter && networkOffering.getTrafficType() == TrafficType.Public && networkOffering.getGuestType() == null) {
} else if (vm.getType() == Type.DomainRouter && ((ntwkOff.getTrafficType() == TrafficType.Public && ntwkOff.getGuestType() == null) || (ntwkOff.getGuestType() != null && ntwkOff.getTrafficType() == TrafficType.Guest))) {
isDomRGuestOrPublicNetwork = true;
}
}
if (isUserVmsDefaultNetwork || isDomRGuestOrPublicNetwork) {
return _configMgr.getServiceOfferingNetworkRate(vm.getServiceOfferingId());
} else {
return _configMgr.getNetworkOfferingNetworkRate(networkOffering.getId());
return _configMgr.getNetworkOfferingNetworkRate(ntwkOff.getId());
}
}