Bug 995377 - Domain without autostart can't be resumed by the libvirt-guests script after rebooting the host
Domain without autostart can't be resumed by the libvirt-guests script after ...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.0
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Pavel Hrdina
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-09 04:08 EDT by zhenfeng wang
Modified: 2016-04-26 09:54 EDT (History)
9 users (show)

See Also:
Fixed In Version: libvirt-1.2.7-1.el7
Doc Type: Bug Fix
Doc Text:
Cause: The libvirt-guest.service was correctly started after libvirtd.service, but it was too fast that the libvirtd wasn't fully started and it couldn't accept any connection yet. Consequence: Running domains weren't properly resumed after rebooting a host, only domains with autostart flag would start after rebooting. Fix: Let the libvirt-guest script try several times to connect to the libvirtd with the small sleep between tries. Result: Running domains are successfully resumed after rebooting a host.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-03-05 02:24:13 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description zhenfeng wang 2013-08-09 04:08:51 EDT
Description of problem:
Domain without autostart can't be resumed by the libvirt-guests script after rebooting the host

Version-Release number of selected component (if applicable):
libvirt-1.1.1-2.el7.x86_6
qemu-kvm-1.5.2-2.el7.x86_64
kernel-3.10.0-5.64.el7.x86_64
How reproducible:
100%

Steps
1.start a rhel7 guest without the autostart flag
# virsh dominfo rhel7qcow2
Id:             -
Name:           rhel7qcow2
UUID:           c2ecf8a8-f3d7-6d4c-c283-c9a0ed25fc72
OS Type:        hvm
State:          shut off
CPU(s):         1
Max memory:     1048576 KiB
Used memory:    1048576 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0

#virsh start rhel7qcow2

2.Wait for the domains to fully boot up.

Conduct some operations in the guest, eg # ls.

3.Edit /etc/sysconfig/libvirt-guests, and set
ON_BOOT=start
ON_SHUTDOWN=suspend

4.Enable the libvirt-guests service in the host
#systemctl enable libvirt-guests.service
systemctl status libvirt-guests
libvirt-guests.service - Suspend Active Libvirt Guests
   Loaded: loaded (/usr/lib/systemd/system/libvirt-guests.service; enabled)
   Active: active (exited) since Thu 2013-08-08 13:49:03 CST; 7min ago

5.reboot the host
#reboot

6.The guest was in shut off status while the host was rebooted completely,
However, i can see the guest's save img in /var/lib/libvirt/qemu/save

#systemctl status libvirt-guests.service
libvirt-guests.service - Suspend Active Libvirt Guests
   Loaded: loaded (/usr/lib/systemd/system/libvirt-guests.service; enabled)
   Active: active (exited) since Thu 2013-08-08 14:09:46 CST; 19s ago
 Main PID: 1558 (code=exited, status=0/SUCCESS)
   CGroup: name=systemd:/system/libvirt-guests.service

Aug 08 14:09:46 ibm-x3850x5-07.qe.lab.eng.nay.redhat.com systemd[1]: Started ...

#virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     rhel7qcow2                     shut off

# ll /var/lib/libvirt/qemu/save/
total 240600
-rw-------. 1 root root 246371606 Aug  8 14:05 rhel7qcow2.save

7.Domains without autostart can be resumed by the libvirt-guests script successfully while restart the libvirt-guests service in the host

8,It works well in rhel6

Actual results:
Domains without autostart can't be resumed by the libvirt-guests script after rebooting the host
Expected results:
should have the same result with the step7
Comment 2 dyuan 2013-08-09 05:44:13 EDT
Hi zhwang, can you reproduce it with restart libvirt-guests but not reboot host ?
Comment 3 zhenfeng wang 2013-08-09 05:58:57 EDT
hi dyuan, It works well with restart libvirt-guests, I wrote it in my description in step 7.
Comment 5 Pavel Hrdina 2014-07-09 07:40:20 EDT
Hi, could you please verify it with the latest libvirt? I've tried to reproduce it, but the guest started correctly after rebooting the host.

If it fails again, please include output of those commands:

  journalctl -n 100 -u libvirt-guests

  journalctl -n 100 -u libvirtd
Comment 6 zhenfeng wang 2014-07-10 02:24:22 EDT
Hi, I didn't reproduce the issue with the latest libvirt either, however, while i downgrade the libvirt to the libvirt-1.1.1-2.el7.x86_64, i can hit a similiar issue with the comment0 which the guest was in shut off status while the host was rebooted completely with the comment0's steps, but i can't see the guest's save img in /var/lib/libvirt/qemu/save. Maybe this issue has been fixed by the later libvirt packet.
Comment 7 Pavel Hrdina 2014-07-15 08:24:34 EDT
Moving to POST

https://www.redhat.com/archives/libvir-list/2014-February/msg01359.html
Comment 9 zhengqin 2014-08-26 03:09:00 EDT
Verify this issue with libvirt-1.2.7-1.el7.x86_64:


1.start a rhel7 guest without the autostart flag
#virsh start rhel7

2.Wait for the domains to fully boot up.

Conduct some operations in the guest, eg # ls.

3.Edit /etc/sysconfig/libvirt-guests, and set
ON_BOOT=start
ON_SHUTDOWN=suspend

4.Enable the libvirt-guests service in the host
#systemctl enable libvirt-guests.service


5.reboot the host
#reboot

6.The guest was in running status while the host was rebooted completely,
# virsh list
 Id    Name                           State
