[Libvir] virsh start problem + patch

Daniel P. Berrange berrange at redhat.com
Tue Mar 11 16:14:04 UTC 2008

On Tue, Mar 11, 2008 at 06:57:33AM +0100, Toth Istvan wrote:
> # virsh list --all
> Id Name                 State
> ----------------------------------
>  0 Domain-0             running
>  - windows-xen          shut off
>  - windows-xen2         no state
> # xm list
> Name                                        ID   Mem VCPUs      State   
> Time(s)
> Domain-0                                     0  3489     4     r-----    
> 853.6
> windows-xen                                  1   512     0     
> -b-s-d     39.4
> windows-xen2                                 4   512     0     
> ------     22.5
> The windows-xen, and windows-xen2 domains  were installed the very same 
> way, except I've had a Dom0 reboot since I've installed windows-xen, so 
> xen has had the opportunity to sort it's state out, whil the 
> windows-xen2 domain is a fresh install. Starting and stopping (by xm) a 
> freshly installed windows hvm domain does not sort out the state, only a 
> Dom0 reboot (or  a xend restart) does.
> I have attached the output of xm list --long command.

This shows that it is all XenD related - inactive domains should *not*
have a 'domid' or 'state' field set in the 'xm list --long' output. In
both your windows-xen & windows-xen2 VM, these fields are incorrectly

> This problem indeed does look like a Xend bug, but it turns out that it 
> does not actually affect virsh. (It does affect virt-manager, as I've 
> written to the other list)

> The other problem is I am pretty sure, a virsh logic bug, and is 
> independent of the first one.

No, it is again a Xen bug. Inactive domains are *mandated* to have a
domain ID of -1.  They do not exist in the hypervisor anymore and thus
have no domain ID associated with them. If XenD is not clearing the
domain ID properly this is a XenD problem.

That all said, we may need to workaround this XenD brokenness in the
libirt XenD driver. Working around it in virsh is the wrong place.

> and I get this:
> ./virsh start windows-xen
> <warnings>
> error: Domain is already active
> virDomainGetID(dom) returns 1
> ./virsh start windows-xen2
> <warnings>
> error: Domain is already active
> virDomainGetID(dom) returns 3
> so virDomainGetID() does not return -1, but returns the actual xen 
> domain id of the managed, but inactive xen domain, and I believe this is 
> what it should do,
> as it's job is not to tell us about the state of the domain, but to tell 
> the id of the domain, regardles of its state.

No. Inactive domains are mandated to have an ID of -1.

|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

More information about the libvir-list mailing list