From 53b9b9412a25db4ebd841e8e5fbf318f1c42dff3 Mon Sep 17 00:00:00 2001 From: hamistao Date: Tue, 11 Jun 2024 18:41:49 -0300 Subject: [PATCH] doc/source: Add documentation for added features Signed-off-by: hamistao --- doc/source/storage-pools.rst | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/doc/source/storage-pools.rst b/doc/source/storage-pools.rst index 02f61b8c..ff8f4897 100644 --- a/doc/source/storage-pools.rst +++ b/doc/source/storage-pools.rst @@ -137,10 +137,47 @@ following methods are available: changes to the LXD server. - `delete` - delete a storage volume object. Note that the object is, therefore, stale after this action. + - `restore` - Restore the volume from a snapshot using the snapshot name. .. note:: `raw_put` and `raw_patch` are availble (but not documented) to allow putting and patching without syncing the object back. +Storage Volume Snapshots +------------------------ + +Storage Volume Snapshots are represented as `StorageVolumeSnapshot` objects and +stored in `StorageVolume` objects and represent snapshots of custom storage volumes. +On the `pylxd` API they are accessed from a storage volume object that, in turn, +is accessed from a storage pool object: + +.. code:: Python + + storage_pool = client.storage_pools.get('pool1') + volumes = storage_pool.volumes.all() + custom_volume = storage_pool.volumes.get('custom', 'vol1') + volumes = custom_volume.snapshots.all() + a_snapshot = custom_volume.snapshots.get('snap0') + +Methods available on `.snapshots` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following methods are accessed from the `snapshots` attribute on the `StorageVolume` object: + + - `all` - Get all the snapshots of the storage volume. + - `get` - Get a single snapshot using its name. + - `create` - Take a snapshot on the current stage of the storage volume. The new snapshot's + name and expiration date can be set, default name is in the format "snapX". + - `exists` - Return a boolean for whether a storage volume snapshot exists, uses the snapshot name. + +Methods available on the storage snapshot object +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Once in possession of a storage volume snapshot object from the `pylxd` API, the +following methods are available: + + - `restore` - Restore the volume from the snapshot. + - `delete` - Delete a previously taken snapshot using its name. + .. links .. _LXD Storage Pools: https://documentation.ubuntu.com/lxd/en/latest/storage/