]> git.proxmox.com Git - proxmox-backup.git/commit
api: tape: don't allow overwriting of ids in changer/drive config
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 6 Mar 2024 09:39:45 +0000 (10:39 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 24 Apr 2024 19:40:36 +0000 (21:40 +0200)
commita577114a21f11e3eb994b6fba691bb8b57582349
treefa2a27f335c6e0325e5d259fe17d2c957954c9bd
parent2e6a4a9d2896834420539fef1227a5d2e7686cbd
api: tape: don't allow overwriting of ids in changer/drive config

by checking the whole section config for an existing id, not only the
ones of the given type.

This prevents creation of a drive config with the same name as an
existing changer and vice versa, as it is confusing that existing things
get deleted, and we can get in the situation that we reference a changer
that does not exist anymore, i.e. consider this:

* create a changer with name `foo`
* create a drive with name `foo` and select changer `foo` for it

this would delete the changer config, but still reference it, leading
to errors when trying to use it.

We could implement support for separate id namespaces in section configs
for different types, but this is much more easier to do and be enough
for now.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/api2/config/changer.rs
src/api2/config/drive.rs