rados: modify validate() to return ErrInvalidIOContext error

If ioctx is not ready to be used then validate() should
return ErrInvalidIOContext error.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
This commit is contained in:
Mudit Agarwal 2020-07-30 07:53:59 +05:30 committed by John Mulligan
parent 8788a901dc
commit 558b366fbb
2 changed files with 4 additions and 1 deletions

View File

@ -54,6 +54,9 @@ var (
// ErrEmptyArgument may be returned if a function argument is passed
// a zero-length slice or map.
ErrEmptyArgument = errors.New("Argument must contain at least one item")
// ErrInvalidIOContext may be returned if an api call requires an IOContext
// but IOContext is not ready for use.
ErrInvalidIOContext = errors.New("IOContext is not ready for use")
)
// Public radosErrors:

View File

@ -96,7 +96,7 @@ type IOContext struct {
// with ceph C calls.
func (ioctx *IOContext) validate() error {
if ioctx.ioctx == nil {
return ErrNotConnected
return ErrInvalidIOContext
}
return nil
}