diff --git a/api/src/com/cloud/network/VirtualNetworkApplianceService.java b/api/src/com/cloud/network/VirtualNetworkApplianceService.java index a9d9c527f40..2984e3fa34e 100644 --- a/api/src/com/cloud/network/VirtualNetworkApplianceService.java +++ b/api/src/com/cloud/network/VirtualNetworkApplianceService.java @@ -69,5 +69,5 @@ public interface VirtualNetworkApplianceService { List upgradeRouterTemplate(UpgradeRouterTemplateCmd cmd); - public static final String MinVRVersion = "4.3.0"; + public static final String MinVRVersion = "4.5.0"; } diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index fb1e8b847f8..c505755d172 100644 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -2579,15 +2579,22 @@ Configurable, StateListener { final VirtualMachine.Event event = transition.getEvent(); if (event == VirtualMachine.Event.FollowAgentPowerOnReport && newState == State.Running) { if (vo.getType() == VirtualMachine.Type.DomainRouter) { + // 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; + // powerHostId cannot be null in case of out-of-band VM movement + if (second != null && second instanceof Long) { 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()) { + 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"); _executor.schedule(new RebootTask(vo.getId()), 1000, TimeUnit.MICROSECONDS); }