Merge pull request #701 from koushik-das/CLOUDSTACK-8737

CLOUDSTACK-8737: Remove out-of-band VR reboot code based on persistent VR configuration changes

Removed out-of-band VR reboot code

Refer to the discussion on dev list (http://mail-archives.apache.org/mod_mbox/cloudstack-dev/201506.mbox/%3cAC13E3C1-3719-4B48-A35D-DBC4BA7041D0@schubergphilis.com%3e)

* pr/701:
  CLOUDSTACK-8737: Remove out-of-band VR reboot code based on persistent VR configuration changes Removed out-of-band VR reboot code

Signed-off-by: Remi Bergsma <github@remi.nl>
This commit is contained in:
Remi Bergsma 2015-08-17 12:02:49 +02:00
commit 479733f9fe
3 changed files with 11 additions and 23 deletions

View File

@ -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<String> RouterTemplateXen = new ConfigKey<String>(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<Boolean> UseExternalDnsServers = new ConfigKey<Boolean>(Boolean.class, "use.external.dns", "Advanced", "false",
"Bypass internal dns, use external dns1 and dns2", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<Boolean> RouterReprovisionOnOutOfBandMigration = new ConfigKey<Boolean>(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

View File

@ -405,7 +405,6 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
ScheduledExecutorService _checkExecutor;
ScheduledExecutorService _networkStatsUpdateExecutor;
ExecutorService _rvrStatusUpdateExecutor;
ExecutorService _rebootRouterExecutor;
BlockingQueue<Long> _vrUpdateQueue = null;
@ -572,7 +571,6 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
_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 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
@Override
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] { UseExternalDnsServers, routerVersionCheckEnabled, SetServiceMonitor, RouterAlertsCheckInterval, RouterReprovisionOnOutOfBandMigration };
return new ConfigKey<?>[] { UseExternalDnsServers, routerVersionCheckEnabled, SetServiceMonitor, RouterAlertsCheckInterval };
}
@Override
@ -2615,30 +2613,20 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
@Override
public boolean postStateTransitionEvent(final StateMachine2.Transition<State, VirtualMachine.Event> 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 -> <hostId, powerHostId>
if (opaque != null && opaque instanceof Pair<?, ?>) {
final Pair<?, ?> pair = (Pair<?, ?>)opaque;
final Object first = pair.first();

View File

@ -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';