pyocf: set proper OCF error codes in Volume
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
parent
c43059a4cf
commit
5fe217d96f
@ -226,4 +226,3 @@ class Data:
|
|||||||
|
|
||||||
def get_bytes(self):
|
def get_bytes(self):
|
||||||
return string_at(self.handle, self.size)
|
return string_at(self.handle, self.size)
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ class Volume(Structure):
|
|||||||
return -1
|
return -1
|
||||||
|
|
||||||
if volume.opened:
|
if volume.opened:
|
||||||
return OcfErrorCode.OCF_ERR_NOT_OPEN_EXC
|
return -OcfErrorCode.OCF_ERR_NOT_OPEN_EXC
|
||||||
|
|
||||||
Volume._instances_[ref] = weakref.ref(volume)
|
Volume._instances_[ref] = weakref.ref(volume)
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ class Volume(Structure):
|
|||||||
|
|
||||||
discard.contents._end(discard, 0)
|
discard.contents._end(discard, 0)
|
||||||
except: # noqa E722
|
except: # noqa E722
|
||||||
discard.contents._end(discard, -5)
|
discard.contents._end(discard, -OcfErrorCode.OCF_ERR_NOT_SUPP)
|
||||||
|
|
||||||
def get_stats(self):
|
def get_stats(self):
|
||||||
return self.stats
|
return self.stats
|
||||||
@ -299,7 +299,7 @@ class Volume(Structure):
|
|||||||
|
|
||||||
io.contents._end(io, 0)
|
io.contents._end(io, 0)
|
||||||
except: # noqa E722
|
except: # noqa E722
|
||||||
io.contents._end(io, -5)
|
io.contents._end(io, -OcfErrorCode.OCF_ERR_IO)
|
||||||
|
|
||||||
def dump(self, offset=0, size=0, ignore=VOLUME_POISON, **kwargs):
|
def dump(self, offset=0, size=0, ignore=VOLUME_POISON, **kwargs):
|
||||||
if size == 0:
|
if size == 0:
|
||||||
@ -359,7 +359,7 @@ class ErrorDevice(Volume):
|
|||||||
error = False
|
error = False
|
||||||
if error:
|
if error:
|
||||||
self.error = True
|
self.error = True
|
||||||
io.contents._end(io, -5)
|
io.contents._end(io, -OcfErrorCode.OCF_ERR_IO)
|
||||||
self.stats["errors"][direction] += 1
|
self.stats["errors"][direction] += 1
|
||||||
else:
|
else:
|
||||||
super().submit_io(io)
|
super().submit_io(io)
|
||||||
|
Loading…
Reference in New Issue
Block a user