New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

librbd: warning message for mirroring pool option #12319

Merged
merged 1 commit into from Jan 4, 2017

Conversation

Projects
None yet
2 participants
@gaurav36
Contributor

gaurav36 commented Dec 5, 2016

When user enable/disable mirroring option on a pool, than
re-enabling/disabling mirroring option should give warning
message if it is already enable/disable.
It should also give warning when changing the mode from pool
to image or vice versa.

Fixes: http://tracker.ceph.com/issues/18125

Reported-by: Jason Dillaman dillaman@redhat.com
Signed-off-by: Gaurav Kumar Garg garg.gaurav52@gmail.com

@@ -2862,10 +2864,16 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force,
}
if (next_mirror_mode == cls::rbd::MIRROR_MODE_IMAGE) {
if (current_mirror_mode == cls::rbd::MIRROR_MODE_POOL) {

This comment has been minimized.

@dillaman

dillaman Dec 5, 2016

Contributor

I would actually put this and the next message within the rbd CLI prefixed with "note: " instead of "warning: " (since it isn't technically wrong).

This comment has been minimized.

@gaurav36

gaurav36 Dec 6, 2016

Contributor

Thanks, will prefix with note in next PR.

I can put this within CLI but its seems to be costly operation. because if i put this within execute_enable and execute_disable function than i need to initialize io_ctx for getting current_mirror_mode (cls_client::mirror_mode_get(&io_ctx, &current_mirror_mode)). if i put this within execute_enable_disable than i need to compare it with two type of enum one is rbd_mirror_mode_t and second one is cls::rbd::MirrorMode for checking current and next mirror mode, which doesn't seems to be good because if in future if we change any one of the enum sequence than it might create problem. Any how it can be done at cli side

@dillaman should i stick with this method or do change within cli, thoughts ?

This comment has been minimized.

@dillaman

dillaman Dec 7, 2016

Contributor

These are already part of the public librbd API: https://github.com/ceph/ceph/blob/master/src/include/rbd/librbd.hpp#L149

This comment has been minimized.

@gaurav36

gaurav36 Dec 7, 2016

Contributor

@dillaman ahhh right, thanks. Will send updated PR with change in CLI.

@@ -2833,6 +2833,8 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force,
}
if (current_mirror_mode == next_mirror_mode) {
lderr(cct)<<"warning: mirroring on pool is already set to "

This comment has been minimized.

@dillaman

dillaman Dec 5, 2016

Contributor

I would remove "warning: "

This comment has been minimized.

@gaurav36

gaurav36 Dec 6, 2016

Contributor

Thanks, without warning it would be better. will remove it in next PR.

@@ -259,16 +259,48 @@ void get_enable_arguments(po::options_description *positional,
}
int execute_enable_disable(const std::string &pool_name,
rbd_mirror_mode_t mirror_mode) {
const std::string mode) {

This comment has been minimized.

@dillaman

dillaman Dec 9, 2016

Contributor

Missing &

This comment has been minimized.

@gaurav36

gaurav36 Dec 9, 2016

Contributor

right, thanks, it should be by reference. Will do change in next PR

if (current_mirror_mode == next_mirror_mode) {
std::cout << "mirroring on pool is already set to "
<< mode << std::endl;

This comment has been minimized.

@dillaman

dillaman Dec 9, 2016

Contributor

Nit 1) when (re)disabling mirroring, this sentence won't be grammatically correct ("mirroring on pool is already set to disable") -- it would need to be "... is already disabled".
Nit 2) if no update, you can return here and skip the update call.

This comment has been minimized.

@gaurav36

gaurav36 Dec 9, 2016

Contributor

@dillaman Thank you, will do change in Next PR

rbd_mirror_mode_t next_mirror_mode;
rbd_mirror_mode_t current_mirror_mode;
if (mode == "disable") {

This comment has been minimized.

@dillaman

dillaman Dec 13, 2016

Contributor

Minor: perhaps just pass in both the string and the enum so that you don't need to move this logic here (and so that "rbd mirror pool enable disable" isn't a valid selection).

This comment has been minimized.

@gaurav36

gaurav36 Dec 13, 2016

Contributor

@dillaman yeah, i will pass it in next PR. I was having same thing in my mind previously but i thought we can save passing extra argument as a string so moved logic here form execute_enable function. rbd mirror pool enable disable is taking care by L+275

}
if (current_mirror_mode == next_mirror_mode) {
std::cout << "mirroring mode on pool is already " << mode << std::endl;

This comment has been minimized.

@dillaman

dillaman Dec 13, 2016

Contributor

This is still lightly off grammar-wise. If disabling, the text should be something like "mirroring is already disabled", otherwise it can be something like "mirroring is already configured for mode".

This comment has been minimized.

@gaurav36

gaurav36 Dec 13, 2016

Contributor

will do it in next PR.

if (current_mirror_mode == next_mirror_mode) {
if (mode == "disabled") {
std::cout << "mirroring is already "<< mode << std::endl;

This comment has been minimized.

@dillaman

dillaman Jan 4, 2017

Contributor

Nit: space between already " and << mode

This comment has been minimized.

@gaurav36

gaurav36 Jan 4, 2017

Contributor

done in next PR

if (mode == "disabled") {
std::cout << "mirroring is already "<< mode << std::endl;
} else {
std::cout << "mirroring is already configured for mode "

This comment has been minimized.

@dillaman

dillaman Jan 4, 2017

Contributor

Nit: "mirroring is already configured for " << mode << " mode"

This comment has been minimized.

@gaurav36

gaurav36 Jan 4, 2017

Contributor

done in next PR

rbd: warning message for mirroring pool option
When user enable/disable mirroring option on a pool, than
re-enabling/disabling mirroring option should give warning
message if it is already enable/disable.
It should also give warning when changing the mode from pool
to image or vice versa.

Fixes: http://tracker.ceph.com/issues/18125

Reported-by:  Jason Dillaman <dillaman@redhat.com>
Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>

@dillaman dillaman merged commit 92a5419 into ceph:master Jan 4, 2017

3 checks passed

Signed-off-by all commits in this PR are signed
Details
Unmodifed Submodules submodules for project are unmodified
Details
default Build finished.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment