mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-24 15:20:19 +00:00
rbd: close the RBD-image after adding it to a VolumeGroup
When the image is not closed, it keeps a watch open. This prevents the
CSI Controller to delete the Volume, as there is still a user of it.
Fixes: f9ab14e826
"rbd: check if an image is part of a group before adding it"
Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
b4592a55eb
commit
6d88e0a4c7
@ -44,6 +44,7 @@ func (rv *rbdVolume) AddToGroup(ctx context.Context, vg types.VolumeGroup) error
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to open image %q: %w", rv, err)
|
return fmt.Errorf("failed to open image %q: %w", rv, err)
|
||||||
}
|
}
|
||||||
|
defer image.Close()
|
||||||
|
|
||||||
info, err := image.GetGroup()
|
info, err := image.GetGroup()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user