Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
ScheduledExecutorService _checkExecutor;
ScheduledExecutorService _networkStatsUpdateExecutor;
ExecutorService _rvrStatusUpdateExecutor;
ExecutorService _rebootRouterExecutor;

BlockingQueue<Long> _vrUpdateQueue = null;

Expand Down Expand Up @@ -572,7 +571,6 @@ public boolean configure(final String name, final Map<String, Object> 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);

Expand Down Expand Up @@ -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
Expand All @@ -2615,30 +2613,20 @@ public boolean preStateTransitionEvent(final State oldState, final VirtualMachin

@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();
Expand Down
5 changes: 4 additions & 1 deletion setup/db/db/schema-452to460-cleanup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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';