VPC: fixed guest network shutdown

This commit is contained in:
Alena Prokharchyk 2012-06-11 15:01:51 -07:00
parent d1598e366e
commit 07be6918d8
2 changed files with 9 additions and 11 deletions

View File

@ -3075,7 +3075,9 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
String dhcpRange = getGuestDhcpRange(guestNic, network, _configMgr.getZone(network.getDataCenterId()));
boolean result = true;
long guestVlanTag = Long.parseLong(network.getBroadcastUri().getHost());
Nic nic = _nicDao.findByInstanceIdAndNetworkId(network.getId(), router.getId());
long guestVlanTag = Long.parseLong(nic.getBroadcastUri().getHost());
String brd = NetUtils.long2Ip(NetUtils.ip2Long(guestNic.getIp4Address()) | ~NetUtils.ip2Long(guestNic.getNetmask()));
Integer priority = null;
@ -3097,7 +3099,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
defaultDns2 = guestNic.getDns2();
}
NicVO nic = _nicDao.findByInstanceIdAndNetworkId(network.getId(), router.getId());
NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(),
_networkMgr.getNetworkRate(network.getId(), router.getId()),
_networkMgr.isSecurityGroupSupportedInNetwork(network), _networkMgr.getNetworkTag(router.getHypervisorType(), network));
@ -3185,12 +3186,6 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
return false;
}
//check if router is already part of network
if (!_routerDao.isRouterPartOfGuestNetwork(router.getId(), network.getId())) {
s_logger.debug("Router " + router + " is not a part of guest network " + network + "; no need to unplug guest nic");
return true;
}
//Check if router is a part of the Guest network
if (!_networkMgr.isVmPartOfNetwork(router.getId(), network.getId())) {
s_logger.debug("Router " + router + " is not a part of the Guest network " + network);
@ -3207,8 +3202,11 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
if (result) {
if (result) {
s_logger.debug("Removing router " + router + " from network " + network);
_routerDao.removeRouterFromNetwork(router.getId(), network.getId());
//check if router is already part of network
if (_routerDao.isRouterPartOfGuestNetwork(router.getId(), network.getId())) {
s_logger.debug("Removing router " + router + " from network" + network);
_routerDao.removeRouterFromNetwork(router.getId(), network.getId());
}
}
}
return result;

View File

@ -5,7 +5,7 @@
# if you change 'em here, you need to change it also in cloud.spec, add a %changelog entry there, and add an entry in debian/changelog
VERSION = '3.0.3.2012-06-11T21:29:17Z'
VERSION = '3.0.3.2012-06-11T21:51:13Z'
APPNAME = 'cloud'
import shutil,os