summaryrefslogtreecommitdiffstats
path: root/src/tools/rbd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* tools/rbd: make 'children' command support --image-idMykola Golub2024-02-131-4/+17
| | | | | Fixes: https://tracker.ceph.com/issues/64376 Signed-off-by: Mykola Golub <mykola.golub@clyso.com>
* Update rbd import-diff command help messageHuangWei2023-12-131-2/+3
| | | Signed-off-by: HuangWei <huangwei.a180285@gmail.com>
* common: Windows Unicode CLI supportLucian Petrut2023-11-222-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Windows CLI arguments use either ANSI (main()) or UTF-16 (wmain()). Meanwhile, Ceph libraries expect UTF-8 and raise exceptions when trying to use Unicode CLI arguments or log Unicode output: rbd.exe create test_unicode_șțăâ --size=32M terminate called after throwing an instance of 'std::runtime_error' what(): invalid utf8 We'll use a Windows application manifest, setting the "activeCodePage" property [1][2]. This enables the Windows UCRT UTF-8 mode so that functions that receive char* arguments will expect UTF-8 instead of ANSI, including main(). One exception is CreateProcess, which will need the UTF-16 form (CreateProcessW). Despite the locale being set to utf-8, we'll have to explicitly set the console output to utf-8 using SetConsoleOutputCP(CP_UTF8). In order to use the UTF-8 locale, we'll have to switch the mingw-llvm runtime from msvcrt to ucrt. This also fixes ceph-dokan crashes that currently occur when non-ANSI paths are logged. [1] https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests#activecodepage [2] https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
* Merge pull request #50341 from yangdongsheng/ubbdIlya Dryomov2023-06-053-2/+280
|\ | | | | | | | | | | rbd: add support for new device type of ubbd Reviewed-by: Mykola Golub <mykola.golub@clyso.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
| * tools/rbd: add support of new device type for ubbdDongsheng Yang2023-05-183-2/+280
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ubbd (Userspace Backend Block Device) is a method to build block device and handle IO by process started in userspace. That means we can provide a generic block device to user and handle IO requests by librbd in linux. This way, we can allow user to use rbd image as a linux block device supporting full image features, especial the journaling feature, which is not supported by krbd. For more information: https://github.com/DataTravelGuide/ubbd Signed-off-by: Dongsheng Yang <dongsheng.yang.linux@gmail.com>
* | rbd: fix spelling errorsJosh Soref2023-04-262-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * acquire * are * asynchronous * attempt * bootstrap * concurrent * consume * couldn't * cumulative * disable * disabling * disaster * disconnected * endianness * entries * exclusive * filesystem * flag * generic * github * image * information * initiating * latency * limitations * metadata * modify * namespace * noautoconsole * ourselves * prefetch * propagate * protection * recorder * recover * release * replicated * reserved * selection * sentinel * several * snapshot * source * specifying * suppress * synchronize * the * transfer * triggering * unknown * validation * version * visible * write log entries Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
* rbd, rbd-nbd: make --encryption-format optionalIlya Dryomov2022-12-042-1/+4
| | | | | | | If no --encryption-format specified at all, default to "luks" for each specified --encryption-passphrase-file. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd, rbd-nbd: accept "luks", "luks1" and "luks2" formatsIlya Dryomov2022-12-043-54/+76
| | | | | | | | | Since RBD_ENCRYPTION_FORMAT_LUKS1, RBD_ENCRYPTION_FORMAT_LUKS2 and RBD_ENCRYPTION_FORMAT_LUKS aren't treated the same when loading encryption anymore, "luks1" and "luks2" formats need to be accepted in addition to "luks" format. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd: fix passphrase zeroing in "rbd encryption format" handlerIlya Dryomov2022-12-041-18/+18
| | | | | | | | "rbd encryption format" handler sets up a scope guard to zero out the passphrase string on return but also makes a copy of same which isn't zeroed out. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd, rbd-nbd: don't strip trailing newline in passphrase filesIlya Dryomov2022-12-042-10/+2
| | | | | | | | | | | | One of the stated goals is compatibility with standard LUKS tools, in particular being able to load encryption on images formatted with cryptsetup. cryptsetup doesn't do this and this really interferes with randomly generated (binary) passphrases. While at it, open passphrase files as binary -- it communicates the intent if nothing else on POSIX. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* librbd: remap resize target size if encryption is loadedIlya Dryomov2022-12-041-0/+17
| | | | | | | | | | | | | | | | | | When encryption is loaded, rbd_get_size() and Image::size() return "effective" size, but rbd_resize() and Image::resize() continue to take raw size. The user has to constantly keep these domains in mind. Saying that resize must be done without encryption loaded is not an answer because shrinking a clone that has snapshots involves copying up objects in the affected range (identical to flattening). In addition, even if a clone doesn't have snapshots, shrinking it to a size that isn't an object boundary is going to involve a copyup for the victim object as well. To avoid subtle data corruption on shrink, treat resize operation the same as flatten operation (including on the CLI). Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd: add --snap-id option to "rbd device map|unmap|attach|detach"Prasanna Kumar Kalever2022-11-102-16/+40
| | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* rbd: add namespace to get_detach_argumentsPrasanna Kumar Kalever2022-11-101-1/+2
| | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* Merge pull request #40363 from orozery/rbd-clone-encryptionIlya Dryomov2022-10-255-0/+145
|\ | | | | | | | | | | librbd: add encryption format support for clones (part 1/2) Reviewed-by: Mykola Golub <mgolub@suse.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
| * tools/rbd: add encryption format support for cloned imageOr Ozeri2022-08-255-0/+145
| | | | | | | | | | | | | | | | | | This commit adds the encryption format support for cloned images via the RBD cli, making the child image be encrypted with a key different from it parent, while keeping the child thinly-provisioned. Additionally, other APIs are extended to support flattening of such images. Signed-off-by: Or Ozeri <oro@il.ibm.com>
* | rbd: Removed device_name argument from wnbd unmapStefan Chivu2022-10-071-13/+4
| | | | | | | | | | | | | | | | | | | | | | Right now, rbd-wnbd doesn't actually use disk path identifiers such as "/dev/*" or "\\.\PhysicalDrive*". So instead of accepting two arguments that are basically handled more or less the same, we're dropping the device_name argument and sticking to the image spec. Signed-off-by: Stefan Chivu <schivu@cloudbasesolutions.com>
* | rbd: Moved get_image_or_snap_spec and parse_options to utilsStefan Chivu2022-10-075-192/+81
| | | | | | | | | | | | | | | | | | | | | | | | At the moment, there are multiple copies of "get_image_or_snap_spec". For this reason, we're moving it to Utils.cc so that all backends may re-use it, also benefiting from the recent pool related fix. We are also renaming parse_options to append_options_as_args and changing its type to void Signed-off-by: Stefan Chivu <schivu@cloudbasesolutions.com>
* | rbd: Added namespace optarg for rbd device unmapStefan Chivu2022-10-071-1/+2
| | | | | | | | | | | | | | When executing rbd device unmap, an explicit namespace optarg wasn't available Fixes: https://tracker.ceph.com/issues/57765 Signed-off-by: Stefan Chivu <schivu@cloudbasesolutions.com>
* | rbd: remove incorrect use of std::includes()Ilya Dryomov2022-08-121-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | - std::includes() requires sorted ranges but command specs aren't sorted - std::includes() purpose is to check whether the second range is a subsequence of the first range but here the size of the second range is always equal to the size of the first range, which means that, had the ranges been sorted, std::includes() would have checked straight equality Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* | rbd: find_action() should sort actions firstIlya Dryomov2022-08-121-2/+8
|/ | | | | | | | | | | | | | | | | | | The order in which objects with static storage duration in different TUs are initialized is undefined. If the compiler chooses to initialize Shell::Action objects in action/Trash.cc before Shell::Action objects in action/TrashPurgeSchedule.cc, all "rbd trash purge schedule ..." commands get shadowed by "rbd trash purge" command: $ rbd trash purge schedule list rbd: too many arguments The confusing error arises because "rbd trash purge" takes a single positional argument. "schedule" gets interpreted as <pool-spec> and "list" generates an error. Fixes: https://tracker.ceph.com/issues/57107 Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd: drop unused default_empty_pool_name argumentIlya Dryomov2022-07-169-26/+24
| | | | Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd: don't default empty pool name unless namespace is specifiedIlya Dryomov2022-07-161-2/+10
| | | | | | | | | | Commit 96f05a7956b3 ("rbd: delay determination of default pool name") broke "rbd perf image iostat" and "rbd perf image iotop" GLOBAL_POOL_KEY support (the ability to blend all rbd pools together into a single view). Fixes: https://tracker.ceph.com/issues/56561 Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd: add persistent-cache flush commandYin Congmin2022-04-121-0/+53
| | | | | | | | | | Add a flush command so that users can manually flush cache. [ idryomov: error messages, incorporate doc and help.t hunks, drop do_persistent_cache_flush() ] Signed-off-by: Yin Congmin <congmin.yin@intel.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd: rename image-cache invalidate commandYin Congmin2022-04-122-19/+17
| | | | | | | | | | | Rename command image-cache to persistent-cache. Refactoring the code of invalidate command. [ idryomov: error message, incorporate doc and help.t hunks, drop do_persistent_cache_invalidate() ] Signed-off-by: Yin Congmin <congmin.yin@intel.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* librbd/cache/pwl: rename persistent cache keyYin Congmin2022-04-121-7/+2
| | | | | | | | | | librbd "internal" metadata keys was change to ".rbd" prefix. Change peristent cache to ".rbd" too. And the name of persistent cache key is IMAGE_CACHE_STATE. Since this key is planned to be used outside the pwl directory, it seems more appropriate to change it to a clear name as PERSISTENT_CACHE_STATE. Signed-off-by: Yin Congmin <congmin.yin@intel.com>
* rbd: include persistent cache metrics in "rbd status" reportIlya Dryomov2022-04-111-8/+123
| | | | Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd: factor out get_percentage() helperIlya Dryomov2022-04-112-1/+7
| | | | Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd: fix a typo in "rbd trash purge schedule ls" formatted outputIlya Dryomov2022-03-051-1/+1
| | | | Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd: support pool and image level overrides for rbd_default_map_optionsChristopher Hoffman2022-02-181-5/+24
| | | | | Fixes: https://tracker.ceph.com/issues/52850 Signed-off-by: Christopher Hoffman <choffman@redhat.com>
* rbd: mark optional positional arguments as such in help outputIlya Dryomov2022-02-086-10/+32
| | | | | | | | | | | | | | | Currently at least five commands have optional positional arguments. Overloading po::value<std::string>()->default_value("") for this is a bit sneaky but nothing better fits into the existing Shell.cc framework. Note that strictly speaking "[<interval>] [<start-time>]" should be "[<interval> [<start-time>]]" but we aren't doing that here because "ceph" command doesn't do it either. Fixes: https://tracker.ceph.com/issues/54191 Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd: recognize rxbounce map optionIlya Dryomov2022-02-041-0/+2
| | | | | Fixes: https://tracker.ceph.com/issues/54063 Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* rbd: add missing switch arguments for recognition by get_command_spec()Ilya Dryomov2022-01-1910-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | Currently this $ rbd --all children img doesn't work, while this $ rbd children --all img or this $ rbd children img --all does. The issue is that -a/--all isn't on the list of known switch arguments. The "rbd children" example may seem contrived but for more complicated commands such as "rbd device map" mixing switches and positional arguments occurs naturally: $ rbd device --device-type nbd --options try-netlink --show-cookie map img Fixes: https://tracker.ceph.com/issues/53935 Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* Merge pull request #43524 from Rethan/feat-expiration-timeDeepika Upadhyay2021-11-221-0/+3
|\ | | | | | | | | | | rbd: when trash mv, show expiration time if it's not now Reviewed-by: Deepika Upadhyay <dupadhya@redhat.com> Reviewed-by: Sunny Kumar <sunkumar@redhat.com>
| * rbd: when trash mv, show expiration time if it's not nowhaoyixing2021-10-131-0/+3
| | | | | | | | Signed-off-by: haoyixing <haoyixing@kuaishou.com>
* | Merge pull request #43852 from hualongfeng/show_featureDeepika Upadhyay2021-11-221-0/+1
|\ \ | | | | | | | | | | | | tools/rbd: make rbd info display dirty-cache feature Reviewed-by: Deepika Upadhyay <dupadhya@redhat.com>
| * | tools/rbd: make rbd info display dirty-cache featureFeng Hualong2021-11-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Rbd info cannot show dirty-cache feature when it is enable. So complete ImageFeatures::FEATURE_MAPPING to show the dirty-cache feature. Signed-off-by: Feng Hualong <hualong.feng@intel.com>
* | | rbd: correct encoding of snap protection record in exporting imageSatoru Takeuchi2021-11-131-1/+1
|/ / | | | | | | | | | | | | | | | | Correct the size of `protection` field. This bug is harmless since Export/Import writes/reads one byte for `protected` field regardless of `length` field. So the current wrong diff works correctly by chance Fixes: https://tracker.ceph.com/issues/53243 Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
* | rbd-nbd: allow user to specify cookie at mapPrasanna Kumar Kalever2021-10-262-0/+11
| | | | | | | | | | | | | | | | | | Allow user to specify cookie of choice at the time of map $ rbd device attach rbd-pool/image --device /dev/nbd0 \ --cookie 6f85d970-10b2-456b-8baf-676aa4d782e4 --options try-netlink Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* | rbd: add --show-cookie/--cookie option for map/attach commandsPrasanna Kumar Kalever2021-10-262-2/+11
|/ | | | | | | | | | | | Example: $ rbd device map rbd-pool/image --show-cookie --try-netlink --device-type nbd $ rbd device attach rbd-pool/image --device /dev/nbd0 \ --cookie 6f85d970-10b2-456b-8baf-676aa4d782e4 --device-type nbd older Kernel versions can use --force to skip the cookie validation Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* Merge pull request #42848 from ronen-fr/wip-ronenf-argv2vec-usersRonen Friedman2021-08-301-2/+1
|\ | | | | | | | | | | | | | | common: modify 'main()s' to use new argv_to_vec() signature Reviewed-by: Kefu Chai <kchai@redhat.com> Reviewed-by: Radoslaw Zarzynski <rzarzyns@redhat.com> Reviewed-by: Deepika Upadhyay <dupadhya@redhat.com>
| * common: modify 'main()s' to use new argv_to_vec() signatureRonen Friedman2021-08-191-2/+1
| | | | | | | | | | | | | | A followup to PR #42820 that modified argv_to_vec() signature (for style and performance). Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
* | rbd: avoid overflow of ios and clarify io-size limit for benchhaoyixing2021-08-241-3/+3
|/ | | | | | | | | When doing rbd bench, we record done ios to print progress, current it's unsigned. Suppose we do a bench of io-size 512B and io-total 4T, that means a total number of 8G ios which causes an overflow. And we don't support io-size greater than 4G, so change help message. Signed-off-by: haoyixing <haoyixing@kuaishou.com>
* tools/rbd: build without "using namespace std"Kefu Chai2021-08-139-27/+36
| | | | | | | | | | * add "std::" prefix in headers * add "using" declarations in .cc files. so we don't rely on "using namespace std" in one or more included headers. Signed-off-by: Kefu Chai <kchai@redhat.com>
* *: drop strict_iecstrtoll(const char *str,..)Kefu Chai2021-07-262-5/+5
| | | | | | | | | | | | replace strict_iecstrtoll(const char *str,..) with strict_iecstrtoll(std::string_view, ..). which is more convenient. and both of them share the same implementation: strict_iec_cast<uint64_t>(str, err); so they are interchangeable. Signed-off-by: Kefu Chai <kchai@redhat.com>
* rbd: don't disable rbd_discard_on_zeroed_write_sameIlya Dryomov2021-06-161-6/+1
| | | | | | | After commit 0e8aa956a3b6 ("rbd: switch thick-provision image creation to use new write_zeroes API") it is no longer necessary. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* Merge pull request #41588 from idryomov/wip-rbd-trash-purgeIlya Dryomov2021-06-011-4/+13
|\ | | | | | | | | librbd: don't stop at the first unremovable image when purging Reviewed-by: Mykola Golub <mgolub@suse.com>
| * rbd: combined error message for expected Trash::purge() errorsIlya Dryomov2021-05-311-0/+9
| | | | | | | | | | | | | | Output to stderr instead of the log where regular users wouldn't see it given the elevated log level. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
| * rbd: propagate Trash::purge() resultIlya Dryomov2021-05-281-4/+4
| | | | | | | | | | | | Exit with respective status like other commands do. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
* | doc/rbd: document cp versus deep cpJan "Yenya" Kasprzak2021-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | I found that the difference between "rbd cp" and "rbd deep cp", i.e. what "deep" means in this context, is documented only in the mailing list archive and in the Mimic reelase notes. Let's make the difference explicit in the manpage and in rbd --help. Signed-off-by: Jan "Yenya" Kasprzak <kas@fi.muni.cz>
* | rbd: improve conditional compilation specific checksPrasanna Kumar Kalever2021-05-264-9/+68
| | | | | | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>