mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
rbd: open new ioctx connection
if the parent and child clones are in different namespaces we need to open a new ioctx for pools. Co-authored-by: Madhu Rajanna <madhupr007@gmail.com> Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
parent
b63b0bf18d
commit
3898ae34a7
@ -532,23 +532,26 @@ func deleteImage(ctx context.Context, pOpts *rbdVolume, cr *util.Credentials) er
|
|||||||
func (rv *rbdVolume) getCloneDepth(ctx context.Context) (uint, error) {
|
func (rv *rbdVolume) getCloneDepth(ctx context.Context) (uint, error) {
|
||||||
var depth uint
|
var depth uint
|
||||||
vol := rbdVolume{}
|
vol := rbdVolume{}
|
||||||
defer vol.Destroy()
|
|
||||||
|
|
||||||
vol.Pool = rv.Pool
|
vol.Pool = rv.Pool
|
||||||
vol.Monitors = rv.Monitors
|
vol.Monitors = rv.Monitors
|
||||||
vol.RbdImageName = rv.RbdImageName
|
vol.RbdImageName = rv.RbdImageName
|
||||||
vol.conn = rv.conn.Copy()
|
vol.conn = rv.conn.Copy()
|
||||||
|
|
||||||
|
for {
|
||||||
|
if vol.RbdImageName == "" {
|
||||||
|
return depth, nil
|
||||||
|
}
|
||||||
err := vol.openIoctx()
|
err := vol.openIoctx()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return depth, err
|
return depth, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
|
||||||
if vol.RbdImageName == "" {
|
|
||||||
return depth, nil
|
|
||||||
}
|
|
||||||
err = vol.getImageInfo()
|
err = vol.getImageInfo()
|
||||||
|
// FIXME: create and destroy the vol inside the loop.
|
||||||
|
// see https://github.com/ceph/ceph-csi/pull/1838#discussion_r598530807
|
||||||
|
vol.ioctx.Destroy()
|
||||||
|
vol.ioctx = nil
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// if the parent image is moved to trash the name will be present
|
// if the parent image is moved to trash the name will be present
|
||||||
// in rbd image info but the image will be in trash, in that case
|
// in rbd image info but the image will be in trash, in that case
|
||||||
@ -702,7 +705,6 @@ func (rv *rbdVolume) hasFeature(feature uint64) bool {
|
|||||||
|
|
||||||
func (rv *rbdVolume) checkImageChainHasFeature(ctx context.Context, feature uint64) (bool, error) {
|
func (rv *rbdVolume) checkImageChainHasFeature(ctx context.Context, feature uint64) (bool, error) {
|
||||||
vol := rbdVolume{}
|
vol := rbdVolume{}
|
||||||
defer vol.Destroy()
|
|
||||||
|
|
||||||
vol.Pool = rv.Pool
|
vol.Pool = rv.Pool
|
||||||
vol.RadosNamespace = rv.RadosNamespace
|
vol.RadosNamespace = rv.RadosNamespace
|
||||||
@ -710,16 +712,20 @@ func (rv *rbdVolume) checkImageChainHasFeature(ctx context.Context, feature uint
|
|||||||
vol.RbdImageName = rv.RbdImageName
|
vol.RbdImageName = rv.RbdImageName
|
||||||
vol.conn = rv.conn.Copy()
|
vol.conn = rv.conn.Copy()
|
||||||
|
|
||||||
|
for {
|
||||||
|
if vol.RbdImageName == "" {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
err := vol.openIoctx()
|
err := vol.openIoctx()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
|
||||||
if vol.RbdImageName == "" {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
err = vol.getImageInfo()
|
err = vol.getImageInfo()
|
||||||
|
// FIXME: create and destroy the vol inside the loop.
|
||||||
|
// see https://github.com/ceph/ceph-csi/pull/1838#discussion_r598530807
|
||||||
|
vol.ioctx.Destroy()
|
||||||
|
vol.ioctx = nil
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// call to getImageInfo returns the parent name even if the parent
|
// call to getImageInfo returns the parent name even if the parent
|
||||||
// is in the trash, when we try to open the parent image to get its
|
// is in the trash, when we try to open the parent image to get its
|
||||||
|
Loading…
Reference in New Issue
Block a user