Skip to content

Commit

Permalink
agent: move reboot check from load to run in VMChangeActivity
Browse files Browse the repository at this point in the history
This has some advantages:

* Dmidecode as external tool is called less often, only when really
  needed (init, just before reboot). Before, this happened on every
  agent run.
* Less debug log messages.
* Activity doesn't change just by loading it.
* Non-privileged users can show the activity now.

PL-131813
  • Loading branch information
dpausp committed Nov 9, 2023
1 parent f07eb19 commit ad0e262
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkgs/fc/agent/fc/maintenance/activity/vm_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,11 @@ def _update_reboot_needed(self):
else:
self.reboot_needed = None

def load(self):
def run(self):
self._update_reboot_needed()

# Running an VMChangeActivity is not needed, so no run method.
# The request manager handles the reboot required by this activity.
self.returncode = 0

def resume(self):
# There's nothing to do so we can safely "retry" this activity.
# run() just checks if the reboot is needed at the moment so we can safely
# retry this activity.
self.run()

0 comments on commit ad0e262

Please sign in to comment.