Skip to content

Implement network configuration rollback#974

Open
gibmat wants to merge 7 commits intolxc:mainfrom
gibmat:network-config-rollback
Open

Implement network configuration rollback#974
gibmat wants to merge 7 commits intolxc:mainfrom
gibmat:network-config-rollback

Conversation

@gibmat
Copy link
Member

@gibmat gibmat commented Mar 17, 2026

Closes #860

gibmat added 4 commits March 17, 2026 14:57
…truct

Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
…if ConfirmationTimeout is defined

Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
@gibmat gibmat force-pushed the network-config-rollback branch from d23a559 to 9be4610 Compare March 17, 2026 21:28
@gibmat gibmat marked this pull request as ready for review March 17, 2026 21:28
gibmat added 3 commits March 17, 2026 15:31
Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
@gibmat gibmat force-pushed the network-config-rollback branch from 9be4610 to fe75831 Compare March 17, 2026 21:31
Comment on lines +166 to +175
for time.Since(startTime) < confirmationTimeout {
// If NetworkConfigurationPending is false, that means the user has confirmed
// the changes, so there's no need to restore the prior network configuration.
if !s.state.NetworkConfigurationPending {
return
}

// Sleep five seconds before checking again.
time.Sleep(5 * time.Second)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a bit racy though, I could:

  • Perform a config change with a revert set to 5min
  • Confirm it
  • Within 5s, send another config change with a revert set to 5min
  • Have the go routine of the previous change kick in and revert to the old-old-config
  • Have the go routine handling the second change then exit thinking the user confirmed the change

It's not super likely to happen, you'd need someone who's making two consecutive very small edits, but it may be possible when tweaking something like VLANs.

Using a channel for confirmation would allow for using a select statement waiting on either user confirmation OR a timeout, eliminating the need for the sleep 5s loop and the race condition in the process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add network configuration rollback

2 participants