Change error code and add new

Change 'OCF_ERR_START_CACHE_FAIL' to 'OCF_ERR_NO_MEM' while CAS fails in case of memory lack on device.
Add new error code for case, when device doesn't satisfy CAS requirements - 'OCF_ERR_INVAL_CACHE_DEV'.
Use 'OCF_ERR_INVAL_CACHE_DEV' in code.
Update error code match in test.
closes #317 issue

Signed-off-by: Ostrokrzew <slawomir.jankowski@intel.com>
This commit is contained in:
Ostrokrzew
2019-12-17 10:15:52 +01:00
parent 3aa68bcb15
commit 3fca309e51
4 changed files with 8 additions and 4 deletions

View File

@@ -47,6 +47,7 @@ class OcfErrorCode(IntEnum):
OCF_ERR_INVALID_CACHE_MODE = auto()
OCF_ERR_INVALID_CACHE_LINE_SIZE = auto()
OCF_ERR_CACHE_NAME_MISMATCH = auto()
OCF_ERR_INVAL_CACHE_DEV = auto()
class OcfCompletion:

View File

@@ -359,7 +359,7 @@ def test_start_too_small_device(pyocf_ctx, mode, cls):
cache_device = Volume(Size.from_B(20 * 1024 * 1024 - 1))
with pytest.raises(OcfError, match="OCF_ERR_START_CACHE_FAIL"):
with pytest.raises(OcfError, match="OCF_ERR_INVAL_CACHE_DEV"):
Cache.start_on_device(cache_device, cache_mode=mode, cache_line_size=cls)