cephfs admin: remove subvolumegroup snapshot support

Apparently, this feature is being removed from all active ceph versions
and will not be present in future versions. Since we won't be able to
test it any more, and the api is provisional still, we just remove it
entirely.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-10-26 10:04:02 -04:00 committed by John Mulligan
parent dbd5b9361c
commit 55821a9300
2 changed files with 0 additions and 137 deletions

View File

@ -103,59 +103,3 @@ func (fsa *FSAdmin) SubVolumeGroupPath(volume, name string) (string, error) {
}
return parsePathResponse(fsa.marshalMgrCommand(m))
}
// CreateSubVolumeGroupSnapshot creates a new snapshot from the source subvolume group.
//
// Similar To:
// ceph fs subvolumegroup snapshot create <volume> <group> <name>
func (fsa *FSAdmin) CreateSubVolumeGroupSnapshot(volume, group, name string) error {
m := map[string]string{
"prefix": "fs subvolumegroup snapshot create",
"vol_name": volume,
"group_name": group,
"snap_name": name,
"format": "json",
}
return fsa.marshalMgrCommand(m).noData().End()
}
// RemoveSubVolumeGroupSnapshot removes the specified snapshot from the subvolume group.
//
// Similar To:
// ceph fs subvolumegroup snapshot rm <volume> <group> <name>
func (fsa *FSAdmin) RemoveSubVolumeGroupSnapshot(volume, group, name string) error {
return fsa.rmSubVolumeGroupSnapshot(volume, group, name, rmFlags{})
}
// ForceRemoveSubVolumeGroupSnapshot removes the specified snapshot from the subvolume group.
//
// Similar To:
// ceph fs subvolumegroup snapshot rm <volume> <group> <name> --force
func (fsa *FSAdmin) ForceRemoveSubVolumeGroupSnapshot(volume, group, name string) error {
return fsa.rmSubVolumeGroupSnapshot(volume, group, name, rmFlags{force: true})
}
func (fsa *FSAdmin) rmSubVolumeGroupSnapshot(volume, group, name string, o rmFlags) error {
m := map[string]string{
"prefix": "fs subvolumegroup snapshot rm",
"vol_name": volume,
"group_name": group,
"snap_name": name,
"format": "json",
}
return fsa.marshalMgrCommand(o.Update(m)).noData().End()
}
// ListSubVolumeGroupSnapshots returns a listing of snapshots for a given subvolume group.
//
// Similar To:
// ceph fs subvolumegroup snapshot ls <volume> <group>
func (fsa *FSAdmin) ListSubVolumeGroupSnapshots(volume, group string) ([]string, error) {
m := map[string]string{
"prefix": "fs subvolumegroup snapshot ls",
"vol_name": volume,
"group_name": group,
"format": "json",
}
return parseListNames(fsa.marshalMgrCommand(m))
}

View File

@ -119,84 +119,3 @@ func TestSubVolumeGroupPath(t *testing.T) {
assert.Error(t, err)
assert.Equal(t, "", path)
}
func TestSubVolumeGroupSnapshots(t *testing.T) {
fsa := getFSAdmin(t)
volume := "cephfs"
group := "bathyscaphe"
subname := "trieste"
snapname1 := "ns1"
snapname2 := "ns2"
err := fsa.CreateSubVolumeGroup(volume, group, nil)
assert.NoError(t, err)
defer func() {
err := fsa.RemoveSubVolumeGroup(volume, group)
assert.NoError(t, err)
}()
svopts := &SubVolumeOptions{
Mode: 0750,
Size: 20 * gibiByte,
}
err = fsa.CreateSubVolume(volume, group, subname, svopts)
assert.NoError(t, err)
defer func() {
err := fsa.RemoveSubVolume(volume, group, subname)
assert.NoError(t, err)
}()
t.Run("createAndRemove", func(t *testing.T) {
err = fsa.CreateSubVolumeGroupSnapshot(volume, group, snapname1)
assert.NoError(t, err)
err := fsa.RemoveSubVolumeGroupSnapshot(volume, group, snapname1)
assert.NoError(t, err)
})
t.Run("createAndForceRemove", func(t *testing.T) {
err = fsa.CreateSubVolumeGroupSnapshot(volume, group, snapname1)
assert.NoError(t, err)
err := fsa.ForceRemoveSubVolumeGroupSnapshot(volume, group, snapname1)
assert.NoError(t, err)
})
t.Run("listOne", func(t *testing.T) {
err = fsa.CreateSubVolumeGroupSnapshot(volume, group, snapname1)
assert.NoError(t, err)
defer func() {
err := fsa.RemoveSubVolumeGroupSnapshot(volume, group, snapname1)
assert.NoError(t, err)
}()
snaps, err := fsa.ListSubVolumeGroupSnapshots(volume, group)
assert.NoError(t, err)
assert.Len(t, snaps, 1)
assert.Contains(t, snaps, snapname1)
})
t.Run("listTwo", func(t *testing.T) {
err = fsa.CreateSubVolumeGroupSnapshot(volume, group, snapname1)
assert.NoError(t, err)
defer func() {
err := fsa.RemoveSubVolumeGroupSnapshot(volume, group, snapname1)
assert.NoError(t, err)
}()
err = fsa.CreateSubVolumeGroupSnapshot(volume, group, snapname2)
assert.NoError(t, err)
defer func() {
err := fsa.RemoveSubVolumeGroupSnapshot(volume, group, snapname2)
assert.NoError(t, err)
}()
snaps, err := fsa.ListSubVolumeGroupSnapshots(volume, group)
assert.NoError(t, err)
assert.Len(t, snaps, 2)
assert.Contains(t, snaps, snapname1)
assert.Contains(t, snaps, snapname2)
// subvolumegroup snaps are reflected in subvolumes (with mangled names)
snaps, err = fsa.ListSubVolumeSnapshots(volume, group, subname)
assert.NoError(t, err)
assert.Len(t, snaps, 2)
})
}