[pve-devel] [PATCH storage 0/5] adding hooks for storage addition and deletion

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Jul 2 15:54:43 CEST 2018


Motivated by the storage specific code in the Config API module used to set
things up when adding a storage, and cleaning up when deleting one this
series came to life.

Add two hooks, on_add_hook and on_delete_hook, which are called in the
create (i.e., add) storage config and delete storage config calls.
They run in locked context but before the updated storage configuration was
actually written out.

This allows to move the storage specific code to it's plugin, which improves
encapsulation and simplifies error handling a bit. External Plugins can also
profit from this change.

While this may even be applied as is, the interface could still be
discussed.

Thomas Lamprecht (5):
  add on_add and on_delete hooks
  cifs: use add/delete hooks
  rbd: use add/delete hooks
  lvm: use add hook
  api add: remove now uneeded $cred_file variable

 PVE/API2/Storage/Config.pm | 57 ++++----------------------------------
 PVE/Storage/CIFSPlugin.pm  | 17 ++++++++++++
 PVE/Storage/LVMPlugin.pm   | 22 +++++++++++++++
 PVE/Storage/Plugin.pm      | 20 +++++++++++++
 PVE/Storage/RBDPlugin.pm   | 34 +++++++++++++++++++++++
 5 files changed, 99 insertions(+), 51 deletions(-)

-- 
2.17.1





More information about the pve-devel mailing list