Bug 813226

Summary: get_state() does not work correctly when domain is shutdown
Product: Red Hat Enterprise Linux 6 Reporter: weizhang <weizhan>
Component: perl-Sys-VirtAssignee: Daniel Berrangé <berrange>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.3CC: dyuan, mzhan, rwu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-27 09:17:33 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:

Description weizhang 2012-04-17 09:26:36 UTC
Description of problem:
I find it when I test vm installation with perl-sys-virt, after vm finishing installing and shutdown, the perl function get_state() still show that the vm state is running; If I destroy the vm during installation, then get_state() show the vm state is blocked; If I then restart libvirtd, then get_state() will show that vm state is nostate

Version-Release number of selected component (if applicable):
perl-Sys-Virt-0.9.10-4.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. run script with perl-sys-virt
2.
3.
  
Actual results:
get_state() return confusing

Expected results:
get_state() can return the real vm state when domain is shutdown

Additional info:

Comment 2 Daniel Berrangé 2012-04-17 09:34:47 UTC
The 'get_state' function doesn't do anything special - it just calls into the virDomainGetState() C API. So if there is a flaw here, it is probably in the libvirt layer.

Can you try creating a simple demo in C that reproduces the problem, or see if 'virsh dominfo' shows the same behaviour

Comment 3 weizhang 2012-04-17 09:45:24 UTC
(In reply to comment #2)
> The 'get_state' function doesn't do anything special - it just calls into the
> virDomainGetState() C API. So if there is a flaw here, it is probably in the
> libvirt layer.
> 
> Can you try creating a simple demo in C that reproduces the problem, or see if
> 'virsh dominfo' shows the same behaviour

# virsh dominfo rhel6
Id:             -
Name:           rhel6
UUID:           8f7d7e4c-2c44-49f8-9c59-09b609b00ebd
OS Type:        hvm
State:          shut off
CPU(s):         1
Max memory:     1048576 kB
Used memory:    524288 kB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: selinux
Security DOI:   0

At the same time, run dom->get_state() return 0, which means nostate

Comment 4 RHEL Program Management 2012-05-03 05:11:01 UTC
Since RHEL 6.3 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.