Skip to content

Commit 7c7710c

Browse files
committed
Allow network restart only for the networks in Setup and Implemented states.
1 parent cd27202 commit 7c7710c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎server/src/com/cloud/network/NetworkManagerImpl.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,6 +2147,11 @@ public boolean restartNetwork(RestartNetworkCmd cmd) throws ConcurrentOperationE
21472147
throw new InvalidParameterValueException("Network with id=" + networkId + " doesn't exist");
21482148
}
21492149

2150+
//Don't allow to restart network if it's not in Implemented/Setup state
2151+
if (!(network.getState() == Network.State.Implemented || network.getState() == Network.State.Setup)) {
2152+
throw new InvalidParameterValueException("Network is not in the right state to be restarted. Correct states are: " + Network.State.Implemented + ", " + Network.State.Setup);
2153+
}
2154+
21502155
Account owner = _accountMgr.getAccount(network.getAccountId());
21512156
ReservationContext context = new ReservationContextImpl(null, null, caller, owner);
21522157

0 commit comments

Comments
 (0)