From f2f29525aed3fa21d5f6b3c3d9399b8df70467f3 Mon Sep 17 00:00:00 2001 From: Koushik Das Date: Mon, 17 Aug 2015 14:49:32 +0530 Subject: [PATCH] CLOUDSTACK-8737: Remove out-of-band VR reboot code based on persistent VR configuration changes Removed out-of-band VR reboot code --- .../VirtualNetworkApplianceManager.java | 3 --- .../VirtualNetworkApplianceManagerImpl.java | 26 +++++-------------- setup/db/db/schema-452to460-cleanup.sql | 5 +++- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java index 20ee2a178980..a291b3590b25 100644 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java @@ -44,7 +44,6 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA static final String RouterTemplateOvm3CK = "router.template.ovm3"; static final String SetServiceMonitorCK = "network.router.EnableServiceMonitoring"; static final String RouterAlertsCheckIntervalCK = "router.alerts.check.interval"; - static final String RouterReprovisionOnOutOfBandMigrationCK = "router.reboot.when.outofband.migrated"; static final ConfigKey RouterTemplateXen = new ConfigKey(String.class, RouterTemplateXenCK, "Advanced", "SystemVM Template (XenServer)", "Name of the default router template on Xenserver.", true, ConfigKey.Scope.Zone, null); @@ -68,8 +67,6 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA "If true, router minimum required version is checked before sending command", false); static final ConfigKey UseExternalDnsServers = new ConfigKey(Boolean.class, "use.external.dns", "Advanced", "false", "Bypass internal dns, use external dns1 and dns2", true, ConfigKey.Scope.Zone, null); - static final ConfigKey RouterReprovisionOnOutOfBandMigration = new ConfigKey(Boolean.class, RouterReprovisionOnOutOfBandMigrationCK, "Advanced", "false", - "Reboot routers when they are migrated out of band in order to reprovision", true, ConfigKey.Scope.Zone, null); public static final int DEFAULT_ROUTER_VM_RAMSIZE = 256; // 256M public static final int DEFAULT_ROUTER_CPU_MHZ = 500; // 500 MHz diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 8ec741742156..5a6985510251 100644 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -405,7 +405,6 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V ScheduledExecutorService _checkExecutor; ScheduledExecutorService _networkStatsUpdateExecutor; ExecutorService _rvrStatusUpdateExecutor; - ExecutorService _rebootRouterExecutor; BlockingQueue _vrUpdateQueue = null; @@ -572,7 +571,6 @@ public boolean configure(final String name, final Map params) th _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("RouterMonitor")); _checkExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("RouterStatusMonitor")); _networkStatsUpdateExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("NetworkStatsUpdater")); - _rebootRouterExecutor = Executors.newCachedThreadPool(new NamedThreadFactory("RebootRouterTask")); VirtualMachine.State.getStateMachine().registerListener(this); @@ -2604,7 +2602,7 @@ public String getConfigComponentName() { @Override public ConfigKey[] getConfigKeys() { - return new ConfigKey[] { UseExternalDnsServers, routerVersionCheckEnabled, SetServiceMonitor, RouterAlertsCheckInterval, RouterReprovisionOnOutOfBandMigration }; + return new ConfigKey[] { UseExternalDnsServers, routerVersionCheckEnabled, SetServiceMonitor, RouterAlertsCheckInterval }; } @Override @@ -2615,30 +2613,20 @@ public boolean preStateTransitionEvent(final State oldState, final VirtualMachin @Override public boolean postStateTransitionEvent(final StateMachine2.Transition transition, final VirtualMachine vo, final boolean status, final Object opaque) { - final State oldState = transition.getCurrentState(); final State newState = transition.getToState(); final VirtualMachine.Event event = transition.getEvent(); - boolean reprovision_out_of_band = RouterReprovisionOnOutOfBandMigration.value(); - if ( - (vo.getType() == VirtualMachine.Type.DomainRouter) && - ((oldState == State.Stopped) || (reprovision_out_of_band && isOutOfBandMigrated(opaque))) && - (event == VirtualMachine.Event.FollowAgentPowerOnReport) && - (newState == State.Running)) { - s_logger.info("Schedule a router reboot task as router " + vo.getId() + " is powered-on out-of-band. we need to reboot to refresh network rules"); - _rebootRouterExecutor.execute(new RebootTask(vo.getId())); - } else { - if (isOutOfBandMigrated(opaque) && (vo.getType() == VirtualMachine.Type.DomainRouter)) { - final String title = "Router has been migrated out of band: " + vo.getInstanceName(); - final String context = - "An out of band migration of router " + vo.getInstanceName() + "(" + vo.getUuid() + ") was detected. No automated action was performed."; - _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER, vo.getDataCenterId(), vo.getPodIdToDeployIn(), title, context); - } + if (vo.getType() == VirtualMachine.Type.DomainRouter && + event == VirtualMachine.Event.FollowAgentPowerOnReport && + newState == State.Running && + isOutOfBandMigrated(opaque)) { + s_logger.debug("Virtual router " + vo.getInstanceName() + " is powered-on out-of-band"); } return true; } private boolean isOutOfBandMigrated(final Object opaque) { + // opaque -> if (opaque != null && opaque instanceof Pair) { final Pair pair = (Pair)opaque; final Object first = pair.first(); diff --git a/setup/db/db/schema-452to460-cleanup.sql b/setup/db/db/schema-452to460-cleanup.sql index 4bbaa95afc56..db5ce1197ac7 100644 --- a/setup/db/db/schema-452to460-cleanup.sql +++ b/setup/db/db/schema-452to460-cleanup.sql @@ -16,5 +16,8 @@ -- under the License. -- --- Schema cleanup from 4.5.1 to 4.6.0 +-- Schema cleanup from 4.5.2 to 4.6.0 -- + +DELETE FROM `cloud`.`configuration` where name='router.reboot.when.outofband.migrated'; +