mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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
This commit is contained in:
parent
0af15e4a2c
commit
016d009adf
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user