You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2015/06/17 22:32:20 UTC
git commit: updated refs/heads/4.5 to 88fb843
Repository: cloudstack
Updated Branches:
refs/heads/4.5 4d096ea0e -> 88fb8431f
CLOUDSTACK-8545 make reboot on out of band migration configurable
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/88fb8431
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/88fb8431
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/88fb8431
Branch: refs/heads/4.5
Commit: 88fb8431f235b92f7de291413a6880a7ea08de1b
Parents: 4d096ea
Author: Daan Hoogland <da...@gmail.com>
Authored: Tue Jun 16 17:12:43 2015 +0200
Committer: Daan Hoogland <da...@gmail.com>
Committed: Wed Jun 17 22:31:44 2015 +0200
----------------------------------------------------------------------
.../router/VirtualNetworkApplianceManager.java | 9 +++-
.../VirtualNetworkApplianceManagerImpl.java | 56 +++++++++-----------
2 files changed, 32 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88fb8431/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
index 443402e..4022b56 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
@@ -53,6 +53,7 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
static final String RouterTemplateLxcCK = "router.template.lxc";
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);
@@ -64,12 +65,16 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
"Name of the default router template on Hyperv.", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<String> RouterTemplateLxc = new ConfigKey<String>(String.class, RouterTemplateLxcCK, "Advanced", "SystemVM Template (LXC)",
"Name of the default router template on LXC.", true, ConfigKey.Scope.Zone, null);
-
static final ConfigKey<String> SetServiceMonitor = new ConfigKey<String>(String.class, SetServiceMonitorCK, "Advanced", "true",
"service monitoring in router enable/disable option, default true", true, ConfigKey.Scope.Zone, null);
-
static final ConfigKey<Integer> RouterAlertsCheckInterval = new ConfigKey<Integer>(Integer.class, RouterAlertsCheckIntervalCK, "Advanced", "1800",
"Interval (in seconds) to check for alerts in Virtual Router.", false, ConfigKey.Scope.Global, null);
+ static final ConfigKey<Boolean> routerVersionCheckEnabled = new ConfigKey<Boolean>("Advanced", Boolean.class, "router.version.check", "true",
+ "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
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88fb8431/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 46463cd..698f94d 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -676,13 +676,6 @@ VirtualMachineGuru, Listener, Configurable, StateListener<State, VirtualMachine.
}
}
- 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> routerVersionCheckEnabled = new ConfigKey<Boolean>("Advanced", Boolean.class, "router.version.check", "true",
- "If true, router minimum required version is checked before sending command", false);
-
-
@Override
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
@@ -4466,7 +4459,7 @@ VirtualMachineGuru, Listener, Configurable, StateListener<State, VirtualMachine.
@Override
public ConfigKey<?>[] getConfigKeys() {
- return new ConfigKey<?>[] {UseExternalDnsServers, routerVersionCheckEnabled, SetServiceMonitor, RouterAlertsCheckInterval};
+ return new ConfigKey<?>[] {UseExternalDnsServers, routerVersionCheckEnabled, SetServiceMonitor, RouterAlertsCheckInterval, RouterReprovisionOnOutOfBandMigration};
}
@Override
@@ -4479,32 +4472,33 @@ VirtualMachineGuru, Listener, Configurable, StateListener<State, VirtualMachine.
State oldState = transition.getCurrentState();
State newState = transition.getToState();
VirtualMachine.Event event = transition.getEvent();
- if (event == VirtualMachine.Event.FollowAgentPowerOnReport && newState == State.Running) {
- if (vo.getType() == VirtualMachine.Type.DomainRouter) {
- // opaque -> <hostId, powerHostId>
- if (opaque != null && opaque instanceof Pair<?, ?>) {
- Pair<?, ?> pair = (Pair<?, ?>)opaque;
- Object first = pair.first();
- Object second = pair.second();
- // powerHostId cannot be null in case of out-of-band VM movement
- if (second != null && second instanceof Long) {
- Long powerHostId = (Long)second;
- Long hostId = null;
- if (first != null && first instanceof Long) {
- hostId = (Long)first;
- }
- // The following scenarios are due to out-of-band VM movement
- // 1. If VM is in stopped state in CS due to 'PowerMissing' report from old host (hostId is null) and then there is a 'PowerOn' report from new host
- // 2. If VM is in running state in CS and there is a 'PowerOn' report from new host
- if (hostId == null || (hostId.longValue() != powerHostId.longValue())) {
- s_logger.info("Schedule a router reboot task as router " + vo.getId() + " is powered-on out-of-band, need to reboot to refresh network rules");
- _rebootRouterExecutor.execute(new RebootTask(vo.getId()));
- }
- }
+ 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");
+ _executor.schedule(new RebootTask(vo.getId()), 1000, TimeUnit.MICROSECONDS);
+ }
+ return true;
+ }
+
+ private boolean isOutOfBandMigrated(Object opaque) {
+ if (opaque != null && opaque instanceof Pair<?, ?>) {
+ Pair<?, ?> pair = (Pair<?, ?>)opaque;
+ Object first = pair.first();
+ Object second = pair.second();
+ if (first != null && second != null && first instanceof Long && second instanceof Long) {
+ Long hostId = (Long)first;
+ Long powerHostId = (Long)second;
+ // If VM host known to CS is different from 'PowerOn' report host, then it is out-of-band movement
+ if (hostId.longValue() != powerHostId.longValue()) {
+ return true;
}
}
}
- return true;
+ return false;
}
protected class RebootTask extends ManagedContextRunnable {