Some versions of ceph return a list of supported features for a
subvolume. On versions that don't return this field the list will always
be empty.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Previously, I was sort of abusing the build tags system to just get our
tests working. That was incorrect because you could be building go-ceph
against nautilus libs but using an octopus server and vice versa. In
addition, I've learned that some of the snapshot and clone behaviors are
being changed as items are backported in ceph. This means that build
tags themselves are not good indicators of what a particular version of
ceph supports.
This patch is the first step to removing these restrictions and making
cephfs admin work more smoothly across more versions of ceph.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The response type simplifies the error handling as a "pipeline" of
checks that are applied one after another.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add a SubVolumeInfo function that works like the `ceph fs subvolume
info` command. This function returns a SubVolumeInfo type from parsing
the response JSON.
In order to re-use the existing QuotaSize type, which is an interface
and thus can't be unmarshaled directly, we use a non-exported wrapper
type for the unmarshaling and then we fix up the BytesQuota field so
that users of the library don't need to directly deal with the quota
size placeholder type, which can unmarshal the value.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This clarifies what the size values are for when this interface is used
and hopefully clarifies what the size actually does to a subvolume. This
also generalizes the type a bit in preparation for it being used in
other upcoming functions.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The SubVolumePath function maps the subvolume to a path from the root
of the cephfs, and works like `ceph fs subvolume getpath ...`.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Removes some old reminder comments.
Adds doc comments with the keyword "Similar To" followed by block quoted
text that shows a cli command the function will behave similarly to.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add a function for resizing a subvolume as well as types needed to
create the JSON command and parse the response JSON. The newSize
argument can be passed a numeric value (as a ByteCount) or the special
constant `Infinite` much like the ceph cli command. This is accomplished
using the interface type `NewSize`.
Signed-off-by: John Mulligan <jmulligan@redhat.com>