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

librbd: default features should be negotiated with the OSD #11808

Merged
merged 2 commits into from Nov 15, 2016

Conversation

trociny
Copy link
Contributor

@trociny trociny commented Nov 7, 2016

@trociny
Copy link
Contributor Author

trociny commented Nov 7, 2016

@dillaman Not sure about util::get_rbd_default_features(). I mostly need it for internal.cc, but it will not work for a new pool, because of RBD_DIRECTORY not existing yet.

@@ -89,7 +91,7 @@ uint64_t parse_rbd_default_features(CephContext* cct)
value += conf_vals[feature];
} else {
ret = -EINVAL;
ldout(cct, 1) << "Warning: unknown rbd feature " << feature << dendl;
lderr(cct) << "unknown rbd feature " << feature << dendl;
Copy link

Choose a reason for hiding this comment

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

Note that this falls back to the defaults on -EINVAL below. That was the rationale for the warning since execution will continue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I am aware that execution will continue, but I think it is better to display it as an error message to the user (though not fatal). Without this and with rbd debug = 0 by default, the user will not see e.g. that she has a typo in ceph.conf.

Copy link

Choose a reason for hiding this comment

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

Makes sense. Perhaps reword it to be "ignoring unknown feature ..."

@dillaman
Copy link

dillaman commented Nov 7, 2016

@trociny I was thinking that this negotiation would only occur if using the default image features (i.e. the user didn't supply any features when creating the image). If the user supplied a feature not supported by the server, I'd say let it fail.

In terms of the existence of rbd_directory, if this check could be added to the create state machine after a (modified) validate pool step where you would create the directory if it didn't exist (if pool validation was disabled).

Copy link
Contributor Author

@trociny trociny left a comment

Choose a reason for hiding this comment

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

@dillaman I think I implemented it exactly as you was thinking (only if no features are provided and in create state machine after validate pool step). The problem is only with one (compatibility?) case, for create() function which no features parameters, when parse_rbd_default_features was used. Probably I could just use features = 0 in that case, I just don't analyze yet if it will break something.

@@ -89,7 +91,7 @@ uint64_t parse_rbd_default_features(CephContext* cct)
value += conf_vals[feature];
} else {
ret = -EINVAL;
ldout(cct, 1) << "Warning: unknown rbd feature " << feature << dendl;
lderr(cct) << "unknown rbd feature " << feature << dendl;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I am aware that execution will continue, but I think it is better to display it as an error message to the user (though not fatal). Without this and with rbd debug = 0 by default, the user will not see e.g. that she has a typo in ceph.conf.

bufferlist::iterator it = m_outbl.begin();
*result = cls_client::get_all_features_finish(&it, &all_features);
}
if (*result < 0) {
Copy link

Choose a reason for hiding this comment

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

Minor: probably good to check for -EOPNOTSUPP and skip the negotiation if it fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dillaman Not sure about this. It is only a debug message, so it looks like it does not hurt to display it even for EOPNOTSUPP case.

Copy link

Choose a reason for hiding this comment

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

Sorry, late night last night -- indeed, never mind.

if (*result < 0) {
ldout(m_cct, 10) << "error retrieving server supported features set: "
<< cpp_strerror(*result) << dendl;
} else if (all_features < m_features) {
Copy link

Choose a reason for hiding this comment

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

Minor: if ((m_features & all_features) != m_features) is probably clearer

@dillaman
Copy link

dillaman commented Nov 7, 2016

@trociny For the create() w/ no features case, you could just have the it call the create method that takes the ImageOptions instead of that intermediate version for stripe units.

@trociny
Copy link
Contributor Author

trociny commented Nov 7, 2016

@dillaman good idea! Thanks for your comments.

Mykola Golub added 2 commits November 7, 2016 20:12
Signed-off-by: Mykola Golub <mgolub@mirantis.com>
@trociny
Copy link
Contributor Author

trociny commented Nov 7, 2016

@dillaman updated

@dillaman
Copy link

dillaman commented Nov 7, 2016

lgtm

@dillaman dillaman closed this Nov 7, 2016
@dillaman dillaman reopened this Nov 7, 2016
@dillaman dillaman merged commit 8f03592 into ceph:master Nov 15, 2016
@trociny trociny deleted the wip-17010 branch November 15, 2016 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants