[libvirt] [PATCH 0/2] Resolve issues seen with schedinfo

John Ferlan jferlan at redhat.com
Thu May 30 12:24:58 UTC 2013


These patches resolve an issue seen using 'virsh schedinfo <domain>' on a
non running domain that have been present since 1.0.4 as a result of the
cgroup infrastructure changes:

https://www.redhat.com/archives/libvir-list/2013-April/msg00783.html

The exact commit id that caused the issue is listed in each of the commit
messages.  I used git bisect to determine, although it was tricky because
the TPM changes were made around the same time and required commit '8b934a5c'
to be applied in order to actually see domains on my host.

Prior to the changes the "CFS Bandwidth" data provided by qemuGetCpuBWStatus()
and lxcGetCpuBWStatus() would be obtained as a result of the driver cgroup
being mounted. Now it relies on the domain cgroup being mounted which only
occurs once the domain is active.

This issue also affects the libvirt-cim code in how it defines QEMU domains.
Fortunately it only looks for the "cpu_shares" value.

A "downside" to the end result of these changes is that for a non-running
domain it becomes impossible to obtain the vcpu_period, vcpu_quota,
emulator_period, and emulator_quota values. All that can be obtained is
the 'cpu_shares" value. As an option, I did consider adding the following to
either [qemu|lxc]DomainSchedulerGetType() and DomainSchedulerParameter[Flags]()
or just [qemu|lxc]GetCpuBWStatus() APIs in order to get the "host" values if
they existed (since they are eventually copied into the domain cgroup):

    if (cgroup == NULL) {
        rc = virCgroupNewSelf(&hostgrp);
        if (rc < 0) {   
            virReportSystemError(-rc, "%s",
                                 _("Unable to get schedinfo host cgroup"));
            goto cleanup;                           
        }                                                   
        cgroup = hostgrp;       
    }                               

However, I wasn't sure going that route was desired and figured that I'd
use the code review opportunity to get the answer. Furthermore, it wasn't
clear that the vcpu_* and emulator_* values made sense for a non running
domain. Also, the virReportSystemError may need to change to a VIR_INFO
since I believe it would be triggered if cgroups weren't mounted on the system.

Another option would be to just add the above code to the GetType() APIs and
then ignore the 'cpu_bw_status' for the VIR_DOMAIN_AFFECT_CONFIG path in
the ParametersFlags() APIs thus returning all 5 datapoints set to whatever
the persistentDef had defined.

Since this has been present since 1.0.4 and no one has complained so far, I
don't think it's critical for 1.0.6. I suspect the change would need to into
the maint trees though. It might be nice to get DanB's opinion on this too.

John Ferlan (2):
  qemu: Resolve issue with virsh schedinfo for non running domain
  lxc: Resolve issue with virsh schedinfo for non running domain

 src/lxc/lxc_driver.c   |  9 ++++++++-
 src/qemu/qemu_driver.c | 11 ++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

-- 
1.8.1.4




More information about the libvir-list mailing list