Commit Graph

314 Commits

Author SHA1 Message Date
Niels de Vos 1257d817db rbd: include details for parent image in the trash
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>
2023-08-02 13:56:45 +00:00
Anoop C S aefa1dc858 rbd: Make migration APIs stable
Signed-off-by: Anoop C S <anoopcs@cryptolab.net>
2023-06-08 17:35:55 +00:00
Nikhil-Ladha 7476da2582 rbd: Remove redundant LastSeen property from MirrorPeerSite struct
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>
2023-04-28 09:02:57 +00:00
Nikhil-Ladha 9041276dd9 rbd: Add locking rbd APIs
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>
2023-04-13 14:29:53 +00:00
John Mulligan 743c43be54 rbd: rename recently formed files to remove redundant prefix
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>
2023-04-05 13:43:53 +00:00
John Mulligan eaf74cbebd rbd: document SparsifyWithProgress callback's arguments
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>
2023-04-05 13:43:53 +00:00
Nikhil-Ladha 3d986f2bd3 rbd: Add rbd_sparsify_with_progress rbd API
Added a new rbd API `rbd_sparsify_with_progress`, and supporting
tests.

Fixes: #281

Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
2023-04-04 15:14:01 +00:00
Nikhil-Ladha fcd2fcd6f6 rbd: Add mirror peer site API components
**Description:**
Added some API components of mirror peer site

Fixes: #486

Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
2023-03-27 08:39:12 +00:00
John Mulligan 1feedf3bfc rbd: remove stray debugging prints from mirror tests
It is doubtful that these Print(f)s have been useful to any one for a
long time.  Remove them.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2023-03-17 18:10:53 +00:00
John Mulligan ab7955a236 rbd: add tests for DescriptionReplayStatus and UnmarshalDescriptionJSON
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>
2023-03-17 18:10:53 +00:00
John Mulligan f4f0d6dd9a rbd: add functions to parse json in mirroring status description field
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>
2023-03-17 18:10:53 +00:00
Sven Anderson 87041ee7d8 gofmt: reformat everything with new gofmt of go 1.19
Signed-off-by: Sven Anderson <sven@redhat.com>
2023-02-20 20:50:24 +00:00
Omid Yoosefi a6a42e9c7b rbd: implement live migration functions
Signed-off-by: Omid Yoosefi <omidyoosefi@ibm.com>
2023-01-11 05:35:52 +00:00
John Mulligan b956ad18da rbd: increase maximum number of trash entries listable
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>
2022-11-17 12:26:27 +00:00
John Mulligan f2f7e1c51d rbd: make Snapshot.Remove stable
As per the api stability doc, Snapshot.Remove is due to be stable in
0.18.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-10-17 17:18:49 +00:00
Sanford Miller 15d71fe192 rbd: add mirroring support for nautilus
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>
2022-07-13 13:00:48 +00:00
Sanford Miller 133e675c8d rbd: refactor GetImageNames to use a for loop instead of recursion
This is done because using a for loop is more idiomatic in Go code.

Signed-off-by: Sanford Miller <smiller@digitalocean.com>
2022-06-14 16:33:29 +00:00
Sanford Miller 36d5c4498e rbd: don't cap the buffer size used in GetImageNames
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>
2022-06-14 16:33:29 +00:00
John Mulligan 0722af5375 rbd admin: enable TestMirrorSnapshotScheduleStatus on quincy
The issue has (probably) been fixed in ceph v17.2.0 images.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-06-14 12:39:59 +00:00
Sven Anderson f4fb583252 docs: remove all PREVIEW comments
Signed-off-by: Sven Anderson <sven@redhat.com>
2022-06-06 14:42:04 +00:00
Sanford Miller 68ebb0520a rbd: expose rbd_snap_rename to Go clients
This implements the following method:
	(snapshot *Snapshot) Rename(destName string) error

