Vpc: fixed the network shutdown happening as a part of GC thread for VPC networks

This commit is contained in:
Alena Prokharchyk 2012-06-19 14:10:15 -07:00
parent 1dc3ee51f5
commit b8f67f0249
4 changed files with 15 additions and 3 deletions

View File

@ -2244,7 +2244,12 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
@Override
public NicProfile releaseNic(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, NetworkVO network, URI broadcastUri)
throws ConcurrentOperationException, ResourceUnavailableException {
NicVO nic = _nicDao.findByInstanceIdNetworkIdAndBroadcastUri(network.getId(), vmProfile.getId(), broadcastUri.toString());
NicVO nic = null;
if (broadcastUri != null) {
nic = _nicDao.findByInstanceIdNetworkIdAndBroadcastUri(network.getId(), vmProfile.getId(), broadcastUri.toString());
} else {
nic = _nicDao.findByInstanceIdAndNetworkId(network.getId(), vmProfile.getId());
}
releaseNic(vmProfile, nic, network);
NicProfile profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), null,

View File

@ -504,7 +504,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
boolean result = true;
Nic nic = _nicDao.findByInstanceIdAndNetworkId(network.getId(), router.getId());
long guestVlanTag = Long.parseLong(nic.getBroadcastUri().getHost());
long guestVlanTag = Long.parseLong(network.getBroadcastUri().getHost());
String brd = NetUtils.long2Ip(NetUtils.ip2Long(guestNic.getIp4Address()) | ~NetUtils.ip2Long(guestNic.getNetmask()));
Integer priority = null;

View File

@ -2457,6 +2457,11 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
if (nicVO != null) {
nic = _networkMgr.getNicProfile(vm, network.getId());
}
} else {
NicVO nicVO = _nicsDao.findByInstanceIdAndNetworkId(network.getId(), vm.getId());
if (nicVO != null) {
nic = _networkMgr.getNicProfile(vm, network.getId());
}
}
if (nic == null) {

View File

@ -264,7 +264,9 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
if (guestNetworks != null && !guestNetworks.isEmpty()) {
// 2) add router to the network
for (Network guestNetwork : guestNetworks) {
addRouterToGuestNetwork(router, guestNetwork);
if (!isRouterPartOfGuestNetwork(router.getId(), guestNetwork.getId())) {
addRouterToGuestNetwork(router, guestNetwork);
}
}
}