Some versions of librbd provide the rbd_clone4 function, and others do
not. Squid will have the function backported in the 1st update, the
initial release of Squid does not have it. This makes checking for the
function based on the named Ceph version impractical.
With the new dlsym.LookupSymbol() function, it is now possible to check
the availability of rbd_clone4 during runtime. If the symbol is not
found ErrNotImplemented is returned, which can be used to detect the
unavailability of the function.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
When there is a failure during the CloneFromGroupSnap test case, the
rbd-group snapshot was not removed, preventing images from being deleted
as well.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
RBD image groups can be used to create consistent snapshots of all
images that are part of the group. The new rbd_clone4() API makes it
possible to create a new RBD image from a single snapshot that was
created as part of the group snapshot.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
In file include from rbd.go:931
var cMaxSnaps C.int
ret := C.rbd_snap_list(image.image, nil, &cMaxSnaps)
cSnaps := make([]C.rbd_snap_info_t, cMaxSnaps)
It is necessary to determine whether cMaxSnaps is a large 0. Otherwise, the following code will panic
ret = C.rbd_snap_list(image.image,&cSnaps[0], &cMaxSnaps)
Signed-off-by: zxysilent <zxysilent@outlook.com>
While building an application with the latest version of go-ceph, the
following warning is spit out:
In file included from _cgo_export.c:4:
resize.go:7: warning: "_POSIX_C_SOURCE" redefined
In file included from /usr/include/bits/libc-header-start.h:33,
from /usr/include/stdlib.h:26,
from _cgo_export.c:3:
/usr/include/features.h:292: note: this is the location of the previous definition
292 | # define _POSIX_C_SOURCE 200809L
When _POSIX_C_SOURCE is already defined, ther is no need to define it
again.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
Add a test to verify that an encrypted volume can be resized to
the desired unencrypted size similar to how the rbd command line
tool is documented as able to do.
Fixes: #972
Original-Version-By: Will Gorman <will.gorman@gmail.com>
Signed-off-by: John Mulligan <jmulligan@redhat.com>
rbd_snap_get_group_namespace() can be used to get details about
snapshots of an image, that were created as part of a group.
Signed-off-by: Niels de Vos <ndevos@ibm.com>
revive v1.3.7 added https://github.com/mgechev/revive/pull/966 which
checks for unused parameters in function literals. This caused several
lint errors in go-ceph code.
Signed-off-by: Manish <myathnal@redhat.com>
whether or not the allocation should be allowed to shrink, and a progress-tracking
callback. This contribution extends go-ceph to be able to call rbd_resize2.
Closes#933
Signed-off-by: Khayyam Saleem <khayyam.saleem@gmail.com>
When a parent image has been removed, it will linger in the trash until
all siblings are gone. The image is not accessible through it's name
anymore, only through its ID.
The ImageSpec that is returned by Image.GetParent() now contains the
Trash boolean and the ImageID to identify if the image is in the trash,
and use OpenImageById() to access the removed parent image.
Related-to: ceph/ceph-csi#4013
Signed-off-by: Niels de Vos <ndevos@ibm.com>
Removed the `LastSeen` property of MirrorPeerSite struct as it is not being set/updated anywhere by the ceph API.
Fixes: #870
Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
Added new locking APIs for the rbd component named
`rbd_lock_acquire`, `rbd_lock_break`, `rbd_lock_release`, `rbd_lock_get_owners`,
`rbd_is_exclusive_lock_owner` along with supporting TCs.
Fixes: #275
Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
We overlooked this in review, before this makes it into a release let's
remove the referential redundancy with rapidity.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
As discussed in #851, we wanted to fully document the arguments the
callback function is expected to be called with.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add unit and simplistic functional tests for new JSON/status description
extraction functions. Because these are preview functions we also add a
stub file to add a no-op function to be built on non-preview builds.
This avoids having to reimplement large parts of the existing mirroring
tests just to validate this small aspect of the SiteMirrorImageStatus
struct.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add UnmarshalDescriptionJSON method to SiteMirrorImageStatus
Add DescriptionReplayStatus method to SiteMirrorImageStatus
Both these functions are meant to help extract the JSON object that is
some times appended to the Description field in the
SiteMirrorImageStatus struct. I have only seen the JSON appear after
"replaying, " but there's little docs for this and I skimmed to code to
even find out what fields the JSON might include. As such, the
UnmarshalDescriptionJSON tries to unmarshal the appended JSON into an
object the caller provides in case skimming the code was insufficient or
the caller has other needs. For most cases, DescriptionReplayStatus can
be used to parse the JSON into a struct containing known fields.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Work around an issue reported that due to a large number of items in the
rbd trash the function fails rather than listing the items as desired.
This short term fix simply increases the limit rather than doing
anything long term.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
The librbd API for mirroring-related operations changed substantially between
Nautilus and Octopus. Due to this, go-ceph had previously only implemented
mirroring functionality if built against Octopus client libraries. This patch
implements equivalent functionality for use with Nautilus clients.
Signed-off-by: Sanford Miller <smiller@digitalocean.com>
This removes the limit on the max buffer size GetImageNames is willing to pass
to rbd_list2, which is somewhat arbitrary and is too small for large clusters.
GetImageNames will continue to start with a small buffer size and retry with a
larger buffer if rbd_list2 returns ERANGE (just without a cap on the max buffer
size it's willing to go to).
Signed-off-by: Sanford Miller <smiller@digitalocean.com>
The comments above Read and Write were very old and not up to our
current standards. Update them to be accurate and note that the
offset internal to the image type is not concurrency safe.
This also cleans up some old and unhelpful todos.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Luminous and mimic have not been supported for a few releases now.
There's no need to keep these build tags any more.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
These functions let one add various rbd tasks that are done
asynchronously in the background. Also added tests for the same.
Signed-off-by: Rakshith R <rar@redhat.com>
ImageSpec type has been added to work with rbd task api.
It consists of optional pool & namespace and image name/id.
[pool/][namespace/]image[Name/id].
Added unit tests.
Signed-off-by: Rakshith R <rar@redhat.com>