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

Integration test regression on LXD 4.0 #590

Closed
simondeziel opened this issue Jul 3, 2024 · 0 comments · Fixed by #594
Closed

Integration test regression on LXD 4.0 #590

simondeziel opened this issue Jul 3, 2024 · 0 comments · Fixed by #594
Assignees

Comments

@simondeziel
Copy link
Member

#584 introduced support for custom volume snapshot management and added additional tests. One of the additional tests now fails on LXD 4.0:

================================================================ FAILURES ================================================================
________________________________ TestStorageVolumeSnapshot.test_create_get_restore_delete_volume_snapshot ________________________________

self = <integration.test_storage.TestStorageVolumeSnapshot testMethod=test_create_get_restore_delete_volume_snapshot>

    def test_create_get_restore_delete_volume_snapshot(self):
        # Create pool and volume
        pool = self.create_storage_pool()
        self.addCleanup(self.delete_storage_pool, pool)
    
        volume = self.create_storage_volume(pool, "vol1")
        self.addCleanup(self.delete_storage_volume, pool, "vol1")
    
        # Create a few snapshots
>       first_snapshot = volume.snapshots.create()

integration/test_storage.py:153: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'pylxd.models.storage_pool.StorageVolumeSnapshot'>
volume = <pylxd.models.storage_pool.StorageVolume object at 0x786d535bad30>, name = None, expires_at = None

    @classmethod
    def create(cls, volume, name=None, expires_at=None):
        """Create new :class:`pylxd.models.StorageVolumeSnapshot` object from the current volume state using the given attributes.
    
        Implements POST /1.0/storage-pools/<pool>/volumes/custom/<volume_name>/snapshots
    
        :param volume: :class:`pylxd.models.StorageVolume` object that represents the target volume to take the snapshot from
        :type volume: :class:`pylxd.models.StorageVolume`
        :param name: Optional parameter. Name of the created snapshot. The snapshot will be called "snap{index}" by default.
        :type name: str
        :param expires_at: Optional parameter. Expiration time for the created snapshot in ISO 8601 format. No expiration date by default.
        :type name: str
        :returns: a storage volume snapshot if successful, raises an exception otherwise.
        :rtype: :class:`pylxd.models.StorageVolume`
        :raises: :class:`pylxd.exceptions.LXDAPIExtensionNotAvailable` if the
            'storage_api_volume_snapshots' api extension is missing.
        :raises: :class:`pylxd.exceptions.LXDAPIException` if the the operation fails.
        """
        volume.client.assert_has_api_extension("storage_api_volume_snapshots")
    
        response = volume.api.snapshots.post(
            json={"name": name, "expires_at": expires_at}
        )
    
        operation = volume.client.operations.wait_for_operation(
            response.json()["operation"]
        )
    
        # Extract the snapshot name from the response JSON in case it was not provided
        if not name:
>           name = operation.resources["storage_volume_snapshots"][0].split("/")[-1]
E           KeyError: 'storage_volume_snapshots'

pylxd/models/storage_pool.py:783: KeyError

An easy way to reproduce this is with ./integration/run-integration-tests-in-lxd focal.

The issue seems to be that LXD 4.0's operation data looks like this:

{'storage_volumes': ['/1.0/storage_volumes/vol1']}

While with a newer LXD, it looks like this:

{'storage_volume_snapshots': ['/1.0/storage-pools/tyg1/volumes/custom/vol1/snapshots/snap0'], 'storage_volumes': ['/1.0/storage-pools/tyg1/volumes/custom/vol1']}

Unfortunately, I couldn't trace any specific API extension related to the addition of the storage_volume_snapshots key.

simondeziel added a commit to simondeziel/lxd-ci that referenced this issue Jul 3, 2024
canonical/pylxd#590

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
simondeziel added a commit to simondeziel/lxd-ci that referenced this issue Jul 3, 2024
canonical/pylxd#590

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
simondeziel added a commit to simondeziel/lxd-ci that referenced this issue Jul 3, 2024
canonical/pylxd#590

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
simondeziel added a commit to simondeziel/lxd-ci that referenced this issue Jul 3, 2024
canonical/pylxd#590

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
hamistao pushed a commit to hamistao/lxd-ci that referenced this issue Jul 4, 2024
canonical/pylxd#590

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
simondeziel added a commit to simondeziel/lxd-ci that referenced this issue Oct 10, 2024
canonical/pylxd#590 is fixed.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
simondeziel added a commit to simondeziel/lxd-ci that referenced this issue Oct 11, 2024
canonical/pylxd#590 is fixed.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
simondeziel added a commit to simondeziel/lxd-ci that referenced this issue Oct 11, 2024
canonical/pylxd#590 is fixed.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
simondeziel added a commit to simondeziel/lxd-ci that referenced this issue Oct 15, 2024
canonical/pylxd#590 is fixed.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
hamistao pushed a commit to hamistao/lxd-ci that referenced this issue Nov 25, 2024
canonical/pylxd#590 is fixed.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
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 a pull request may close this issue.

2 participants