[pbs-devel] [PATCH proxmox-backup] api: add dedicated datastore disk schema

Christian Ebner c.ebner at proxmox.com
Wed Nov 29 09:24:39 CET 2023


> On 28.11.2023 18:49 CET Thomas Lamprecht <t.lamprecht at proxmox.com> wrote:
> 
>  
> Am 28/11/2023 um 16:25 schrieb Christian Ebner:
> > Introduce a dedicated datastore disk schema for disks, to semantically
> > distinguish between datastore name and datastore disk name.
> > 
> > Further, adapt the systemd mount unit description accordingly.
> > 
> > Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> > ---
> >  pbs-api-types/src/datastore.rs         |  6 ++++++
> >  src/api2/node/disks/directory.rs       |  8 ++++----
> >  src/api2/node/disks/zfs.rs             |  4 ++--
> >  src/bin/proxmox_backup_manager/disk.rs | 10 +++++-----
> >  4 files changed, 17 insertions(+), 11 deletions(-)
> > 
> > diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
> > index 1f619c9d..4150c6c6 100644
> > --- a/pbs-api-types/src/datastore.rs
> > +++ b/pbs-api-types/src/datastore.rs
> > @@ -102,6 +102,12 @@ pub const DATASTORE_SCHEMA: Schema = StringSchema::new("Datastore name.")
> >      .max_length(32)
> >      .schema();
> >  
> > +pub const DATASTORE_DISK_SCHEMA: Schema = StringSchema::new("Datastore disk name.")
> > +    .format(&PROXMOX_SAFE_ID_FORMAT)
> > +    .min_length(3)
> > +    .max_length(32)
> > +    .schema();
> > +
> 
> this is not really helping me, while that might be because its late, I also think
> that this needs a different name, as what is a datastore-disk here actually?

The intention was to distinguish between the datastore itself and the disk, on which the datastore might be created upon, as these are 2 independent entities. Most of the time they will be referred to by the same name, as e.g. created by `proxmox-backup-manager disk fs create foo --disk sdd --add-datastore true`.

I choose to refer to this as `datastore disk` as that is what the API methods in src/api2/node/disks/directory.rs are called.

Unfortunately, that does not really match up with ZFS, as there the name refers to the zpool.




More information about the pbs-devel mailing list