----------------------------------------------------
 2     rhel7                          running
Comment 10 zhengqin 2014-09-09 23:37:13 EDT
Verify with build libvirt-1.2.8-1.el7.x86_64 again:

1.start a rhel7 guest without the autostart flag
[root@rhel7-a1 ~]# virsh dominfo rhel7
Id:             -
Name:           rhel7
UUID:           2181c604-4b7a-4871-994e-352776f32ac0
OS Type:        hvm
State:          shut off
CPU(s):         2
Max memory:     1536000 KiB
Used memory:    0 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0

[root@rhel7-a1 ~]# virsh start rhel7
Domain rhel7 started


2.Wait for the domains to fully boot up.

Conduct some operations in the guest, eg # ls.


3.Edit /etc/sysconfig/libvirt-guests, and set
ON_BOOT=start
ON_SHUTDOWN=suspend


4.Enable the libvirt-guests service in the host
[root@rhel7-a1 ~]# systemctl enable libvirt-guests
[root@rhel7-a1 ~]# systemctl status libvirt-guests
libvirt-guests.service - Suspend Active Libvirt Guests
   Loaded: loaded (/usr/lib/systemd/system/libvirt-guests.service; enabled)
   Active: active (exited) since Tue 2014-09-09 23:23:53 EDT; 1s ago
     Docs: man:libvirtd(8)
           http://libvirt.org
  Process: 3757 ExecStart=/usr/libexec/libvirt-guests.sh start (code=exited, status=0/SUCCESS)
 Main PID: 3757 (code=exited, status=0/SUCCESS)


[root@rhel7-a1 ~]# virsh list
 Id    Name                           State
----------------------------------------------------
 2     rhel7                          running


5.reboot the host
[root@rhel7-a1 ~]# reboot ; exit
Connection to 10.66.5.231 closed by remote host.
Connection to 10.66.5.231 closed.


6.The guest was in running status and resumed while the host was rebooted completely,
[root@rhel7-a1 ~]# virsh list
 Id    Name                           State
----------------------------------------------------
 2     rhel7                          running

[root@rhel7-a1 ~]# ls /var/lib/libvirt/qemu/save/


no files in  /var/lib/libvirt/qemu/save/
Comment 11 vivian zhang 2014-12-04 04:24:07 EST
I can produce this issue on build libvirt-1.1.1-2.el7.x86_64

verify it on build 
libvirt-1.2.8-10.el7.x86_64
qemu-kvm-rhev-2.1.2-15.el7.x86_64

1. prepare a guest with running state with autostart disable
# virsh dominfo vm1
Id:             3
Name:           vm1
UUID:           30dbd1be-8704-4586-9d0f-b75cfe351565
OS Type:        hvm
State:          running
CPU(s):         1
CPU time:       2.2s
Max memory:     1048576 KiB
Used memory:    1048576 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c651,c715 (permissive)


2. enable libivrt-guest service

    systemctl enable libvirt-guests
    [root@server libvirt]# systemctl status libvirt-guests
    libvirt-guests.service - Suspend Active Libvirt Guests
    Loaded: loaded (/usr/lib/systemd/system/libvirt-guests.service; enabled)
    Active: active (exited) since Thu 2014-11-20 14:32:18 HKT; 12min ago
    Docs: man:libvirtd(8)
    http://libvirt.org
    Main PID: 4609 (code=exited, status=0/SUCCESS)
    CGroup: /system.slice/libvirt-guests.service

Nov 20 14:32:18 server.englab.nay.redhat.com systemd1: Started Suspend Active Libvirt Guests.

3. reboot host

4. after host start up completely, check guest status is running, login guest, it works well and keeps at the place where it left, check save file does not exist in /var/lib/libvirt/qemu/save

5. restart the libvirt-guests and repeat step4, get the same result
# systemctl restart libvirt-guests.service 
[root@intel-e31225-16-2 ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 3     vm1                            running

6. keep the guest in running and  autostart disable
# virsh start vm1
Domain vm1 started

# virsh dominfo vm1
Id:             6
Name:           vm1
UUID:           30dbd1be-8704-4586-9d0f-b75cfe351565
OS Type:        hvm
State:          running
CPU(s):         1
CPU time:       0.4s
Max memory:     1048576 KiB
Used memory:    1048576 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c150,c831 (permissive)

7. edit /etc/sysconf/libvirt-guests
ON_SHUTDOWN=suspend
ON_BOOT=ignore

8. restart the libvirt-guest service, check the guest in shutoff status, and save file exist 
#systemctl restart libvirt-guests

# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     vm1                            shut off

ll /var/lib/libvirt/qemu/save/
total 1281320
-rw-------. 1 root root 340276100 Dec  4 16:45 vm1.save

9. start the guest, works well and stay the place where it lefe
10. reboot the host and repeat step8 and 9 get the same result

11. edit /etc/sysconfig/libvirt-guests
ON_SHUTDOWN=shutdown
ON_BOOT=ignore

12.Restart the libvirt-guests service, check guest in shutoff and not save file exist in /var/lib/libvirt/qemu/save
#systemctl restart libvirt-guests
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     vm1                            shut off

# ll /var/lib/libvirt/qemu/save/

13. start guest, it initialize from a fresh start
14. reboot host and repeat step 12 and 13, get the same result


move to verified
Comment 13 errata-xmlrpc 2015-03-05 02:24:13 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0323.html

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