Skip to content
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

mon: OSDMonitor: Make 'osd pool rename' idempotent #765

Merged
merged 2 commits into from Oct 26, 2013
Merged

mon: OSDMonitor: Make 'osd pool rename' idempotent #765

merged 2 commits into from Oct 26, 2013

Conversation

jecluis
Copy link
Member

@jecluis jecluis commented Oct 25, 2013

'ceph osd pool rename' takes two arguments: source pool and dest pool.
If by chance 'source pool' does not exist and 'destination pool' does,
then, in order to assure it's idempotent, we want to assume that if
'source pool' no longer exists is because it was already renamed.

However, while we will return success in such case, we want to make sure
to let the user know that we made such assumption. Mostly to warn the
user of such a thing in case of a mistake on the user's part (say, the
user didn't notice that the source pool didn't exist, while the dest did),
but also to make sure that the user is not surprised by the command
returning success if the user expected an ENOENT or EEXIST.

Fixes: #6635

Signed-off-by: Joao Eduardo Luis joao.luis@inktank.com

wait_for_finished_proposal(new Monitor::C_Command(mon, m, ret, rs, get_last_committed()));
return true;
goto reply;
} while (false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this do {} block is just confusing the flow. why not do a simple set of checks, like

if (src < 0 && dst >= 0) {
blah; err = 0;
goto reply;
}

Joao Eduardo Luis and others added 2 commits October 26, 2013 01:28
'ceph osd pool rename' takes two arguments: source pool and dest pool.
If by chance 'source pool' does not exist and 'destination pool' does,
then, in order to assure it's idempotent, we want to assume that if
'source pool' no longer exists is because it was already renamed.

However, while we will return success in such case, we want to make sure
to let the user know that we made such assumption.  Mostly to warn the
user of such a thing in case of a mistake on the user's part (say, the
user didn't notice that the source pool didn't exist, while the dest did),
but also to make sure that the user is not surprised by the command
returning success if the user expected an ENOENT or EEXIST.

Fixes: #6635

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
If we get dup pool rename requests that are racing, make sure the second
one comes back with 'success' if the rename entry already exists in the
pending_inc map.

Signed-off-by: Sage Weil <sage@inktank.com>
liewegas pushed a commit that referenced this pull request Oct 26, 2013
mon: OSDMonitor: Make 'osd pool rename' idempotent

Reviewed-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
@liewegas liewegas merged commit c2cd460 into next Oct 26, 2013
@liewegas liewegas deleted the wip-6635 branch October 26, 2013 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants