[Libvir] VIR_DOMAIN_NOSTATE

Daniel P. Berrange berrange at redhat.com
Tue Jan 29 18:15:35 UTC 2008


On Tue, Jan 29, 2008 at 10:01:35AM -0800, Russ Blaine wrote:
> Daniel P. Berrange wrote:
> >Can you edit the src/xen_internal.c file and in the 
> >xenHypervisorGetDomInfo()
> >method, add a printf() for the 'domain_flags' flags variable.  IMHO the
> >way we deal with this isn't quite correct. We merely mask out the high 
> >bits and then switch on the resulting value. This isn't the way the Xen
> >hypervisor uses this field though. Xen more or less uses the whole thing
> >as as bitmask, allowing near arbitrary combinations of bits to be set.
> >So I think what is happening is there's a combo of bits set which cause
> >the switch() statement to fail all cases, resulting in NOSTATE.
> >
> >We'll probably need to replace the switch(domain_flags) with something 
> >which explicitly tests for the bits we're interested in, rather than
> >looking at the value as a whole.
> 
> when xenHypervisorGetDomInfo() returns VIR_DOMAIN_NONE, domain_flags is 0 
> (sampled after the HVM bit has been masked out). So is there some other 
> state implied by domain_flags being 0? In all cases I have seen, the domain 
> is actually running -- accumulating CPU time, etc.

What hypervisor version are you running. I'm struggling to see the codepath
in the hypervisor 'getdomaininfo' call which could lead to domain_flags
being zero.  AFAICT, as well as the HVM flags, there must always be at
least one other bit set.

    int flags = XEN_DOMINF_blocked;

    for_each_vcpu ( d, v )
    {
        ....
        if ( !test_bit(_VPF_down, &v->pause_flags) )
        {
            if ( !(v->pause_flags & VPF_blocked) )
                flags &= ~XEN_DOMINF_blocked;
            if ( v->is_running )
                flags |= XEN_DOMINF_running;
            info->nr_online_vcpus++;
        }
    }

Guarenteed either  XEN_DOMINF_blocked or XEN_DOMINF_running is
set now. 

And this next block, simply sets a few more bits

    info->flags = flags |
        ((d->is_dying == DOMDYING_dead) ? XEN_DOMINF_dying    : 0) |
        (d->is_shut_down                ? XEN_DOMINF_shutdown : 0) |
        (d->is_paused_by_controller     ? XEN_DOMINF_paused   : 0) |
        (d->debugger_attached           ? XEN_DOMINF_debugged : 0) |
        d->shutdown_code << XEN_DOMINF_shutdownshift;

    if ( is_hvm_domain(d) )
        info->flags |= XEN_DOMINF_hvm_guest;

This is all in getdomaininfo, from xen/common/domctl.c

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list