mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-23 14:50:24 +00:00
e2e: detect support for VolumeGroupSnapshot in librbd
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
b59a701777
commit
c451997762
@ -4857,6 +4857,14 @@ var _ = Describe("RBD", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
By("test volumeGroupSnapshot", func() {
|
By("test volumeGroupSnapshot", func() {
|
||||||
|
supported, err := librbdSupportsVolumeGroupSnapshot(f)
|
||||||
|
if err != nil {
|
||||||
|
framework.Failf("failed to check for VolumeGroupSnapshot support: %v", err)
|
||||||
|
}
|
||||||
|
if !supported {
|
||||||
|
Skip("librbd does not support required VolumeGroupSnapshot function(s)")
|
||||||
|
}
|
||||||
|
|
||||||
scName := "csi-rbd-sc"
|
scName := "csi-rbd-sc"
|
||||||
snapshotter, err := newRBDVolumeGroupSnapshot(f, f.UniqueName, scName, false, deployTimeout, 3)
|
snapshotter, err := newRBDVolumeGroupSnapshot(f, f.UniqueName, scName, false, deployTimeout, 3)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -693,6 +693,28 @@ func validateEncryptedFilesystem(f *framework.Framework, rbdImageSpec, pvName, a
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// librbdSupportsVolumeGroupSnapshot checks for the rbd_group_snap_get_info in
|
||||||
|
// librbd.so.* in a ceph-csi container. If this function is available,
|
||||||
|
// VolumeGroupSnapshot support is available.
|
||||||
|
func librbdSupportsVolumeGroupSnapshot(f *framework.Framework) (bool, error) {
|
||||||
|
selector, err := getDaemonSetLabelSelector(f, cephCSINamespace, rbdDaemonsetName)
|
||||||
|
if err != nil {
|
||||||
|
return false, fmt.Errorf("failed to get labels: %w", err)
|
||||||
|
}
|
||||||
|
opt := metav1.ListOptions{
|
||||||
|
LabelSelector: selector,
|
||||||
|
}
|
||||||
|
|
||||||
|
// run a shell command (to expand the * in the filename), return 0 on stdout when successful
|
||||||
|
cmd := "sh -c 'grep -q rbd_group_snap_get_info /lib64/librbd.so.*; echo $?'"
|
||||||
|
stdout, _, err := execCommandInContainer(f, cmd, cephCSINamespace, "csi-rbdplugin", &opt)
|
||||||
|
if err != nil {
|
||||||
|
return false, fmt.Errorf("error checking for rbd_group_snap_get_info in /lib64/librbd.so.*: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.TrimSpace(stdout) == "0", nil
|
||||||
|
}
|
||||||
|
|
||||||
func listRBDImages(f *framework.Framework, pool string) ([]string, error) {
|
func listRBDImages(f *framework.Framework, pool string) ([]string, error) {
|
||||||
var imgInfos []string
|
var imgInfos []string
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user