[pve-devel] [PATCH 00/11] Refactor QemuServer to avoid dependency cycles

Stefan Reiter s.reiter at proxmox.com
Mon Oct 28 11:36:32 CET 2019


First 3 patches are independant refactorings around get_host_arch.

Rest of the series refactors QemuServer and creates three new packages:
* 'PVE::QemuSchema' for schema related code and common directory creation
* 'PVE::QMP' for higher-level QMP functions
* 'PVE::QemuServer::Machine' for QEMU machine-type related helpers

This refactoring came along because qemu_machine_feature_enabled needs to be
used in 'PVE::QemuServer::CPUConfig', a new package that will be introduced with
my custom CPU series [0]. This would currently require dependency cycles, but by
extracting the code in this series and splitting it up into multiple helper
modules, this can be avoided.

Care was taken not to introduce new dependecy cycles, though this required to
move the 'check_running' function to QemuConfig.pm, where it doesn't *quite* fit
IMO, but I also didn't want to create a new module just for this one function.
Open for ideas ofc.

[0] https://pve.proxmox.com/pipermail/pve-devel/2019-October/039608.html

(@Thomas: I rebased the series just before sending to work with your cleanups)


common: Stefan Reiter (1):
  Make get_host_arch return raw uname entry

 src/PVE/Tools.pm | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

container: Stefan Reiter (1):
  Move LXC-specific architecture translation here

 src/PVE/LXC/Setup.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

qemu-server: Stefan Reiter (5):
  Use get_host_arch from PVE::Tools
  refactor: create QemuSchema and move file/dir code
  refactor: Move check_running to QemuConfig
  refactor: create PVE::QMP for high-level QMP access
  refactor: extract QEMU machine related helpers to package

 PVE/API2/Qemu.pm             |  45 +++---
 PVE/API2/Qemu/Agent.pm       |   7 +-
 PVE/CLI/qm.pm                |  27 ++--
 PVE/Makefile                 |   4 +-
 PVE/QMP.pm                   |  71 +++++++++
 PVE/QMPClient.pm             |   5 +-
 PVE/QemuConfig.pm            |  92 +++++++++--
 PVE/QemuMigrate.pm           |  27 ++--
 PVE/QemuSchema.pm            |  35 +++++
 PVE/QemuServer.pm            | 294 ++++-------------------------------
 PVE/QemuServer/Agent.pm      |   6 +-
 PVE/QemuServer/ImportDisk.pm |   3 +-
 PVE/QemuServer/Machine.pm    | 100 ++++++++++++
 PVE/QemuServer/Makefile      |   1 +
 PVE/QemuServer/Memory.pm     |  12 +-
 PVE/VZDump/QemuServer.pm     |  23 +--
 test/snapshot-test.pm        |  21 ++-
 17 files changed, 419 insertions(+), 354 deletions(-)
 create mode 100644 PVE/QMP.pm
 create mode 100644 PVE/QemuSchema.pm
 create mode 100644 PVE/QemuServer/Machine.pm

ha-manager: Stefan Reiter (2):
  refactor: check_running was moved to PVE::QemuConfig
  refactor: vm_qmp_command was moved to PVE::QMP

 src/PVE/HA/Resources/PVEVM.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

manager: Stefan Reiter (2):
  refactor: check_running was moved to QemuConfig
  refactor: vm_mon_cmd was moved to PVE::QMP

 PVE/API2/Nodes.pm       | 6 +++---
 PVE/Service/pvestatd.pm | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

-- 
2.20.1




More information about the pve-devel mailing list