Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce storage volume snapshots #584

Merged

Conversation

hamistao
Copy link
Contributor

@hamistao hamistao commented Jun 7, 2024

This add a few features related to custom storage volumes snapshots to pyLXD:

  1. Custom volume snapshot creation
  2. Custom volume edition (including renaming)
  3. Restoring a custom volume from a snapshot
  4. Custom volume snapshot deletion

The unit tests will be added in a later PR if necessary.
Scheduling was already supported since it is done through config key settings on the StorageVolume object.
This also does some refactoring on previously existing code and some other changes made necessary by the new features and tests.

Copy link
Member

@simondeziel simondeziel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for providing access to this early PR. I provided a few comments in this quick first glance.

integration/test_storage.py Outdated Show resolved Hide resolved
integration/test_storage.py Outdated Show resolved Hide resolved
integration/test_storage.py Outdated Show resolved Hide resolved
pylxd/models/storage_pool.py Outdated Show resolved Hide resolved
pylxd/models/storage_pool.py Show resolved Hide resolved
@simondeziel simondeziel marked this pull request as draft June 7, 2024 18:15
@hamistao
Copy link
Contributor Author

hamistao commented Jun 7, 2024

@simondeziel For now I ask to focus the comments on the functions' behaviors. I still have some work to do on comments, docstrings and user messages.

@hamistao hamistao changed the title Add basic usage for storage volume snapshots Introduce storage volume snapshots Jun 11, 2024
@hamistao hamistao force-pushed the storage_volume_snapshot_basic_usage branch 8 times, most recently from 02b1177 to d6feb45 Compare June 13, 2024 20:53
@hamistao hamistao force-pushed the storage_volume_snapshot_basic_usage branch 2 times, most recently from 82cb2df to d8cf378 Compare June 13, 2024 21:26
Copy link

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 51.16279% with 42 lines in your changes missing coverage. Please review.

Project coverage is 96.51%. Comparing base (afb1b84) to head (04b6680).
Report is 12 commits behind head on main.

Current head 04b6680 differs from pull request most recent head f9da9c1

Please upload reports for the commit f9da9c1 to get more accurate results.

Files Patch % Lines
pylxd/models/storage_pool.py 44.77% 37 Missing ⚠️
pylxd/models/_model.py 58.33% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #584      +/-   ##
==========================================
- Coverage   97.81%   96.51%   -1.31%     
==========================================
  Files          32       32              
  Lines        3073     3153      +80     
==========================================
+ Hits         3006     3043      +37     
- Misses         67      110      +43     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hamistao hamistao force-pushed the storage_volume_snapshot_basic_usage branch 14 times, most recently from 316e94d to f23163a Compare June 14, 2024 23:48
@hamistao hamistao force-pushed the storage_volume_snapshot_basic_usage branch from 4f1b06c to 7786743 Compare June 26, 2024 03:11
@hamistao hamistao marked this pull request as draft June 26, 2024 14:49
@hamistao hamistao force-pushed the storage_volume_snapshot_basic_usage branch 3 times, most recently from f60412f to d5b7f52 Compare July 1, 2024 05:36
@hamistao hamistao marked this pull request as ready for review July 1, 2024 05:36
@hamistao
Copy link
Contributor Author

hamistao commented Jul 1, 2024

@simondeziel @markylaing This is ready for review again.

Copy link
Member

@simondeziel simondeziel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc/source/storage-pools.rst Outdated Show resolved Hide resolved
doc/source/storage-pools.rst Show resolved Hide resolved
@hamistao hamistao force-pushed the storage_volume_snapshot_basic_usage branch from d5b7f52 to 444abde Compare July 2, 2024 08:53
new_description = "first snapshot"
first_snapshot.description = new_description
first_snapshot.save(wait=True)
self.assertEquals(volume.snapshots.get("first").description, new_description)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.assertEquals(volume.snapshots.get("first").description, new_description)
self.assertEqual(volume.snapshots.get("first").description, new_description)

This should address the following warning:

integration/test_storage.py::TestStorageVolumeSnapshot::test_create_get_restore_delete_volume_snapshot
  /home/runner/work/pylxd/pylxd/integration/test_storage.py:207: DeprecationWarning: Please use assertEqual instead.
    self.assertEquals(volume.snapshots.get("first").description, new_description)

Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
…ume`

Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
This class adds support for creating snapshots, restoring a volume from a snapshot, retrieving snapshot information and deleting a snapshot.

Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
This method returns True when two models are of the same class and have the same attributes with the same values.
This is needed for the StorageVolumeSnapshot tests.

Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
Signed-off-by: hamistao <pedro.ribeiro@canonical.com>
@hamistao hamistao force-pushed the storage_volume_snapshot_basic_usage branch from 444abde to f9da9c1 Compare July 2, 2024 13:03
@simondeziel simondeziel merged commit 46b58e6 into canonical:main Jul 2, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants