Skip to content

Commit 479733f

Browse files
committed
Merge pull request apache#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>
2 parents 4223c51 + f2f2952 commit 479733f

3 files changed

Lines changed: 11 additions & 23 deletions

File tree

‎server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
4444
static final String RouterTemplateOvm3CK = "router.template.ovm3";
4545
static final String SetServiceMonitorCK = "network.router.EnableServiceMonitoring";
4646
static final String RouterAlertsCheckIntervalCK = "router.alerts.check.interval";
47-
static final String RouterReprovisionOnOutOfBandMigrationCK = "router.reboot.when.outofband.migrated";
4847

4948
static final ConfigKey<String> RouterTemplateXen = new ConfigKey<String>(String.class, RouterTemplateXenCK, "Advanced", "SystemVM Template (XenServer)",
5049
"Name of the default router template on Xenserver.", true, ConfigKey.Scope.Zone, null);
@@ -68,8 +67,6 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
6867
"If true, router minimum required version is checked before sending command", false);
6968
static final ConfigKey<Boolean> UseExternalDnsServers = new ConfigKey<Boolean>(Boolean.class, "use.external.dns", "Advanced", "false",
7069
"Bypass internal dns, use external dns1 and dns2", true, ConfigKey.Scope.Zone, null);
71-
static final ConfigKey<Boolean> RouterReprovisionOnOutOfBandMigration = new ConfigKey<Boolean>(Boolean.class, RouterReprovisionOnOutOfBandMigrationCK, "Advanced", "false",
72-
"Reboot routers when they are migrated out of band in order to reprovision", true, ConfigKey.Scope.Zone, null);
7370

7471
public static final int DEFAULT_ROUTER_VM_RAMSIZE = 256; // 256M
7572
public static final int DEFAULT_ROUTER_CPU_MHZ = 500; // 500 MHz

‎server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java‎

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,6 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
405405
ScheduledExecutorService _checkExecutor;
406406
ScheduledExecutorService _networkStatsUpdateExecutor;
407407
ExecutorService _rvrStatusUpdateExecutor;
408-
ExecutorService _rebootRouterExecutor;
409408

410409
BlockingQueue<Long> _vrUpdateQueue = null;
411410

@@ -572,7 +571,6 @@ public boolean configure(final String name, final Map<String, Object> params) th
572571
_executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("RouterMonitor"));
573572
_checkExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("RouterStatusMonitor"));
574573
_networkStatsUpdateExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("NetworkStatsUpdater"));
575-
_rebootRouterExecutor = Executors.newCachedThreadPool(new NamedThreadFactory("RebootRouterTask"));
576574

577575
VirtualMachine.State.getStateMachine().registerListener(this);
578576

@@ -2604,7 +2602,7 @@ public String getConfigComponentName() {
26042602

26052603
@Override
26062604
public ConfigKey<?>[] getConfigKeys() {
2607-
return new ConfigKey<?>[] { UseExternalDnsServers, routerVersionCheckEnabled, SetServiceMonitor, RouterAlertsCheckInterval, RouterReprovisionOnOutOfBandMigration };
2605+
return new ConfigKey<?>[] { UseExternalDnsServers, routerVersionCheckEnabled, SetServiceMonitor, RouterAlertsCheckInterval };
26082606
}
26092607

26102608
@Override
@@ -2615,30 +2613,20 @@ public boolean preStateTransitionEvent(final State oldState, final VirtualMachin
26152613

26162614
@Override
26172615
public boolean postStateTransitionEvent(final StateMachine2.Transition<State, VirtualMachine.Event> transition, final VirtualMachine vo, final boolean status, final Object opaque) {
2618-
final State oldState = transition.getCurrentState();
26192616
final State newState = transition.getToState();
26202617
final VirtualMachine.Event event = transition.getEvent();
2621-
boolean reprovision_out_of_band = RouterReprovisionOnOutOfBandMigration.value();
2622-
if (
2623-
(vo.getType() == VirtualMachine.Type.DomainRouter) &&
2624-
((oldState == State.Stopped) || (reprovision_out_of_band && isOutOfBandMigrated(opaque))) &&
2625-
(event == VirtualMachine.Event.FollowAgentPowerOnReport) &&
2626-
(newState == State.Running)) {
2627-
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");
2628-
_rebootRouterExecutor.execute(new RebootTask(vo.getId()));
2629-
} else {
2630-
if (isOutOfBandMigrated(opaque) && (vo.getType() == VirtualMachine.Type.DomainRouter)) {
2631-
final String title = "Router has been migrated out of band: " + vo.getInstanceName();
2632-
final String context =
2633-
"An out of band migration of router " + vo.getInstanceName() + "(" + vo.getUuid() + ") was detected. No automated action was performed.";
2634-
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER, vo.getDataCenterId(), vo.getPodIdToDeployIn(), title, context);
2635-
}
2618+
if (vo.getType() == VirtualMachine.Type.DomainRouter &&
2619+
event == VirtualMachine.Event.FollowAgentPowerOnReport &&
2620+
newState == State.Running &&
2621+
isOutOfBandMigrated(opaque)) {
2622+
s_logger.debug("Virtual router " + vo.getInstanceName() + " is powered-on out-of-band");
26362623
}
26372624

26382625
return true;
26392626
}
26402627

26412628
private boolean isOutOfBandMigrated(final Object opaque) {
2629+
// opaque -> <hostId, powerHostId>
26422630
if (opaque != null && opaque instanceof Pair<?, ?>) {
26432631
final Pair<?, ?> pair = (Pair<?, ?>)opaque;
26442632
final Object first = pair.first();

‎setup/db/db/schema-452to460-cleanup.sql‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,8 @@
1616
-- under the License.
1717

1818
--
19-
-- Schema cleanup from 4.5.1 to 4.6.0
19+
-- Schema cleanup from 4.5.2 to 4.6.0
2020
--
21+
22+
DELETE FROM `cloud`.`configuration` where name='router.reboot.when.outofband.migrated';
23+

0 commit comments

Comments
 (0)