mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-7994: Network rules are not configured in VR after out-of-band movement due to host crash
Ensure that VR is re-booted when it is moved to another host out-of-band. This is necessary to re-program all network rules Conflicts: server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
This commit is contained in:
parent
449d123ce7
commit
c3515c9ff9
@ -200,6 +200,7 @@ import com.cloud.user.dao.UserDao;
|
||||
import com.cloud.user.dao.UserStatisticsDao;
|
||||
import com.cloud.user.dao.UserStatsLogDao;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
@ -2575,8 +2576,20 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
|
||||
final VirtualMachine.Event event = transition.getEvent();
|
||||
if (event == VirtualMachine.Event.FollowAgentPowerOnReport && newState == State.Running) {
|
||||
if (vo.getType() == VirtualMachine.Type.DomainRouter) {
|
||||
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);
|
||||
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()) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -81,6 +81,7 @@ import com.cloud.user.UserStatisticsVO;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.db.EntityManager;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.fsm.StateMachine2;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.vm.DomainRouterVO;
|
||||
import com.cloud.vm.Nic;
|
||||
@ -741,4 +742,11 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean postStateTransitionEvent(final StateMachine2.Transition<State, VirtualMachine.Event> transition, final VirtualMachine vo, final boolean status, final Object opaque) {
|
||||
// Without this VirtualNetworkApplianceManagerImpl.postStateTransitionEvent() gets called twice as part of listeners -
|
||||
// once from VpcVirtualNetworkApplianceManagerImpl and once from VirtualNetworkApplianceManagerImpl itself
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user