Skip to content

Commit 93188b4

Browse files
author
Sheng Yang
committed
CLOUDSTACK-4786: Reset Redundant Router priority after all the routers are stopped
This patch would reset the priority in such condition: 1. All redundant routers are stopped, e.g. due to network GC 2. User start one VM in the network 3. The routers would be brought up with reseted priority(100 & 99). This would resolve the issue of network GC result in lower limit of redundant router priority reached.
1 parent 7d7bd2a commit 93188b4

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎patches/systemvm/debian/config/etc/init.d/cloud-early-config‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,7 @@ change_password() {
11891189
start() {
11901190
# Clear /tmp for file lock
11911191
rm -f /tmp/*.lock
1192+
rm -f /tmp/rrouter_bumped
11921193
local hyp=$(hypervisor)
11931194
[ $? -ne 0 ] && log_it "Failed to detect hypervisor type, bailing out of early init" && exit 10
11941195
log_it "Detected that we are running inside $hyp guest"

‎server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,26 @@ private HypervisorType getClusterToStartDomainRouterForOvm(long podId) {
14211421
throw new CloudRuntimeException(errMsg);
14221422
}
14231423

1424+
private void checkAndResetPriorityOfRedundantRouter(List<DomainRouterVO> routers) {
1425+
boolean allStopped = true;
1426+
for (DomainRouterVO router : routers) {
1427+
if (!router.getIsRedundantRouter() || router.getState() != VirtualMachine.State.Stopped) {
1428+
allStopped = false;
1429+
break;
1430+
}
1431+
}
1432+
if (!allStopped) {
1433+
return;
1434+
}
1435+
1436+
for (DomainRouterVO router : routers) {
1437+
// getUpdatedPriority() would update the value later
1438+
router.setPriority(0);
1439+
router.setIsPriorityBumpUp(false);
1440+
_routerDao.update(router.getId(), router);
1441+
}
1442+
}
1443+
14241444
@DB
14251445
protected List<DomainRouterVO> findOrDeployVirtualRouterInGuestNetwork(Network guestNetwork, DeployDestination dest, Account owner,
14261446
boolean isRedundant, Map<Param, Object> params) throws ConcurrentOperationException,
@@ -1491,6 +1511,10 @@ protected List<DomainRouterVO> findOrDeployVirtualRouterInGuestNetwork(Network g
14911511
int routerCount = 1;
14921512
if (isRedundant) {
14931513
routerCount = 2;
1514+
//Check current redundant routers, if possible(all routers are stopped), reset the priority
1515+
if (routers.size() != 0) {
1516+
checkAndResetPriorityOfRedundantRouter(routers);
1517+
}
14941518
}
14951519

14961520
// If old network is redundant but new is single router, then routers.size() = 2 but routerCount = 1

0 commit comments

Comments
 (0)