Bug 1160084

Summary: domfsfreeze and domfsthaw cannot work well when guest restart
Product: Red Hat Enterprise Linux 7 Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, mprivozn, mzhan, pkrempa, rbalakri, shyu, zhwang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.8-10.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 07:46:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Luyao Huang 2014-11-04 00:47:29 UTC
Description of problem:
domfsfreeze and domfsthaw cannot work well when guest restart

Version-Release number of selected component (if applicable):
libvirt-1.2.8-5.el7.x86_64
qemu-kvm-rhev-2.1.2-4.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.prepare a guest with agent
# virsh dumpxml test3
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/r6-7.agent'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='8'/>
    </channel>

2.# virsh start test3
Domain test3 started

3.# virsh domfsfreeze test3
Froze 1 filesystem(s)

4.restart guest
# virsh destroy test3
Domain test3 destroyed

# virsh start test3
Domain test3 started

5.guest will cannot be used domfsfreeze
# virsh domfsfreeze test3
error: Unable to freeze filesystems
error: Requested operation is not valid: domain is already quiesced

6.use domfsthaw
# virsh domfsthaw test3
Thawed 0 filesystem(s)

7.guest's fs can be froze again
# virsh domfsfreeze test3
Froze 1 filesystem(s)

Actual results:

guest's fs cannot be Froze after destroy and restart it.

Expected results:

After restart guest we can use domfsfreeze normal

Additional info:

Also found issue when use command reset migrate

Comment 1 Michal Privoznik 2014-11-04 14:44:57 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2014-November/msg00022.html

Comment 4 Luyao Huang 2014-11-27 01:06:24 UTC
During verify this bug, i found domfsfreeze cannot work well with save, managedsasve, migrate.


1.# virsh domfsfreeze test3
Froze 1 filesystem(s)

2.# virsh managedsave test3
Domain test3 state saved by libvirt

3.# virsh start test3
Domain test3 started

4.# virsh domfsfreeze test3
error: Unable to freeze filesystems
error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance

5.# virsh domfsfreeze test3
Froze 1 filesystem(s)

And i check the guest status via virt-manager, the guest fs is still freezed after restore it, but i can do domfsfreeze to it and get a error, the interesting thing is after this error guest fs have been thaw, i can use domfsfreeze to this guest again.

Comment 5 Luyao Huang 2014-11-27 01:10:35 UTC
Hi Michal,

I meet a issue during verify this bug(please see comment 4).

Would you please help me to check out if it is a issue need fix
in this bug? Or it is a another issue need open a new bug?

Thanks in advance for your answer.

Comment 6 Michal Privoznik 2014-11-27 12:29:39 UTC
(In reply to Luyao Huang from comment #5)
> Hi Michal,
> 
> I meet a issue during verify this bug(please see comment 4).
> 
> Would you please help me to check out if it is a issue need fix
> in this bug? Or it is a another issue need open a new bug?
> 
> Thanks in advance for your answer.

Yep, that's a libvirt issue. I've proposed patch here:

https://www.redhat.com/archives/libvir-list/2014-November/msg01043.html

Comment 8 Peter Krempa 2014-12-01 09:50:31 UTC
Fixed upstream by:

commit 6085d917d5c5839b7ed351e99fadbbb56f5178fe
Author: Michal Privoznik <mprivozn>
Date:   Thu Nov 27 11:43:56 2014 +0100

    qemu: Don't track quiesced state of FSs
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1160084
    
    As of b6d4dad11b (1.2.5) we are trying to keep the status of FSFreeze
    in the guest. Even though I've tried to fixed couple of corner cases
    (6ea54769ba18), it occurred to me just recently, that the approach is
    broken by design. Firstly, there are many other ways to talk to
    qemu-ga (even through libvirt) that filesystems can be thawed (e.g.
    qemu-agent-command) without libvirt noticing. Moreover, there are
    plenty of ways to thaw filesystems without even qemu-ga noticing (yes,
    qemu-ga keeps internal track of FSFreeze status). So, instead of
    keeping the track ourselves, or asking qemu-ga for stale state, it's
    the best to let qemu-ga deal with that (and possibly let guest kernel
    propagate an error).
    
    Moreover, there's one bug with the following approach, if fsfreeze
    command failed, we've executed fsthaw subsequently. So issuing
    domfsfreeze in virsh gave the following result:
    
    virsh # domfsfreeze gentoo
    Froze 1 filesystem(s)
    
    virsh # domfsfreeze gentoo
    error: Unable to freeze filesystems
    error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance
    
    virsh # domfsfreeze gentoo
    Froze 1 filesystem(s)
    
    virsh # domfsfreeze gentoo
    error: Unable to freeze filesystems
    error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance
    
    Signed-off-by: Michal Privoznik <mprivozn>

Comment 9 Shanzhi Yu 2014-12-04 09:10:31 UTC
I will change this bug to VERIFIED status after test with libvirt-1.2.8-10.el7.x86_64

After do domfsfreeze, then do save/managersave/migrate, it works as expected.
Steps refer to comment 0 and comment 4

Comment 11 errata-xmlrpc 2015-03-05 07:46:47 UTC
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