mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
rbd: use rados namespace for manager command
Currently we have a bug that we are not using rados namespace when adding ceph manager command to remove the image from the trash. This commit adds the missing rados namespace when adding ceph manager task. without fix the image will be moved to trash and no task will be added to remove from the trash. it will become ceph responsibility to remove the image from trash when it will cleanup the trash. workaroud: manually purge the trash Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
d14c0afe28
commit
8f185bf7b2
@ -523,6 +523,16 @@ func addRbdManagerTask(ctx context.Context, pOpts *rbdVolume, arg []string) (boo
|
|||||||
return supported, err
|
return supported, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getTrashPath returns the image path for trash operation.
|
||||||
|
func (rv *rbdVolume) getTrashPath() string {
|
||||||
|
trashPath := rv.Pool
|
||||||
|
if rv.RadosNamespace != "" {
|
||||||
|
trashPath = trashPath + "/" + rv.RadosNamespace
|
||||||
|
}
|
||||||
|
|
||||||
|
return trashPath + "/" + rv.ImageID
|
||||||
|
}
|
||||||
|
|
||||||
// deleteImage deletes a ceph image with provision and volume options.
|
// deleteImage deletes a ceph image with provision and volume options.
|
||||||
func deleteImage(ctx context.Context, pOpts *rbdVolume, cr *util.Credentials) error {
|
func deleteImage(ctx context.Context, pOpts *rbdVolume, cr *util.Credentials) error {
|
||||||
image := pOpts.RbdImageName
|
image := pOpts.RbdImageName
|
||||||
@ -556,9 +566,10 @@ func deleteImage(ctx context.Context, pOpts *rbdVolume, cr *util.Credentials) er
|
|||||||
}
|
}
|
||||||
|
|
||||||
// attempt to use Ceph manager based deletion support if available
|
// attempt to use Ceph manager based deletion support if available
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
"trash", "remove",
|
"trash", "remove",
|
||||||
pOpts.Pool + "/" + pOpts.ImageID,
|
pOpts.getTrashPath(),
|
||||||
"--id", cr.ID,
|
"--id", cr.ID,
|
||||||
"--keyfile=" + cr.KeyFile,
|
"--keyfile=" + cr.KeyFile,
|
||||||
"-m", pOpts.Monitors,
|
"-m", pOpts.Monitors,
|
||||||
|
Loading…
Reference in New Issue
Block a user