- 23 2月, 2020 3 次提交
-
-
由 Daniel Henrique Barboza 提交于
lxcDomainMergeBlkioDevice() and qemuDomainMergeBlkioDevice() are the same functions. This duplicated code can't be put in the existing domain_cgroup.c since it's not cgroup related. This patch introduces a new src/hypervisor/domain_driver.c to host this more generic code that can be shared between virt drivers. This new file is then used to create a new helper called virDomainDeivceMergeBlkioDevice() to eliminate the code repetition mentioned above. Callers in LXC and QEMU files were updated. This change is a preliminary step for more code reduction of cgroup related code inside lxcDomainSetBlkioParameters() and qemuDomainSetBlkioParameters(). Signed-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>
-
由 Daniel Henrique Barboza 提交于
virLXCCgroupSetupMemTune() and qemuSetupMemoryCgroup() shares duplicated code that can be put in a new helper to avoid code repetition. Signed-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>
-
由 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>
-