From a269b089ae38d0d04db2fa0f4c8e839480476ddc Mon Sep 17 00:00:00 2001 From: Sheng Yang Date: Fri, 16 Dec 2011 18:52:59 -0800 Subject: [PATCH] bug 12608: NaaS: Don't shutdown elements if cleanup=false We can use the restartNetwork mechanism to recover the disconnected redundant router. Also disable HA for redundant router. Admin would take responsibilty to recover the failure router, because redundant routers themselves are one layer HA. status 12608: resolved fixed --- .../com/cloud/network/NetworkManagerImpl.java | 17 +++++++++++------ .../VirtualNetworkApplianceManagerImpl.java | 8 +++++++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 57bd3cb5768..d4ba860f947 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -2820,14 +2820,19 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag s_logger.debug("Restarting network " + networkId + "..."); - //shutdown the network ReservationContext context = new ReservationContextImpl(null, null, callerUser, callerAccount); - s_logger.debug("Shutting down the network id=" + networkId + " as a part of network restart"); + + if (cleanup) { + //shutdown the network + s_logger.debug("Shutting down the network id=" + networkId + " as a part of network restart"); - if (!shutdownNetworkElementsAndResources(context, cleanup, network)) { - s_logger.debug("Failed to shutdown the network elements and resources as a part of network restart: " + network.getState()); - setRestartRequired(network, true); - return false; + if (!shutdownNetworkElementsAndResources(context, true, network)) { + s_logger.debug("Failed to shutdown the network elements and resources as a part of network restart: " + network.getState()); + setRestartRequired(network, true); + return false; + } + } else { + s_logger.debug("Skip the shutting down of network id=" + networkId); } //implement the network elements and rules again diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index f862798f435..de2bcd24d9d 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -1346,9 +1346,15 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian s_logger.debug(hType + " won't support system vm, skip it"); continue; } + + boolean offerHA = routerOffering.getOfferHA(); + /* We don't provide HA to redundant router VMs, admin should own it all, and redundant router themselves are HA */ + if (isRedundant) { + offerHA = false; + } router = new DomainRouterVO(id, routerOffering.getId(), vrProvider.getId(), VirtualMachineName.getRouterName(id, _instance), template.getId(), template.getHypervisorType(), - template.getGuestOSId(), owner.getDomainId(), owner.getId(), guestNetwork.getId(), isRedundant, 0, false, RedundantState.UNKNOWN, routerOffering.getOfferHA(), false); + template.getGuestOSId(), owner.getDomainId(), owner.getId(), guestNetwork.getId(), isRedundant, 0, false, RedundantState.UNKNOWN, offerHA, false); router.setRole(Role.VIRTUAL_ROUTER); router = _itMgr.allocate(router, template, routerOffering, networks, plan, null, owner); break;