[pbs-devel] [SERIES proxmox-backup/proxmox/widget-toolkit 00/28] add removable datastore support

Hannes Laimer h.laimer at proxmox.com
Tue Jul 5 15:08:06 CEST 2022


Adds removable-device which has 
 * _unique_ 'name'
 * _unique_ 'uuid'
 * 'initialized': true if the chunkstore is already created on the
    device, if false, it will be created the next time it is mounted
 * 'store': the datastore the device is associated with, the path of the
    datastore will be used as a mountpoint for this removable-device

When a new datastore is created it has to be makred as 'removable', if
it is marked as removable the creation of the chunkstore is skipped.
After the creation a removable datastore has no remoavbale-devices
associated with with.

When creating a new removable-device a name, uuid and store have to be
provided, by default a removable device is not initialized. If a device
already contains a chunkstore (possibly created on a different PBS)
initialized has to be set to true.

Unmounting a removable-device puts the associated datastore in
'unplugged' maintenance mode, but it is only really unplugged after all
already started reading and writing operations to the datastore are
finished. The 'unplugged' maintenance mode prevents the start of reading
and writing operations to the datastore, the only way to change the
maintenance mode from 'unplugged' to something else is by mounting(not
mount, but through PBS) a removable-device associated with the
datastore.

Mounting a removable-device device
 1. if nothing else is already mounted there
  -> mount
  otherwise bail!
 2. if removable device has to be initialized
  -> create chunckstore
 3. maintenance mode is changed from 'unplugged' to none.

UI-wise this series adds icons specific to datastores that are marked as
removable, removable-devices behave very similar to sync/prune jobs in
the UI. One grid with all the removable-devices and a grid per datastore
only containing the removable-devices associated to the current
datastore.

Since the maintenance mode has to be changed 'in code' and not just
through the API, the print_property_string function is add to schema.

WIP:
 * list of jobs(per removable-device) that should be triggert when the removable-device
   is mounted mounted.

The patches for proxmox-backup depends on the changes in proxmox and in
proxmox-widget-toolkit. Version bump needed.
(patch 19 needs the changes in proxmox-widget-toolkit)
(patches >=6 need the changes in proxmox)

Since the maintenance mode has to be changed 'in code' and not just
through the API, the print_property_string function is add to schema.

* proxmox
Hannes Laimer (1):
  schema: add print_property_string function

 proxmox-schema/src/schema.rs | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)


* proxmox-widget-toolkit
Hannes Laimer (1):
  proxy: allow setting of reader config

 src/data/ProxmoxProxy.js | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)


* proxmox-backup
Hannes Laimer (26):
  api-types: add RemovableDeviceConfig
  config: make RemovableDeviceConfig savable to config file
  api-types: add "removable" field to DataStoreConfig
  api2: add config endpoints for RemovableDeviceConfig
  api-types: add "unplugged" maintenance type
  api-types: add set_maintenance_mode function to DataStoreConfig
  api2: datastore create: don't init chunkstore if removable
  tools: disks: add mount and unmount helper
  api2: admin: add unmount-device endpoint to datastore
  api2: admin: add mount-device and list endpoint for RemavableDevices
  tools: disks: add uuid to PrtitionInfo
  api-types: add "removable" to DataStoreListItem
  ui: utils: remove parseMaintenanceMode function
  ui: maintenance edit: disable description in maintenance edit if no
    type is selected
  ui: config: add RemovableDeviceView
  ui: add "no removable device present" mask to summary
  ui: add removable datastore specific icons to list
  ui: window: add RemovableDeviceEdit
  ui: form: add PartitionSelector
  ui: add "removable" checkbox to datastore edit
  ui: disable maintenance update while removable datastore is unplugged
  ui: datstore selector: add icon for removable datastores
  api2: admin: add mount-device endpoint that just takes an UUID
  cli: manager: add removable-device commands
  debian/etc: add udev rules and simple service for automounting
  api: mark all removable datastores as 'unplugged' after restart

 debian/proxmox-backup-server.install          |   1 +
 debian/proxmox-backup-server.udev             |   3 +
 etc/Makefile                                  |   3 +-
 etc/removable-device-attach at .service.in       |   6 +
 pbs-api-types/src/datastore.rs                |  26 ++
 pbs-api-types/src/lib.rs                      |   3 +
 pbs-api-types/src/maintenance.rs              |  16 +-
 pbs-api-types/src/removable_device.rs         |  79 +++++
 pbs-config/src/lib.rs                         |   1 +
 pbs-config/src/removable_device.rs            |  63 ++++
 pbs-datastore/src/datastore.rs                |   2 +-
 src/api2/admin/datastore.rs                   |  98 +++++-
 src/api2/admin/mod.rs                         |   6 +
 src/api2/admin/removable_device.rs            | 283 +++++++++++++++++
 src/api2/config/datastore.rs                  |  52 +++-
 src/api2/config/mod.rs                        |   2 +
 src/api2/config/removable_device.rs           | 284 ++++++++++++++++++
 src/bin/proxmox-backup-api.rs                 |  15 +
 src/bin/proxmox-backup-manager.rs             |   1 +
 src/bin/proxmox_backup_manager/mod.rs         |   2 +
 .../removable_device.rs                       | 209 +++++++++++++
 src/tools/disks/mod.rs                        |  27 +-
 www/Makefile                                  |   3 +
 www/NavigationTree.js                         |  19 +-
 www/Utils.js                                  |  27 +-
 www/config/RemovableDeviceView.js             | 211 +++++++++++++
 www/css/ext6-pbs.css                          |  29 ++
 www/datastore/DataStoreList.js                |   5 +
 www/datastore/Panel.js                        |   9 +
 www/datastore/Summary.js                      |  17 +-
 www/form/DataStoreSelector.js                 |   3 +
 www/form/PartitionSelector.js                 |  61 ++++
 www/window/DataStoreEdit.js                   |  10 +
 www/window/MaintenanceOptions.js              |  23 +-
 www/window/RemovableDeviceEdit.js             |  76 +++++
 35 files changed, 1614 insertions(+), 61 deletions(-)
 create mode 100644 etc/removable-device-attach at .service.in
 create mode 100644 pbs-api-types/src/removable_device.rs
 create mode 100644 pbs-config/src/removable_device.rs
 create mode 100644 src/api2/admin/removable_device.rs
 create mode 100644 src/api2/config/removable_device.rs
 create mode 100644 src/bin/proxmox_backup_manager/removable_device.rs
 create mode 100644 www/config/RemovableDeviceView.js
 create mode 100644 www/form/PartitionSelector.js
 create mode 100644 www/window/RemovableDeviceEdit.js

-- 
2.30.2






More information about the pbs-devel mailing list