Bug 1177207

Summary: virt-manager cannot show the right state of guest on a remote xen host.
Product: Red Hat Enterprise Linux 7 Reporter: Ye Lingfei <liye>
Component: virt-managerAssignee: Giuseppe Scrivano <gscrivan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: gscrivan, juzhou, mzhan, tzheng
Target Milestone: rcKeywords: Regression, Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-manager-1.2.0-1-el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:23:08 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:
Attachments:
Description Flags
reproducer none

Description Ye Lingfei 2014-12-25 06:25:01 UTC
Description of problem:
virt-manager cannot show the right state of guest on a remote xen host.

Version-Release number of selected component (if applicable):
virt-manager-1.1.0-10.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1.Create a guest on a xen server(complete the installation) and start it.
2.Launch virt-manager on your host: #virt-manager.
3.Connect to a remote xen host
  ("File ->Add Connection ->Choose Xen for Hypervisor -> Click "connect to remote host"
  --> choose 'SSH' --> Input the hostname (eg:10.66.106.64)-->Click 'Connect'")
4.Input the password and the connect suceesfully.
5.Force off the running guest just created and the state shows 'Shut off'.
6.Run the guest just forced off.

Actual results:
After step 6, the state of the guest stays 'Shut off'.

Expected results:
After step 6, the state of the guest shows 'Running'.

Additional info:
On a rhel6 host, repeat the steps,
after step 6, the state of the guest shows 'Running'.

Comment 1 Ye Lingfei 2015-01-06 09:07:28 UTC
With virt-manager-0.10.0-20.el7(rhel-7.0 released), I cannot reproduce this problem.

Comment 4 Giuseppe Scrivano 2015-02-25 13:45:12 UTC
Created attachment 995215 [details]
reproducer

Comment 5 Giuseppe Scrivano 2015-02-25 15:10:41 UTC
it seems to be an issue in libvirt as it doesn't report correctly the domain status with as part of: virDomainInfo(domain)[0]

I have attached a small reproducer script, this is the output I get when I use it with KVM (to trigger the issue I just start and destroy a guest trough virsh) on Fedora 21:

$ python test.py
Using uri:qemu:///system
Info status event=2 detail=0 virDomainInfo[0]=1
Info status event=5 detail=1 virDomainInfo[0]=5
Info status event=2 detail=0 virDomainInfo[0]=1
Info status event=5 detail=1 virDomainInfo[0]=5
Info status event=2 detail=0 virDomainInfo[0]=1
Info status event=5 detail=1 virDomainInfo[0]=5
Info status event=2 detail=0 virDomainInfo[0]=1
Info status event=5 detail=1 virDomainInfo[0]=5

and the same script with XEN:

$ python test.py xen+ssh://root.106.64/
Using uri:xen+ssh://root.106.64/
Info status event=2 detail=0 virDomainInfo[0]=0
Info status event=5 detail=0 virDomainInfo[0]=5
Info status event=2 detail=0 virDomainInfo[0]=1
Info status event=5 detail=0 virDomainInfo[0]=5
Info status event=2 detail=0 virDomainInfo[0]=1
Info status event=5 detail=0 virDomainInfo[0]=5
Info status event=2 detail=0 virDomainInfo[0]=0
Info status event=5 detail=0 virDomainInfo[0]=5

virDomainInfo[0]=0 seems to be the issue here, as when the domain is started, the status reported by virDomainInfo is VIR_DOMAIN_NOSTATE instead of VIR_DOMAIN_RUNNING.

It was working with older versions of virt-manager, as virt-manager was continuously polling the status of the domains and after some time virDomainInfo[0] could return the correct status.

One solution could be to disable events and use the old polling for XEN HVs.  I will propose a patch upstream soon.

Comment 6 Giuseppe Scrivano 2015-02-25 15:34:55 UTC
patch proposed here:

https://www.redhat.com/archives/virt-tools-list/2015-February/msg00072.html

Comment 7 Giuseppe Scrivano 2015-02-26 10:19:58 UTC
and upstream now:

commit 64264e8fa2030021137457b6d65c94e743af11ca
Author: Giuseppe Scrivano <gscrivan>
Date:   Wed Feb 25 16:25:21 2015 +0100

    Disable domain events with XEN
    
    When XEN is used, disable domain events and use polling.
    
    On RHEL-5.9 virDomainInfo() seems to not report correctly the domain
    status when called immediately after the event is received.
    
    Solves: https://bugzilla.redhat.com/show_bug.cgi?id=1177207
    
    Signed-off-by: Giuseppe Scrivano <gscrivan>

Comment 10 fwu 2015-05-18 10:40:34 UTC
I can reproduce the bug with package:
virt-manager-1.1.0-10.el7.noarch

Try to verify the bug with new build:
virt-manager-1.2.0-3.el7.noarch

Steps:
1.Create a guest on a xen server(complete the installation) and start it.
2.Launch virt-manager on your host: #virt-manager.
3.Connect to a remote xen host
  ("File ->Add Connection ->Choose Xen for Hypervisor -> Click "connect to remote host"--> choose 'SSH' --> Input the hostname (eg:10.66.106.64)-->Click 'Connect'")
4.Input the password and the connect suceesfully.
5.Force off the running guest just created and the state shows 'Shut off'.
6.Run the guest just forced off.

Result:
After step 6, the state of the guest shows 'Running'.

According to the result above in the latest version of virt-manager, move this bug from ON_QA to VERIFIED.

Comment 12 errata-xmlrpc 2015-11-19 05:23:08 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/RHBA-2015-2206.html