Best way to reboot from subordinate charm

I’m faced with a situation where I need to reboot a node after installing infiniband drivers from Mellanox repos.

I’m looking for advice on when (which hook) and how best reboot a node as part of me installing the OFED kernel driver. I need to put the reboot inside of a subordinate charm.

I want to wait for all other activities from the principal charm to finish before booting.

Also, I only have access to bash (not python/reactive)

Also, this is a centos7 charm as part of the SLURM charms we are working on.

Any advice and hopefully some code examples greatly appreciated.

I would go about this by having the charm indicate a reboot is required and go into a blocked state. Then I’d either have an action or use juju run -- sudo shutdown -r now kind of thing to be honest. Having the unit with log auto reboot seems like it might be a bit more fragile.

It’s a pain to do this manually since in a HCP cluster with SLURM, a model may contain a few thousand nodes…

Ah, I see. Makes sense. Then perhaps I’d look to see what goal state does for representing the state of the main unit so the subordinate can attempt to tell when the main unit it stable and done and can be rebooted.

Do you know of and code example for ‘goal-state’ as the documentation is not showing any?

Aprechiate the help.