mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-21 22:00:19 +00:00
rbd: use rbdVolume.open() for metadata operations
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
7a18e68a6e
commit
63c458bd63
@ -1007,14 +1007,9 @@ func resizeRBDImage(rbdVol *rbdVolume, cr *util.Credentials) error {
|
||||
}
|
||||
|
||||
func (rv *rbdVolume) GetMetadata(key string) (string, error) {
|
||||
ioctx, err := rv.conn.GetIoctx(rv.Pool)
|
||||
image, err := rv.open()
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "failed to get ioctx for %q", rv.RbdImageName)
|
||||
}
|
||||
|
||||
image, err := librbd.OpenImage(ioctx, rv.RbdImageName, librbd.NoSnapshot)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "could not open image %q", rv.RbdImageName)
|
||||
return "", err
|
||||
}
|
||||
defer image.Close()
|
||||
|
||||
@ -1022,14 +1017,9 @@ func (rv *rbdVolume) GetMetadata(key string) (string, error) {
|
||||
}
|
||||
|
||||
func (rv *rbdVolume) SetMetadata(key, value string) error {
|
||||
ioctx, err := rv.conn.GetIoctx(rv.Pool)
|
||||
image, err := rv.open()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to get ioctx for %q", rv.RbdImageName)
|
||||
}
|
||||
|
||||
image, err := librbd.OpenImage(ioctx, rv.RbdImageName, librbd.NoSnapshot)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "could not open image %q", rv.RbdImageName)
|
||||
return err
|
||||
}
|
||||
defer image.Close()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user