Skip to content

Commit

Permalink
[lxd-import] test/suites: Add cephfs create_missing test
Browse files Browse the repository at this point in the history
Signed-off-by: Max Asnaashari <max.asnaashari@canonical.com>
  • Loading branch information
masnax authored and stgraber committed Nov 29, 2023
1 parent 00d830f commit 47e00d4
Showing 1 changed file with 54 additions and 30 deletions.
84 changes: 54 additions & 30 deletions test/suites/storage_driver_cephfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,58 @@ test_storage_driver_cephfs() {
incus storage create cephfs cephfs source="${INCUS_CEPH_CEPHFS}/$(basename "${INCUS_DIR}")"
incus storage delete cephfs

# Second create (confirm got cleaned up properly)
incus storage create cephfs cephfs source="${INCUS_CEPH_CEPHFS}/$(basename "${INCUS_DIR}")"
incus storage info cephfs

# Creation, rename and deletion
incus storage volume create cephfs vol1
incus storage volume set cephfs vol1 size 100MiB
incus storage volume rename cephfs vol1 vol2
incus storage volume copy cephfs/vol2 cephfs/vol1
incus storage volume delete cephfs vol1
incus storage volume delete cephfs vol2

# Snapshots
incus storage volume create cephfs vol1
incus storage volume snapshot create cephfs vol1
incus storage volume snapshot create cephfs vol1
incus storage volume snapshot create cephfs vol1 blah1
incus storage volume snapshot rename cephfs vol1 blah1 blah2
incus storage volume snapshot create cephfs vol1 blah1
incus storage volume snapshot delete cephfs vol1 snap0
incus storage volume snapshot delete cephfs vol1 snap1
incus storage volume snapshot restore cephfs vol1 blah1
incus storage volume copy cephfs/vol1 cephfs/vol2 --volume-only
incus storage volume copy cephfs/vol1 cephfs/vol3 --volume-only
incus storage volume delete cephfs vol1
incus storage volume delete cephfs vol2
incus storage volume delete cephfs vol3

# Cleanup
incus storage delete cephfs
# Test invalid key combinations for auto-creation of cephfs entities.
! incus storage create cephfs cephfs source="${INCUS_CEPH_CEPHFS}/$(basename "${INCUS_DIR}")" cephfs.osd_pg_num=32 || true
! incus storage create cephfs cephfs source="${INCUS_CEPH_CEPHFS}/$(basename "${INCUS_DIR}")" cephfs.meta_pool=xyz || true
! incus storage create cephfs cephfs source="${INCUS_CEPH_CEPHFS}/$(basename "${INCUS_DIR}")" cephfs.data_pool=xyz || true
! incus storage create cephfs cephfs source="${INCUS_CEPH_CEPHFS}/$(basename "${INCUS_DIR}")" cephfs.create_missing=true cephfs.data_pool=xyz_data cephfs.meta_pool=xyz_meta || true


# Test cephfs storage volumes.
for fs in "cephfs" "cephfs2" ; do
if [ "${fs}" = "cephfs" ]; then
# Create one cephfs with pre-existing OSDs.
incus storage create "${fs}" cephfs source="${INCUS_CEPH_CEPHFS}/$(basename "${INCUS_DIR}")"
else
# Create one cephfs by creating the OSDs and the cephfs itself.
incus storage create "${fs}" cephfs source=cephfs2 cephfs.create_missing=true cephfs.data_pool=xyz_data cephfs.meta_pool=xyz_meta
fi

# Confirm got cleaned up properly
incus storage info "${fs}"

# Creation, rename and deletion
incus storage volume create "${fs}" vol1
incus storage volume set "${fs}" vol1 size 100MiB
incus storage volume rename "${fs}" vol1 vol2
incus storage volume copy "${fs}"/vol2 "${fs}"/vol1
incus storage volume delete "${fs}" vol1
incus storage volume delete "${fs}" vol2

# Snapshots
incus storage volume create "${fs}" vol1
incus storage volume snapshot create "${fs}" vol1
incus storage volume snapshot create "${fs}" vol1
incus storage volume snapshot create "${fs}" vol1 blah1
incus storage volume snapshot rename "${fs}" vol1 blah1 blah2
incus storage volume snapshot create "${fs}" vol1 blah1
incus storage volume snapshot delete "${fs}" vol1 snap0
incus storage volume snapshot delete "${fs}" vol1 snap1
incus storage volume snapshot restore "${fs}" vol1 blah1
incus storage volume copy "${fs}"/vol1 "${fs}"/vol2 --volume-only
incus storage volume copy "${fs}"/vol1 "${fs}"/vol3 --volume-only
incus storage volume delete "${fs}" vol1
incus storage volume delete "${fs}" vol2
incus storage volume delete "${fs}" vol3

# Cleanup
incus storage delete "${fs}"

# Remove the filesystem so we can create a new one.
ceph fs fail "${fs}"
ceph fs rm "${fs}" --yes-i-really-mean-it
done

# Recreate the fs for other tests.
ceph fs new cephfs cephfs_meta cephfs_data --force
}

0 comments on commit 47e00d4

Please sign in to comment.