Skip to content

Commit e019195

Browse files
committed
[#3655] Fix chicken-egg in state info
1 parent 282050a commit e019195

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/hooks/dhcp/high_availability/ha_service.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2941,6 +2941,10 @@ HAService::processMaintenanceCancel() {
29412941
" partner-in-maintenance state."));
29422942
}
29432943

2944+
// This is the state the server will transition to if the notification to the
2945+
// partner is successful.
2946+
int next_state = getPrevState() == HA_PARTNER_IN_MAINTENANCE_ST ? HA_WAITING_ST : getPrevState();
2947+
29442948
HAConfig::PeerConfigPtr remote_config = config_->getFailoverPeerConfig();
29452949

29462950
// Create HTTP/1.1 request including ha-maintenance-notify command
@@ -2950,7 +2954,9 @@ HAService::processMaintenanceCancel() {
29502954
HostHttpHeader(remote_config->getUrl().getStrippedHostname()));
29512955
remote_config->addBasicAuthHttpHeader(request);
29522956
request->setBodyAsJson(CommandCreator::createMaintenanceNotify(config_->getThisServerName(),
2953-
true, getCurrState(), server_type_));
2957+
true,
2958+
next_state,
2959+
server_type_));
29542960
request->finalize();
29552961

29562962
// Response object should also be created because the HTTP client needs
@@ -3048,7 +3054,7 @@ HAService::processMaintenanceCancel() {
30483054
// previous one. Avoid returning to the partner-in-maintenance if it was
30493055
// the previous state.
30503056
postNextEvent(HA_MAINTENANCE_CANCEL_EVT);
3051-
verboseTransition(getPrevState() == HA_PARTNER_IN_MAINTENANCE_ST ? HA_WAITING_ST : getPrevState());
3057+
verboseTransition(next_state);
30523058
runModel(NOP_EVT);
30533059

30543060
return (createAnswer(CONTROL_RESULT_SUCCESS,

0 commit comments

Comments
 (0)