Bug 1589970 - libvirt-guests.sh keep trying shutting down guests after they were shutdown succesfully
Summary: libvirt-guests.sh keep trying shutting down guests after they were shutdown s...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: 28
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1590653 1597420 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-11 18:35 UTC by davestux
Modified: 2019-05-21 15:00 UTC (History)
13 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-05-21 15:00:04 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Patch to fix the issue (1.31 KB, patch)
2018-10-23 09:29 UTC, Thomas Jarosch
no flags Details | Diff
Second part of the fix (1.68 KB, patch)
2018-10-23 09:33 UTC, Thomas Jarosch
no flags Details | Diff

Description davestux 2018-06-11 18:35:47 UTC
Description of problem:
When set to shutdown guests, the libvirt-guest service shuts down the guests but then ignores the successful shutdown and tries to shut down them again and again, until timeout is reached. 


Version-Release number of selected component (if applicable):
4.1.0.2-fc28

How reproducible:
, 

Steps to Reproduce:
1. Enable libvirt-guests.
2. In /etc/sysconfig/libvirt-guests set ON_SHUTDOWN=shutdown.
3. start virtual machine.
4. shut down host.

Actual results:
libvirt-guests.sh shut down the guest successfully and then loops with the following messages:
Starting shutdown on guest: guestname
error: Requested operation is not valid: domain is not running
error: Failed to shutdown domain guest-UID


Expected results:
After successfully shutting down the guest libvirt-guests.sh should quit gracefully.

Additional info:
Started after upgrading to 28. 
Reproduced on a different, newly installed system.

Comment 1 Thomas Jarosch 2018-10-23 09:29:00 UTC
Created attachment 1496663 [details]
Patch to fix the issue

After two hours of "print debugging" I found out the check_guests_shutdown() function overwrites the global $guests variable. D'oh!

I've developed a fix and wanted to send it upstream... just to notice it has already been fixed :)

Attached is the upstream fix from git, it applies to libvirt from Fedora 28 just fine.

*** Patch description ***
commit 7e476356c28a7fccd40eebbd8dac83e49e782010
Author: Christian Ehrhardt <christian.ehrhardt>
Date:   Mon Mar 19 12:44:31 2018 +0100

    tools: fix variable scope in in check_guests_shutdown

    libvirt-guests.sh when run with more active guests than requested to
    shut down in parallel will run until it times out only shutting down
    the first set of guests.

    This patch fixes parallel shutdown by fixing a variable scope issue
    where check_guests_shutdown unintentionally reset $guests which
    prevented further progress.

    Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1688508

    Signed-off-by: Christian Ehrhardt <christian.ehrhardt>

Comment 2 Thomas Jarosch 2018-10-23 09:33:53 UTC
Created attachment 1496665 [details]
Second part of the fix

Second part of the fix as done by upstream.

My fix was simpler: Just declare the "$guests" variable as "local" in check_guests_shutdown().

Comment 3 Ben Cotton 2019-05-02 20:35:49 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Cole Robinson 2019-05-21 14:58:41 UTC
*** Bug 1590653 has been marked as a duplicate of this bug. ***

Comment 5 Cole Robinson 2019-05-21 14:58:48 UTC
*** Bug 1597420 has been marked as a duplicate of this bug. ***

Comment 6 Cole Robinson 2019-05-21 15:00:04 UTC
Sorry this slipped through the cracks and didn't get backported to F28. This is fixed in f29+


Note You need to log in before you can comment on or make changes to this bug.