[pve-devel] [RFC ha-manager 0/8] move exec_resource_agent out from 'haenv' classes

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Jan 22 17:06:34 CET 2016


This patch series moves exec_resource_agent to the LRM, where it belongs and can
be tested against regression.

Some other small advantages:
 - possibility to add other test/simulation resources, for example a VM which
   fails to migrate three times, so we can test error over behaviour
 - tidier to add resources

To make this possible we introduce virtual resources, which are the equivalent of
the 'real' resource plugins, namely QEMU VM and LXC CT.

The last patch is where the move happens, the other ones are preparation work.
I tried to never break the build and functioning between two patches and
succeeded with that AFAIK.

Some notes to the single patches:

Patch 1:
This is only refactoring, we do not want all resource classes in one file,
with the though in mind that there will be more some times :)

Patch 2:
This let us check if a service migrate in an more abstract way,
see its commit message for more info.

Patch 3 and 4:
preparation work, needed for virtual resources

Patch 5:
Introduce the virtual resources, they implement the functionality which was
previously hardcoded for every resource in the Sim/Env class

Patch 6:
resource plugins must now be loaded through the environment class, lets us differ
between test/simulation and real world resources.

Patch 7:
This build up on the patch I send for pve-comnmon as we cannot use the upid_wait
from the PVE2 haenv class I thought it would be better to make it in a more
generic way if we had to change it.

Patch 8:
Move the exec_resource_agent method and integrate the preparation work.

I managed to do the whole thing without changing any regression test and yes I
checked if the new method is in use :-D


Thomas Lamprecht (8):
  Split up resources and move them to own sub folder
  introduce 'is_on_node' method to service plugins
  Env: add method to get hardware object
  add 'haenv' parameter to plugin method 'check_running'
  Add virtual resources for tests and simulation
  Env: add lookup_service_plugin method
  move upid_wait from PVE2 env to HA::Tools
  Move exec_resource_agent from environment classes to LRM

 src/PVE/HA/Config.pm               |   5 +-
 src/PVE/HA/Env.pm                  |  12 +-
 src/PVE/HA/Env/PVE2.pm             | 129 ++-------------------
 src/PVE/HA/LRM.pm                  | 115 ++++++++++++++++++-
 src/PVE/HA/Makefile                |   2 +
 src/PVE/HA/Resources.pm            | 224 +------------------------------------
 src/PVE/HA/Resources/Makefile      |  11 ++
 src/PVE/HA/Resources/PVECT.pm      | 118 +++++++++++++++++++
 src/PVE/HA/Resources/PVEVM.pm      | 120 ++++++++++++++++++++
 src/PVE/HA/Sim/Env.pm              | 106 ++----------------
 src/PVE/HA/Sim/Hardware.pm         |   9 ++
 src/PVE/HA/Sim/Makefile            |   3 +-
 src/PVE/HA/Sim/Resources.pm        | 119 ++++++++++++++++++++
 src/PVE/HA/Sim/Resources/Makefile  |   6 +
 src/PVE/HA/Sim/Resources/VirtCT.pm |  36 ++++++
 src/PVE/HA/Sim/Resources/VirtVM.pm |  20 ++++
 src/PVE/HA/Tools.pm                |  18 +++
 17 files changed, 613 insertions(+), 440 deletions(-)
 create mode 100644 src/PVE/HA/Resources/Makefile
 create mode 100644 src/PVE/HA/Resources/PVECT.pm
 create mode 100644 src/PVE/HA/Resources/PVEVM.pm
 create mode 100644 src/PVE/HA/Sim/Resources.pm
 create mode 100644 src/PVE/HA/Sim/Resources/Makefile
 create mode 100644 src/PVE/HA/Sim/Resources/VirtCT.pm
 create mode 100644 src/PVE/HA/Sim/Resources/VirtVM.pm

-- 
2.1.4





More information about the pve-devel mailing list