[pve-devel] [PATCH storage v4 0/4] pbs: fix #5008: Check if datastore and namespace is valid on add- and update hooks

Philipp Hufnagl p.hufnagl at proxmox.com
Mon Nov 27 12:39:57 CET 2023


This adds a check if the datastore and the namespace is valid when a
user attempts to add a new PBS datastore.

Since the namespace only can be checked after the datastore is
validated, the datastore will be checked as well, regardless that it
will be done later in the superclass anyway.

The functionallity to check namespaces is added with this commit. For
checking the datastore, existing code that has previously been
refactored will be reused

Since the server address has was not included on for the on_update_hook,
I had to slightly modify src/PVE/API2/Storage/Config.pm. I checked and
are pretty sure that this modification does not break anything, however
a second look would be appreciated!

Signed-off-by: Philipp Hufnagl <p.hufnagl at proxmox.com>
---

Changes since v3:
 * Modify src/PVE/API2/Storage/Config.pm to add server address

Changes since v2:
 * Typos
 * reuse connecton on one more place previously fortotten
 * simplify syntax

Changes since v1:
 * do not add any overhead to activate_storage calls
 * splits code from activate_storage so parts of it can be reused
 * adds new methods to check namespaces
 * calls checks on add/update hooks

Philipp Hufnagl (4):
  pbs: Move pbs_api_connect earlyer in the code
  pbs: Make it possible to reuse PBS connection for datastore API call
  pbs: Extraxt check_datastore_exists from activate_storage
  pbs: fix #5008: Check if datastore and namespace is valid on add- and
    update hooks

 src/PVE/API2/Storage/Config.pm |   4 +-
 src/PVE/Storage/PBSPlugin.pm   | 122 +++++++++++++++++++++++----------
 2 files changed, 86 insertions(+), 40 deletions(-)

-- 
2.39.2






More information about the pve-devel mailing list