Skip to content

Commit

Permalink
doc/source: Add documentation for added features
Browse files Browse the repository at this point in the history
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
  • Loading branch information
hamistao committed Jun 12, 2024
1 parent 85a8ba2 commit 02b1177
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions doc/source/storage-pools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<storage_volume_object>.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/
Expand Down

0 comments on commit 02b1177

Please sign in to comment.