On Fri, Jul 04, 2025 at 15:05:10 +0200, Pavel Hrdina wrote:
> On Thu, Jul 03, 2025 at 02:50:33PM +0200, Peter Krempa via Devel wrote:
> > From: Peter Krempa <pkre...@redhat.com>
> > 
> > Decide separately and record what shutdown modes are to be applied on
> > given VM object rather than spreading out the logic through the code.
> > 
> > This centralization simplifies the conditions in the worker functions
> > and also:
> >  - provides easy way to check if the auto-shutdown code will be acting
> >    on domain object (will be used to fix attempt to auto-restore of
> >    VMs which were not selected to be acted on
> >  - will simplify further work where the desired shutdown action will be
> >    picked per-VM
> > 
> > This refactor also fixes a bug where if restoring of the state is
> > applied also on VMs that are not selected for action based on current
> > logic.
> > 
> > Signed-off-by: Peter Krempa <pkre...@redhat.com>
> > ---
> >  src/hypervisor/domain_driver.c | 176 +++++++++++++++++++--------------
> >  1 file changed, 100 insertions(+), 76 deletions(-)
> > 
> > diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c
> > index d8ccee40d5..7f958c087f 100644
> > --- a/src/hypervisor/domain_driver.c
> > +++ b/src/hypervisor/domain_driver.c
> > @@ -738,25 +738,32 @@ 
> > virDomainDriverAutoShutdownActive(virDomainDriverAutoShutdownConfig *cfg)
> >  }
> > 
> > 
> > +enum {
> > +    VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_MODE_SAVE = 1 >> 1,
> > +    VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_MODE_SHUTDOWN = 1 >> 2,
> > +    VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_MODE_POWEROFF = 1 >> 3,
> > +    VIR_DOMAIN_DRIVER_AUTO_SHUTDOWN_MODE_RESTORE = 1 >> 4,
> 
> s/>>/<</

Oops! something looked weird here but I couldn't tell what when looking
at the patch.

And for those curious, no I didn't test this. It's quite a hassle
because the "host" running this needs to actually reboot. I spend quite
a few reboots already when validating the ordering fix and simply didn't
bother, especially since I was developing per-VM config of shutdown
behaviour which I didn't yet finish, and thus also didn't test. This
patch was supposed to be a refactor for it but turned out a bugfix (for
the resume thing.)

I promise I'll test it before pushing

Reply via email to