class C_ScanPoolChildren : public C_AsyncObjectThrottle<I> {
public:
C_ScanPoolChildren(AsyncObjectThrottle<I> &throttle, I *image_ctx,
- const ParentSpec &pspec, const Pools &pools,
+ const cls::rbd::ParentImageSpec &pspec, const Pools &pools,
size_t pool_idx)
: C_AsyncObjectThrottle<I>(throttle, *image_ctx), m_pspec(pspec),
m_pool(pools[pool_idx]) {
int send() override {
I &image_ctx = this->m_image_ctx;
- assert(image_ctx.owner_lock.is_locked());
+ ceph_assert(image_ctx.owner_lock.is_locked());
CephContext *cct = image_ctx.cct;
ldout(cct, 10) << this << " scanning pool '" << m_pool.second << "'"
return 1;
}
- r = rados.ioctx_create2(m_pool.first, m_pool_ioctx);
+ r = util::create_ioctx(image_ctx.md_ctx, "child image", m_pool.first, {},
+ &m_pool_ioctx);
if (r == -ENOENT) {
- ldout(cct, 1) << "pool '" << m_pool.second << "' no longer exists"
- << dendl;
return 1;
} else if (r < 0) {
- lderr(cct) << "can't create ioctx for pool '" << m_pool.second
- << "'" << dendl;
return r;
}
util::create_rados_callback(this);
r = m_pool_ioctx.aio_operate(RBD_CHILDREN, rados_completion, &op,
&m_children_bl);
- assert(r == 0);
+ ceph_assert(r == 0);
rados_completion->release();
return 0;
}
CephContext *cct = image_ctx.cct;
if (r == 0) {
- bufferlist::iterator it = m_children_bl.begin();
+ auto it = m_children_bl.cbegin();
r= cls_client::get_children_finish(&it, &m_children);
}
}
private:
- ParentSpec m_pspec;
+ cls::rbd::ParentImageSpec m_pspec;
Pool m_pool;
IoCtx m_pool_ioctx;
const cls::rbd::SnapshotNamespace &snap_namespace,
const std::string &snap_name)
: Request<I>(image_ctx, on_finish), m_snap_namespace(snap_namespace),
- m_snap_name(snap_name), m_ret_val(0), m_snap_id(CEPH_NOSNAP) {
+ m_snap_name(snap_name), m_state(STATE_UNPROTECT_SNAP_START),
+ m_ret_val(0), m_snap_id(CEPH_NOSNAP) {
}
template <typename I>
finished = true;
break;
default:
- assert(false);
+ ceph_abort();
break;
}
return finished;
template <typename I>
void SnapshotUnprotectRequest<I>::send_unprotect_snap_start() {
I &image_ctx = this->m_image_ctx;
- assert(image_ctx.owner_lock.is_locked());
+ ceph_assert(image_ctx.owner_lock.is_locked());
CephContext *cct = image_ctx.cct;
ldout(cct, 5) << this << " " << __func__ << dendl;
- m_state = STATE_UNPROTECT_SNAP_START;
-
int r = verify_and_send_unprotect_snap_start();
if (r < 0) {
this->async_complete(r);
template <typename I>
void SnapshotUnprotectRequest<I>::send_scan_pool_children() {
I &image_ctx = this->m_image_ctx;
- assert(image_ctx.owner_lock.is_locked());
+ ceph_assert(image_ctx.owner_lock.is_locked());
CephContext *cct = image_ctx.cct;
ldout(cct, 5) << this << " " << __func__ << dendl;
std::list<Pool> pool_list;
rados.pool_list2(pool_list);
- ParentSpec pspec(image_ctx.md_ctx.get_id(), image_ctx.id, m_snap_id);
+ cls::rbd::ParentImageSpec pspec(image_ctx.md_ctx.get_id(),
+ image_ctx.md_ctx.get_namespace(),
+ image_ctx.id, m_snap_id);
Pools pools(pool_list.begin(), pool_list.end());
Context *ctx = this->create_callback_context();
boost::lambda::_1, &image_ctx, pspec, pools, boost::lambda::_2));
AsyncObjectThrottle<I> *throttle = new AsyncObjectThrottle<I>(
nullptr, image_ctx, context_factory, ctx, NULL, 0, pools.size());
- throttle->start_ops(image_ctx.concurrent_management_ops);
+ throttle->start_ops(
+ image_ctx.config.template get_val<uint64_t>("rbd_concurrent_management_ops"));
}
template <typename I>
void SnapshotUnprotectRequest<I>::send_unprotect_snap_finish() {
I &image_ctx = this->m_image_ctx;
- assert(image_ctx.owner_lock.is_locked());
+ ceph_assert(image_ctx.owner_lock.is_locked());
CephContext *cct = image_ctx.cct;
ldout(cct, 5) << this << " " << __func__ << dendl;
librados::AioCompletion *comp = this->create_callback_completion();
int r = image_ctx.md_ctx.aio_operate(image_ctx.header_oid, comp, &op);
- assert(r == 0);
+ ceph_assert(r == 0);
comp->release();
}
template <typename I>
void SnapshotUnprotectRequest<I>::send_unprotect_snap_rollback() {
I &image_ctx = this->m_image_ctx;
- assert(image_ctx.owner_lock.is_locked());
+ ceph_assert(image_ctx.owner_lock.is_locked());
CephContext *cct = image_ctx.cct;
ldout(cct, 5) << this << " " << __func__ << dendl;
librados::AioCompletion *comp = this->create_callback_completion();
int r = image_ctx.md_ctx.aio_operate(image_ctx.header_oid, comp, &op);
- assert(r == 0);
+ ceph_assert(r == 0);
comp->release();
}
librados::AioCompletion *comp = this->create_callback_completion();
r = image_ctx.md_ctx.aio_operate(image_ctx.header_oid, comp, &op);
- assert(r == 0);
+ ceph_assert(r == 0);
comp->release();
// TODO legacy code threw a notification post UNPROTECTING update -- required?