Bug 851452

Summary: unexpected result of virsh save when stop libvirtd
Product: Red Hat Enterprise Linux 6 Reporter: yanbing du <ydu>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, ajia, bili, dallan, dyasny, dyuan, mzhan, pkrempa, whuang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-0rc1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 07:21:56 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 yanbing du 2012-08-24 08:41:37 UTC
Description of problem:
When stop libvirtd service, then do virsh save domain, which get expected result.

Version-Release number of selected component (if applicable):
libvirt-0.10.0-0rc1.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.#service libvird stop
2.#virsh save $domain_name
3.
  
Actual results:
# virsh save test /tmp/test.save
error: Failed to reconnect to the hypervisor
error: failed to get domain 'test'
error: invalid connection pointer in virDomainLookupByName
error: Failed to reconnect to the hypervisor


Expected results:
error: Failed to reconnect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

Additional info:
All other virsh commands can get the expected result. Such as:

# virsh restore /tmp/test.sav
error: Failed to reconnect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

# virsh list
error: Failed to reconnect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

# virsh start test
error: Failed to reconnect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

Comment 2 Peter Krempa 2012-08-31 14:29:52 UTC
Pulling back to 6.4 as it's now fixed upstream with:

commit 67f83cd497f277775d7fa519176d0e89546d668b
Author: Peter Krempa <pkrempa>
Date:   Fri Aug 24 13:57:01 2012 +0200

    virsh: remove unneeded usage of vshConnectionUsability()
    
    Now that vshCommandRun() checks for the connection automaticaly, remove
    all of the redundant checks in the code.
    
    vshConnectionUsability() no longer needs to be exported and this patch
    marks it static.

commit 70e608918ebf4251ee7124184a0512b968a80035
Author: Peter Krempa <pkrempa>
Date:   Fri Aug 24 12:39:53 2012 +0200

    virsh: Improve checking for connection when running commands
    
    Almost each virsh command uses the function vshConnectionUsability
    before doing anything, to check if the connection is "alive".  Commands
    that don't need an conection are already conveniently marked with
    VSH_CMD_FLAG_NOCONNECT. We can automaticaly check for the connection
    before calling any remote command so we don't forget to do so.
    
    This patch also upgrades the connection check to use virConnectIsAlive
    along with the current approach.

Problem described by this bug was present in 4 commands that use threads to watch progress of a job. Commands in question were: "save", "managedsave", "migrate" and "dump.

Moving to POST.

Comment 6 EricLee 2012-09-04 02:03:41 UTC
(In reply to comment #2)
> 
> Problem described by this bug was present in 4 commands that use threads to
> watch progress of a job. Commands in question were: "save", "managedsave",
> "migrate" and "dump.
> 
> Moving to POST.

Hi Peter,

Do you mean when libvirtd was disconnected, those four commands getting the info:
error: Failed to reconnect to the hypervisor
error: failed to get domain 'test'
error: invalid connection pointer in virDomainLookupByName
error: Failed to reconnect to the hypervisor
is the expected result?

Because I am verifing the bug, but get the same result with bug description using the newest package, and not sure the bug was fixed or not.

Thanks.

Comment 7 Peter Krempa 2012-09-04 08:14:03 UTC
Hi Eric,
yes it isn't fixed in the version you're testing. This bug was mistakenly marked as MODIFIED/ON_QA so I'm moving it back to POST and clearing the fixed in version field.

Comment 8 EricLee 2012-09-20 07:10:30 UTC
Verifying the bug:

Reproduction:
-------------
Reproduced this issue in env below. 
# rpm -qa libvirt qemu-kvm-rhev; uname -r
libvirt-0.9.10-21.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.295.el6.x86_64
2.6.32-279.el6.x86_64

Steps:
# virsh list 
 Id    Name                           State
----------------------------------------------------
 2     qcow2                          running

# service libvirtd stop
Stopping libvirtd daemon:                                  [  OK  ]

# virsh save qcow2 /tmp/qcow2.save
error: Failed to reconnect to the hypervisor
error: failed to get domain 'qcow2'
error: invalid connection pointer in virDomainLookupByName
error: Failed to reconnect to the hypervisor

# virsh managedsave qcow2
error: Failed to reconnect to the hypervisor
error: failed to get domain 'qcow2'
error: invalid connection pointer in virDomainLookupByName
error: Failed to reconnect to the hypervisor

# virsh dump qcow2 /tmp/qcow.dump
error: Failed to reconnect to the hypervisor
error: failed to get domain 'qcow2'
error: invalid connection pointer in virDomainLookupByName
error: Failed to reconnect to the hypervisor

# virsh migrate --live qcow2 qemu+ssh://10.66.5.143/system --verbose
error: Failed to reconnect to the hypervisor
error: failed to get domain 'qcow2'
error: invalid connection pointer in virDomainLookupByName
error: Failed to reconnect to the hypervisor

Result:
All of above four commands get unexpected error messages.

Verification:
-------------
Verified in env below with same steps as above.
# rpm -qa libvirt qemu-kvm-rhev; uname -r
qemu-kvm-rhev-0.12.1.2-2.312.el6.x86_64
libvirt-0.10.2-0rc1.el6.x86_64
2.6.32-303.el6.x86_64

Steps:
# virsh start raw
Domain raw started

# service libvirtd stop
Stopping libvirtd daemon:                                  [  OK  ]

# virsh save raw /tmp/raw.save
error: Failed to reconnect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

# virsh managedsave raw
error: Failed to reconnect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

# virsh dump raw /tmp/raw.dump
error: Failed to reconnect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

# virsh migrate --live raw qemu+ssh://10.66.6.38/system --verboseerror: Failed to reconnect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory


Result:
Get same expected error message as other virsh commands.


Conclusion:
-----------
As per above, this bug has been fixed.

Moving to VERIFIED.

Comment 9 errata-xmlrpc 2013-02-21 07:21:56 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.

http://rhn.redhat.com/errata/RHSA-2013-0276.html