mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-5552 fixed private gateway DB clean up on router upgrade required
This commit is contained in:
parent
14ecb4f842
commit
279e9cbe49
|
|
@ -3897,8 +3897,9 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
|||
List<NicVO> nics = _nicDao.listByVmId(routerId);
|
||||
for (NicVO n : nics) {
|
||||
NetworkVO nc = _networkDao.findById(n.getNetworkId());
|
||||
if (nc.getTrafficType() == TrafficType.Control) {
|
||||
if (nc !=null && nc.getTrafficType() == TrafficType.Control) {
|
||||
routerControlIpAddress = n.getIp4Address();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4088,7 +4089,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
|||
|
||||
//Checks if the router is at the required version
|
||||
// Compares MS version and router version
|
||||
private boolean checkRouterVersion(VirtualRouter router){
|
||||
protected boolean checkRouterVersion(VirtualRouter router){
|
||||
if(!routerVersionCheckEnabled.value()){
|
||||
//Router version check is disabled.
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -914,6 +914,11 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
try {
|
||||
Network network = _networkModel.getNetwork(gateway.getNetworkId());
|
||||
NicProfile requested = createPrivateNicProfileForGateway(gateway);
|
||||
|
||||
if (!checkRouterVersion(router)) {
|
||||
s_logger.warn("Router requires upgrade. Unable to send command to router: " + router.getId());
|
||||
return false;
|
||||
}
|
||||
|
||||
NicProfile guestNic = _itMgr.addVmToNetwork(router, network, requested);
|
||||
|
||||
|
|
@ -963,12 +968,17 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
privateIps.add(ip);
|
||||
Commands cmds = new Commands(Command.OnError.Stop);
|
||||
createVpcAssociatePrivateIPCommands(router, privateIps, cmds, add);
|
||||
|
||||
if (sendCommandsToRouter(router, cmds)) {
|
||||
s_logger.debug("Successfully applied ip association for ip " + ip + " in vpc network " + network);
|
||||
return true;
|
||||
} else {
|
||||
s_logger.warn("Failed to associate ip address " + ip + " in vpc network " + network);
|
||||
|
||||
try{
|
||||
if (sendCommandsToRouter(router, cmds)) {
|
||||
s_logger.debug("Successfully applied ip association for ip " + ip + " in vpc network " + network);
|
||||
return true;
|
||||
} else {
|
||||
s_logger.warn("Failed to associate ip address " + ip + " in vpc network " + network);
|
||||
return false;
|
||||
}
|
||||
}catch (Exception ex) {
|
||||
s_logger.warn("Failed to send " + (add ?"add ":"delete ") + " private network " + network + " commands to rotuer ");
|
||||
return false;
|
||||
}
|
||||
} else if (router.getState() == State.Stopped || router.getState() == State.Stopping) {
|
||||
|
|
|
|||
|
|
@ -1513,7 +1513,8 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
if (!success) {
|
||||
if (destroyOnFailure) {
|
||||
s_logger.debug("Destroying private gateway " + vo + " that failed to start");
|
||||
if (deleteVpcPrivateGateway(gatewayId)) {
|
||||
// calling deleting from db because on createprivategateway fail, destroyPrivateGateway is already called
|
||||
if (deletePrivateGatewayFromTheDB(getVpcPrivateGateway(gatewayId))) {
|
||||
s_logger.warn("Successfully destroyed vpc " + vo + " that failed to start");
|
||||
} else {
|
||||
s_logger.warn("Failed to destroy vpc " + vo + " that failed to start");
|
||||
|
|
|
|||
Loading…
Reference in New Issue