pikvm/pikvm

[Feature Request] pikvm-update option to prevent automatic reboot

n1nj4888 opened this issue · 3 comments

Is your feature request related to a problem? Please describe.
The current pikvm-update command does not have any options to control the behavior and so, if a reboot is determined as required, the command outputs the following and performs the reboot automatically (albeit asking the user to ctrl+c within 30 seconds if they want to abort the reboot):

==============================================================
      Reboot required. We will make it after 30 seconds.
            Press Ctrl+C if you don't want this.
==============================================================

==============================================================
Please note that the filesystem now remain in Read-Write mode.
       A reboot is necessary to make it Read-Only again.
The reboot can be performed later using the 'reboot' command.
==============================================================

For scenarios where we might want to call the pikvm-update command via say an Ansible playbook, the automatic reboot causes the playbook to fail as it is not expected. As such, it would be great to have a --noreboot option so that, even if a reboot is determined, pikvm-update would still output to stdout that a reboot is required, but would not actually perform the reboot itself, leaving the decision of when to reboot to the user or another orchestrating process (such as Ansible)

Thanks for your consideration!

Describe the solution you'd like
Please add an option for --noreboot to the pikvm-update command.

Describe alternatives you've considered
N/A

Additional context
Add any other context or screenshots about the feature request here.

I've added option --no-reboot, but should we use some special exit code like 111 which can means reboot required for caller?

Hi @mdevaev ! Thanks for looking into this!

I suspect the caller could just grep the command stdout for some specific indicator (i.e "Reboot required but not performed" or similar) but a special exit code would be better (although I'm not familiar with the conventions here) and make it easier to determine the follow-on action.

Thanks!

Ok, exit code == 100 means "reboot required" now if option --no-reboot specified. Released.