[libvirt] [libvirt PATCH v3 0/4] Share cgroup code that is duplicated between QEMU and LXC

Fabiano Fidêncio fidencio at redhat.com
Thu Sep 13 07:48:10 UTC 2018


virLXCCgroupSetupBlkioTune() and qemuSetupBlkioCgroup() and
virLXCCgroupSetupCpuTune() and qemuSetupCpuCgroup() are the most similar
functions between QEMU and LXC code.

Let's move their common code to virCgroup.

Mind that the first two patches are basically preparing the ground for
the changes introduced in the last two patches.

I know that Pavel Hrdina suggested taking a different path[0] for this
series but I do believe Michal's and Jano's points are valid, thus I've
decided to just do the changes suggested by Michal (at least for now).

[0]: https://www.redhat.com/archives/libvir-list/2018-September/msg00534.html

changes since v1:
- Michal Privoznik pointed out (as did the `make syntax-check` :-)) that
  we do want to keep src/util independently of the parsing code (thus,
  including "conf/domain_conf.h" in vircgroup.h is not the way to go).
  This has been solved now by partially following Michal's suggestion
  and splitting the structs and functions that would be use in the
  common code to new different files.

changes since v2:
- Fixed `make syntax-check` errors that I've missed before (didn't have
  cppi installed);
- Created a new section in src/libvirt_private.syms to correctly export
  the virBlkioDeviceArrayClear symbol;
- Removed a virlkio.c from libvirt_setuid_rpc_client_la__SOURCES (why
  did I add it there in the first place? ;-))
- Explicitly included virmem.h in qemu_{domain,command}.c.
  Although there's nothing enforcing it, I do believe it's a good
  practive that should be followed and I've checked with Andrea and
  Peter about doing that and both agreed with the approach.


Fabiano Fidêncio (4):
  domain_conf: split out virBlkioDevice and virDomainBlkiotune
    definitions
  domain_conf: split out virDomainMemtune and virDomainHugePage
    definitions
  vircgroup: Add virCgroupSetupBlkioTune()
  vircgroup: Add virCgroupSetupMemTune()

 src/conf/domain_conf.c   | 22 ++++--------
 src/conf/domain_conf.h   | 70 +++----------------------------------
 src/libvirt_private.syms |  7 +++-
 src/lxc/lxc_cgroup.c     | 69 ++-----------------------------------
 src/qemu/qemu_cgroup.c   | 61 ++-------------------------------
 src/qemu/qemu_command.c  |  5 +--
 src/qemu/qemu_domain.c   |  3 +-
 src/util/Makefile.inc.am |  2 ++
 src/util/virblkio.c      | 37 ++++++++++++++++++++
 src/util/virblkio.h      | 52 ++++++++++++++++++++++++++++
 src/util/vircgroup.c     | 74 ++++++++++++++++++++++++++++++++++++++++
 src/util/vircgroup.h     |  5 +++
 src/util/virmem.h        | 66 +++++++++++++++++++++++++++++++++++
 13 files changed, 263 insertions(+), 210 deletions(-)
 create mode 100644 src/util/virblkio.c
 create mode 100644 src/util/virblkio.h
 create mode 100644 src/util/virmem.h

-- 
2.17.1

Subject: [libvirt PATCH v2 0/4] MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit





More information about the libvir-list mailing list