Commit Graph

1701 Commits

Author SHA1 Message Date
Jan Musial
01166ba55e Security test for cache exported object
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-07-19 10:50:11 +02:00
Jan Musial
b3bd778a78 pyocf: simplify volume open/close API
Make Volumes usable by both pyocf and OCF with clear open/_open split
and clean-up of instance/uuid tracking on C interface only.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-07-19 10:50:11 +02:00
Jan Musial
b1b3e134cf pyocf: clean-up hanging device reference
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-07-19 10:50:11 +02:00
Jan Musial
a0c6995189 pyocf: make open/close explicit
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-07-19 10:50:11 +02:00
Jan Musial
abc726d7f8 pyocf: warn about not-closed Volumes
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-07-19 10:50:11 +02:00
Jan Musial
4328fd77b0 pyocf: don't store UUIDs in Cache object
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-07-19 10:50:11 +02:00
Jan Musial
cfd8eea0c0 pyocf: fix cache device references
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-07-19 10:50:11 +02:00
Jan Musial
1bdf4a13ae pyocf: Improve volume instance lifecycle handling
We need a strong reference to volume for as long as OCF has it open.
For that I changed instance tracking dictionary from weakvalue to
normal. This way I made sure that GC won't clean up Volume before its
closed.

Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-07-19 10:50:11 +02:00
Jan Musial
83a28825d2 pyocf: Load standby from device
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-07-19 10:50:11 +02:00
Jan Musial
d87bdc3a43 pyocf: Improve buffer logger to also print on console
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-07-19 10:50:11 +02:00
Jan Musial
2aaa69b33b pyocf: Add helper for superblock size
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-07-19 10:50:11 +02:00
Jan Musial
eac7d64456 pyocf: Parse size from string
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-07-19 10:50:11 +02:00
Robert Baldyga
eb5f4f79e4
Merge pull request #744 from kmajzero/fix_dmesg_metadata_size
Fix for bad metadata capacity reported by dmesg
2022-07-06 17:17:36 +02:00
Krzysztof Majzerowicz-Jaszcz
e12803f547 Fix for bad metadata capacity reported by dmesg
Metadata capacity reported by dmesg was actually a memory footprint.

A proper size of metadata is now reported.

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2022-07-06 14:30:39 +02:00
Robert Baldyga
2defff1da0
Merge pull request #734 from arutk/cvoltests3
pyocf: composite volume I/O address range tests
2022-06-29 14:16:52 +02:00
Adam Rutkowski
69ef673bd1 pyocf: composite volume tests
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-29 12:30:21 +02:00
Adam Rutkowski
81396681f4 pyocf: extend OcfCompletion
1. add optional timeout and return value to wait()
2. add method to check whether completion was triggered

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-29 12:30:21 +02:00
Adam Rutkowski
e2ea2b41e6 pyocf: extend ErrorDevice to inject error on flush and discard
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-29 12:30:21 +02:00
Robert Baldyga
8b83f0f164
Merge pull request #743 from arutk/270622
volume init/deinit enhancements
2022-06-28 09:38:24 +02:00
Adam Rutkowski
5a71f7c068 validate uuid->size in ocf_volume_init
Optional uuid parameter to ocf_volume_init() points to UUID object
initialized by the user. We should verify it is not excesively large
as we attempt to allocate a buffer to store a copy of the UUID.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-28 08:02:58 +02:00
Adam Rutkowski
364e36ec7e Revert "fix deinitialization of moved composite volume"
The proper way to avoid calling on_deinit() callback on an already
deinitialized volume is to deinitialize type callbacks, as it is done
in the previous commit.

This reverts commit a7f70687a9.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-28 08:02:58 +02:00
Adam Rutkowski
b6587ad622 zero volume->type in ocf_volume_deinit()
After deinitialization of volume there is no need to call back to
type ops. Currently we would erroneously call on_deinit() callback
multiple times if ocf_volume_deinit() is performed more than once,
which we expect to happen and treat as a correct use of API.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-28 08:02:58 +02:00
Robert Baldyga
f0f6ff219b Set core volume type in metadata on core insert
ocf_metadata_flush_superblock() is being called on the cache stop, after
deinitialization of the cores (and their volumes), thus accessing core
volume in superblock flushing procedure leads to use-after-free bug.