Signed-off-by: Sanford Miller <smiller@digitalocean.com>
2022-05-17 14:40:07 +00:00
John Mulligan 68eff5d9e4 rbd admin: disable TestMirrorSnapshotScheduleStatus on qunicy
Will need to be properly debugged later.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-05-02 14:14:25 +00:00
John Mulligan dae56d0c65 rbd: update doc comments for rbd image Read and Write funcs
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>
2022-02-09 15:59:48 +00:00
John Mulligan 69c8750e96 rbd admin: use the new admintest module to set up tests
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2022-02-08 15:55:02 +00:00
Rakshith R 7d881032a6 rbd/admin: promote ImageSpec & tasks api to stable
Promoting ImageSpec & task apis to stable so
they can be release in v0.13.0.

Signed-off-by: Rakshith R <rar@redhat.com>
2021-11-29 15:07:06 +00:00
Seena Fallah bae93ac4ab rbd: export image name
Signed-off-by: Seena Fallah <seenafallah@gmail.com>
2021-11-09 02:31:09 +00:00
John Mulligan cc9f4d6b39 rbd: remove luminous and mimic build tags
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>
2021-11-09 01:24:01 +00:00
Sven Anderson 87f4563118 format: run gofmt on all files
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-10-04 18:58:35 +00:00
Sven Anderson 26fd846da1 docs: update comments of preview and deprecated APIs
Signed-off-by: Sven Anderson <sven@redhat.com>
2021-10-04 18:58:35 +00:00
John Mulligan f015cc36ca rbd: clearly mark Set as deprecated
Use the notation described in the new API stability doc.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-30 13:27:01 +00:00
John Mulligan 7f74708d5b rbd: clearly mark open function as deprecated
Use the notation described in the new API stability doc.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-30 13:27:01 +00:00
Rakshith R 126d6f5747 rbd admin: add rbd task [list|cancel|remove|trash remove|flatten]` apis
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>
2021-09-28 13:13:07 +00:00
Rakshith R 890b3619db rbd admin: add type ImageSpec to work with rbd task api
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>
2021-09-28 13:13:07 +00:00
John Mulligan 89c64b3100 rbd: change instance_ids to instanceIDs
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>
2021-09-13 15:13:53 +00:00
John Mulligan e5a1f842e5 rbd: naming conventions: fixes in test function TestOpenImage
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan ee3c7f3a80 rbd: naming conventions: fixes in test function TestReadAt
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan e6941b1e27 rbd: naming conventions: fixes in test function TestIOReaderWriter
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan d78d42972e rbd: naming conventions: fixes in test function TestWriteSame
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
John Mulligan c2e4cd5377 rbd: naming conventions: fixes in test function TestDeprecatedImageOpen
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-23 15:28:00 +00:00
Rakshith R a32355cba2 rbd: implement binding for rbd_mirror_image_instance_id_list
This commit adds MirrorImageInstanceIDList and
MirrorImageInstanceIDIter with necessary helper functions
and tests.

Fixes: #483

Signed-off-by: Rakshith R <rar@redhat.com>
2021-08-23 06:39:51 +00:00
John Mulligan 4f9322e9f1 rbd: add revive directives to ignore underscores in ImageInfo
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>
2021-08-12 11:05:09 -04:00
John Mulligan 8ea2109309 rbd: naming conventions: fixes in RemoveImage function
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-12 11:05:09 -04:00
John Mulligan ae97cd3e7d rbd: naming conventions: fixes in CreateImage function
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-12 11:05:09 -04:00
John Mulligan 6abfb039a4 rbd: naming conventions: fixes in TrashRemove, TrashRestore functions
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-12 11:05:09 -04:00
John Mulligan e4cfae9eaa rbd: naming conventions: fixes in SetSnapshot function
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-12 11:05:09 -04:00
John Mulligan 1cbbe2cea5 rbd: naming conventions: fixes in GetSnapshotNames function
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-12 11:05:09 -04:00
John Mulligan d1b251fef5 rbd: naming conventions: fixes in BreakLock function
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-12 11:05:09 -04:00
John Mulligan 8848df53e1 rbd: naming conventions: fixes in Unlock function
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-12 11:05:09 -04:00
John Mulligan 70db71e0b6 rbd: naming conventions: fixes in LockExclusive, LockShared functions
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-12 11:05:09 -04:00
John Mulligan 05538bceab rbd: naming conventions: fixes in ListLockers function
Fix up variable names that don't meet Go standards.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-08-12 11:05:09 -04:00