mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
rbd: prevent panic when using rbdImage that is not connected
When an `rbdVolume` or `rbdSnapshot` is not connected with credentials to the Ceph cluster, operations may try to get the IOContext which then causes a panic. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
c2cbb25489
commit
05d501a728
@ -468,6 +468,10 @@ func (ri *rbdImage) openIoctx() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if ri.conn == nil {
|
||||
return fmt.Errorf("can not get IOContext of unconnected image %q", ri)
|
||||
}
|
||||
|
||||
ioctx, err := ri.conn.GetIoctx(ri.Pool)
|
||||
if err != nil {
|
||||
// GetIoctx() can return util.ErrPoolNotFound
|
||||
|
Loading…
Reference in New Issue
Block a user