diff --git a/doc/source/storage-pools.rst b/doc/source/storage-pools.rst index 02f61b8c..76e2af7f 100644 --- a/doc/source/storage-pools.rst +++ b/doc/source/storage-pools.rst @@ -137,10 +137,48 @@ 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. + - `is_expired` - Return true if the snapshot is expired, false otherwise. + .. links .. _LXD Storage Pools: https://documentation.ubuntu.com/lxd/en/latest/storage/