You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ko...@apache.org on 2014/12/09 07:29:27 UTC
git commit: updated refs/heads/4.5 to 016d009
Repository: cloudstack
Updated Branches:
refs/heads/4.5 0af15e4a2 -> 016d009ad
CLOUDSTACK-7994: Network rules are not configured in VR after out-of-band movement due to host crash
The last commit 513adab51b53ba1acdea908225cfffab90ca1595 didn't fully fix it. Scenario #1 was not handled, only #2 was handled.
Fixed #1 as part of this commit.
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
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/016d009a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/016d009a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/016d009a
Branch: refs/heads/4.5
Commit: 016d009adfa7e12b7d5c2c43b946fc93ad07aa9d
Parents: 0af15e4
Author: Koushik Das <ko...@apache.org>
Authored: Tue Dec 9 11:46:45 2014 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Tue Dec 9 11:46:45 2014 +0530
----------------------------------------------------------------------
.../router/VirtualNetworkApplianceManagerImpl.java | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/016d009a/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 f4e83ac..fb39c0a 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -4461,16 +4461,23 @@ VirtualMachineGuru, Listener, Configurable, StateListener<State, VirtualMachine.
public boolean postStateTransitionEvent(State oldState, VirtualMachine.Event event, State newState, VirtualMachine vo, boolean status, Object opaque) {
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();
- 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()) {
- 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");
+ 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);
}
}