• D
    src: introduce hypervisor/domain_cgroup.c · f1704e61
    Daniel Henrique Barboza 提交于
    There is duplicated code between virt drivers that needs to
    be moved to avoid code repetition. In the case of duplicated
    code between lxc_cgroup.c and qemu_cgroup.c a common place
    would be utils/vircgroup.c. The problem is that this would
    introduce /conf related definitions that shouldn't be imported
    to vircgroup.c, which is supposed to be a place for utilitary
    cgroups functions only. And syntax-check would forbid it anyway
    due to cross-directory includes being used.
    
    An alternative would be to overload domain_conf.c, which already
    contains all the definitions required. But that file is already
    crowded with XML handling code and we wouldn't do any favors to
    it by putting more utilitary, non-XML parsing/formatting code
    there.
    
    In [1], Cole suggested a 'domain_cgroup' file to host common code
    between lxc_cgroup and qemu_cgroup, and Daniel suggested a
    'src/hypervisor' dir to host these type of files. This patch
    introduces src/hypervisor/domain_cgroup.c and, to get started,
    introduces a new virDomainCgroupSetupBlkio() function to host shared
    code between virLXCCgroupSetupBlkioTune() and qemuSetupBlkioCgroup().
    
    [1] https://www.redhat.com/archives/libvir-list/2019-December/msg00817.htmlSigned-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
    Signed-off-by: NJán Tomko <jtomko@redhat.com>
    Reviewed-by: NJán Tomko <jtomko@redhat.com>
    f1704e61
qemu_cgroup.c 38.4 KB