Skip to content

Commit 9882d7f

Browse files
committed
Fix unnecessary UPDATE on implementation fail
1 parent 194e768 commit 9882d7f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,12 +3087,13 @@ public boolean shutdownNetwork(final long networkId, final ReservationContext co
30873087
s_logger.debug("Lock is acquired for network " + network + " as a part of network shutdown");
30883088
}
30893089

3090-
if (network.getState() == Network.State.Allocated) {
3090+
final Network.State initialState = network.getState();
3091+
if (initialState == Network.State.Allocated) {
30913092
s_logger.debug(String.format("Network [%s] is in Allocated state, no need to shutdown.", network));
30923093
return true;
30933094
}
30943095

3095-
if (network.getState() != Network.State.Implemented && network.getState() != Network.State.Shutdown) {
3096+
if (initialState != Network.State.Implemented && initialState != Network.State.Shutdown) {
30963097
s_logger.debug("Network is not implemented: " + network);
30973098
return false;
30983099
}
@@ -3139,7 +3140,9 @@ public Boolean doInTransaction(final TransactionStatus status) {
31393140
}
31403141
_networksDao.update(networkFinal.getId(), networkFinal);
31413142
_networksDao.clearCheckForGc(networkId);
3142-
publishNetworkUpdate(networkFinal);
3143+
if (initialState == Network.State.Implemented) {
3144+
publishNetworkUpdate(networkFinal);
3145+
}
31433146
result = true;
31443147
} else {
31453148
try {

0 commit comments

Comments
 (0)