mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
rbd: add function (cc *ClusterConnection) GetTaskAdmin()
This function returns new go-ceph TaskAdmin to add tasks on rbd volumes. Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
parent
420aa9ec57
commit
c19264e996
@ -676,15 +676,13 @@ func (rv *rbdVolume) deleteImage(ctx context.Context) error {
|
||||
// otherwise removes the image from trash.
|
||||
func (rv *rbdVolume) trashRemoveImage(ctx context.Context) error {
|
||||
// attempt to use Ceph manager based deletion support if available
|
||||
log.DebugLog(ctx, "rbd: adding task to remove image %s with id %s from trash", rv, rv.ImageID)
|
||||
|
||||
ra, err := rv.conn.GetRBDAdmin()
|
||||
ta, err := rv.conn.GetTaskAdmin()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.DebugLog(ctx, "rbd: adding task to remove image %s with id %s from trash", rv, rv.ImageID)
|
||||
|
||||
ta := ra.Task()
|
||||
_, err = ta.AddTrashRemove(admin.NewImageSpec(rv.Pool, rv.RadosNamespace, rv.ImageID))
|
||||
|
||||
rbdCephMgrSupported := isCephMgrSupported(ctx, rv.ClusterID, err)
|
||||
@ -828,14 +826,13 @@ func (rv *rbdVolume) flattenRbdImage(
|
||||
return nil
|
||||
}
|
||||
|
||||
ra, err := rv.conn.GetRBDAdmin()
|
||||
log.DebugLog(ctx, "rbd: adding task to flatten image %q", rv)
|
||||
|
||||
ta, err := rv.conn.GetTaskAdmin()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.DebugLog(ctx, "rbd: adding task to flatten image %s", rv)
|
||||
|
||||
ta := ra.Task()
|
||||
_, err = ta.AddFlatten(admin.NewImageSpec(rv.Pool, rv.RadosNamespace, rv.RbdImageName))
|
||||
rbdCephMgrSupported := isCephMgrSupported(ctx, rv.ClusterID, err)
|
||||
if rbdCephMgrSupported {
|
||||
|
@ -131,6 +131,16 @@ func (cc *ClusterConnection) GetRBDAdmin() (*ra.RBDAdmin, error) {
|
||||
return ra.NewFromConn(cc.conn), nil
|
||||
}
|
||||
|
||||
// GetTaskAdmin returns TaskAdmin to add tasks on rbd images.
|
||||
func (cc *ClusterConnection) GetTaskAdmin() (*ra.TaskAdmin, error) {
|
||||
rbdAdmin, err := cc.GetRBDAdmin()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return rbdAdmin.Task(), nil
|
||||
}
|
||||
|
||||
// DisableDiscardOnZeroedWriteSame enables the
|
||||
// `rbd_discard_on_zeroed_write_same` option in the cluster connection, so that
|
||||
// writing zero blocks of data are actual writes on the OSDs (doing
|
||||
|
Loading…
Reference in New Issue
Block a user