Fix this by moving volume type setting to the core insertion code.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-28 07:59:43 +02:00
Robert Baldyga
7cf58bb326
Merge pull request #733 from pdebski21/composite_volume_test2
Composite volume tests load and attach
2022-06-27 13:40:40 +02:00
Robert Baldyga
b43ff83e33
Merge pull request #742 from jfckm/cleaner-disabled-cp-setting
Tests for disabled_cleaner setting
2022-06-24 14:01:38 +02:00
Piotr Debski
f4eb291235 pyocf: Composite volume tests
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-22 17:31:46 +02:00
Robert Baldyga
641649f6a9 pyocf: Refactor _cvol_io() function
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-22 17:31:27 +02:00
Jan Musial
b39161f1aa pyocf: implement test_attach_cleaner_disabled_non_default
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-06-22 14:02:14 +02:00
Jan Musial
b898f5c336 pyocf: implement test_cleaner_disabled_nop
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-06-22 14:02:14 +02:00
Jan Musial
fb83a182ee pyocf: API for getting cleaning policy from cache
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-06-22 14:02:14 +02:00
Jan Musial
2f289bd873 pyocf: update OcfErrorCode with new code
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-06-22 14:02:14 +02:00
Robert Baldyga
9a22ef0917
Merge pull request #736 from pdebski21/tests_disable_cleaner2
Tests disable cleaner
2022-06-22 13:56:43 +02:00
Robert Baldyga
c4e1ebe262
Merge pull request #741 from robertbaldyga/metadata_volatile_tests
pyocf: Metadata volatile tests
2022-06-22 12:37:19 +02:00
Robert Baldyga
ef4bfc9ac3 pyocf: Make cache lookup by name a common utility
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-22 12:01:54 +02:00
Piotr Debski
5441cdb50a Cache API changes for disable_cleaner option
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
2022-06-22 12:01:54 +02:00
Piotr Debski
b4f2866155 Tests cleaner disabled
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
2022-06-22 12:01:54 +02:00
Robert Baldyga
597eb0c24c pyocf: Metadata volatile tests
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-22 09:03:38 +02:00
Robert Baldyga
f867559496
Merge pull request #739 from robertbaldyga/fix-disable-cleaner-calculation
Fix metadata on disk size calculation when cleaner is disabled
2022-06-21 15:48:24 +02:00
Robert Baldyga
8822094f14 Fix metadata on disk size calculation when cleaner is disabled
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-21 09:33:42 +02:00
Robert Baldyga
adfa76a21a
Merge pull request #735 from robertbaldyga/fix-example-vol-destroy
example: Fix ocf_volume destruction in error handling code
2022-06-20 16:06:05 +02:00
Robert Baldyga
6d1270cdd4
Merge pull request #732 from pdebski21/pipeline_conditional_step
Validate metadata segments in cleaning section - Pipeline conditional step
2022-06-20 16:05:49 +02:00
Piotr Debski
c448043b42 Conditional pipeline step for filtering invalid segments
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
2022-06-16 09:33:09 +02:00
Adam Rutkowski
1a27b07f72 Pipeline conditional step
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
Signed-off-by: Piotr Debski <piotr.debski@intel.com>
2022-06-16 09:33:09 +02:00
Robert Baldyga
a525cb9f62 example: Fix ocf_volume destruction in error handling code
Pass the right pointer type to function ocf_volume_destroy().

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2022-06-14 16:17:45 +02:00
Adam Rutkowski
3f552703f5
Merge pull request #727 from arutk/pyvolume
pyocf: composite volume API and initial tests
2022-06-14 11:04:29 +02:00
Adam Rutkowski
ae735b4434 pyocf: composite volume tests
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-13 11:40:41 +02:00
Adam Rutkowski
96c5ef1d01 pyocf: register composite volume type id in ctx
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-13 11:40:41 +02:00
Adam Rutkowski
8f2fac399e pyocf: composite volume class
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-13 11:40:41 +02:00
Adam Rutkowski
0f8183157d pyocf: rename ExpObjVolume to OcfInternalVolume
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-13 11:40:41 +02:00
Adam Rutkowski
6195967483 pyocf: use device.handle for device config if available
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-06-13 11:40:41 +02:00