Skip to content

Commit

Permalink
librbd: default clone operation to image format 2
Browse files Browse the repository at this point in the history
Image format 1 doesn't support clones, so unless the user
overrode the setting, default to format 2.

Fixes: http://tracker.ceph.com/issues/15685
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit f24c70f)
  • Loading branch information
Jason Dillaman authored and Abhishek Varshney committed May 6, 2016
1 parent ca13a95 commit 82838e3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/librbd/internal.cc
Expand Up @@ -1233,6 +1233,8 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force) {
ImageOptions& opts)
{
CephContext *cct = (CephContext *)io_ctx.cct();
ldout(cct, 10) << __func__ << " name=" << imgname << ", "
<< "size=" << size << ", opts=" << opts << dendl;

uint64_t format = cct->_conf->rbd_default_format;
opts.get(RBD_IMAGE_OPTION_FORMAT, &format);
Expand Down Expand Up @@ -1343,7 +1345,6 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force) {
uint64_t order = *c_order;

ImageOptions opts;
opts.set(RBD_IMAGE_OPTION_FORMAT, static_cast<uint64_t>(2));
opts.set(RBD_IMAGE_OPTION_FEATURES, features);
opts.set(RBD_IMAGE_OPTION_ORDER, order);
opts.set(RBD_IMAGE_OPTION_STRIPE_UNIT, stripe_unit);
Expand All @@ -1360,10 +1361,16 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force) {
{
CephContext *cct = (CephContext *)p_ioctx.cct();
ldout(cct, 20) << "clone " << &p_ioctx << " name " << p_name << " snap "
<< p_snap_name << "to child " << &c_ioctx << " name "
<< p_snap_name << " to child " << &c_ioctx << " name "
<< c_name << " opts = " << c_opts << dendl;

uint64_t format = cct->_conf->rbd_default_format;
bool default_format_set;
c_opts.is_set(RBD_IMAGE_OPTION_FORMAT, &default_format_set);
if (!default_format_set) {
c_opts.set(RBD_IMAGE_OPTION_FORMAT, static_cast<uint64_t>(2));
}

uint64_t format = 0;
c_opts.get(RBD_IMAGE_OPTION_FORMAT, &format);
if (format < 2) {
lderr(cct) << "format 2 or later required for clone" << dendl;
Expand Down

0 comments on commit 82838e3

Please sign in to comment.