]> git.proxmox.com Git - pve-storage.git/commit - PVE/API2/Storage/Config.pm
add on_add and on_delete hooks
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 2 Jul 2018 13:54:44 +0000 (15:54 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 3 Jul 2018 10:27:34 +0000 (12:27 +0200)
commit3932ca0d1ba87cd75b0deba9622a5880c98ee10f
tree3e1a2986df97329db5c6bc75739590db43e236c4
parentd7b707626a59be15520dd2179a84285c56d309c7
add on_add and on_delete hooks

on_add_hook allows to encapsulate storage specific add steps, like
copying a keyring (RDB) or creating a volume group (LVM) in a clean
manner.
The same for deletion with on_delete_hook, here all should be cleaned
up, as much as possible.

Until now, this was done directly in the api config CREATE and DELETE
code, respectively, with a series of

if ($storage_type eq 'foo) {
    ...
} elsif ($storage_type eq 'bar') {
    ...
}

which isn't really that nice...

Another nice result of this approach is that also external plugins
can use those hooks and to their setup/cleanup steps sanely.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/API2/Storage/Config.pm
PVE/Storage/Plugin.pm