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>
Fix up variable names that don't meet Go standards.
This one crept in while working on older code but before the newer
patch enabling revive to find these was available.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit adds MirrorImageInstanceIDList and
MirrorImageInstanceIDIter with necessary helper functions
and tests.
Fixes: #483
Signed-off-by: Rakshith R <rar@redhat.com>
These are public fields of a public type and changing them would be
a breaking change. Add revive comment directives to ignore them
so we can continue to have names in this struct that violate the
Go naming convention.
Signed-off-by: John Mulligan <jmulligan@redhat.com>