Merge pull request #65 from mmichal10/test-for-existing-metadata

Test for existing metadata
This commit is contained in:
Adam Rutkowski 2019-07-10 10:51:29 -04:00 committed by GitHub
commit 5d621d63b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 20 deletions

View File

@ -132,6 +132,12 @@ struct {
OCF_ERR_NO_METADATA, OCF_ERR_NO_METADATA,
"No metadata found on device" "No metadata found on device"
}, },
{
OCF_ERR_METADATA_FOUND,
"Old metadata found on device.\nPlease load cache metadata using --load"
" option or use --force to\n discard on-disk metadata and"
" start fresh cache instance.\n"
},
/* CAS kernel error mappings*/ /* CAS kernel error mappings*/
{ {

2
ocf

@ -1 +1 @@
Subproject commit 6c869d97fbf2f3fe862e106317fb1d22914723b6 Subproject commit 999f3f724548cf69bb93b96cd17a5c122c178caf

View File

@ -31,7 +31,7 @@ TARGET_DEVICE_OPTION="$CACHE_DEVICE" PARTITION_SIZE_OPTION="2000M" PARTITION_IDS
# Try to start positive caches in loop and later stop them - if any of those operations fails, it # Try to start positive caches in loop and later stop them - if any of those operations fails, it
# means the cache ID is invalid # means the cache ID is invalid
for ID in $POSITIVE_IDS ; do for ID in $POSITIVE_IDS ; do
CACHE_ID_OPTION="$ID" CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" start_cache CACHE_ID_OPTION="$ID" CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" CACHE_FORCE_OPTION="yes" start_cache
CACHE_ID_OPTION="$ID" stop_cache CACHE_ID_OPTION="$ID" stop_cache
done done
@ -40,7 +40,8 @@ done
# ID, because the framework will treat it as an undefined option and will fail the test # ID, because the framework will treat it as an undefined option and will fail the test
# automatically. # automatically.
for ID in $NEGATIVE_IDS ; do for ID in $NEGATIVE_IDS ; do
NEGATIVE_TEST_OPTION="1" CACHE_ID_OPTION="$ID" CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" start_cache NEGATIVE_TEST_OPTION="1" CACHE_ID_OPTION="$ID"
CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" CACHE_FORCE_OPTION="yes" start_cache
done done
# Always return 0 at the end of the test - if at any point something has failed # Always return 0 at the end of the test - if at any point something has failed

View File

@ -42,7 +42,8 @@ do
echo "------Start CAS Linux in $mode mode" echo "------Start CAS Linux in $mode mode"
# This is where the real test starts # This is where the real test starts
CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}"1 CACHE_MODE_OPTION="$mode" start_cache CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}"1 CACHE_MODE_OPTION="$mode"
CACHE_FORCE_OPTION="yes" start_cache
CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}"1 add_core CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}"1 add_core
sleep 2 sleep 2
@ -73,7 +74,8 @@ do
echo "------Start CAS Linux in $mode mode" echo "------Start CAS Linux in $mode mode"
# This is where the real test starts # This is where the real test starts
CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}"1 CACHE_MODE_OPTION="$mode" start_cache CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}"1 CACHE_MODE_OPTION="$mode"
CACHE_FORCE_OPTION="yes" start_cache
CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}"1 add_core CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}"1 add_core
sleep 2 sleep 2

View File

@ -49,3 +49,4 @@ sdb
utf utf
wa wa
wb wb
wo

View File

@ -413,6 +413,8 @@ iteration() {
if [ "$load_metadata" == "on" ] ; then if [ "$load_metadata" == "on" ] ; then
CACHE_LOAD_METADATA_OPTION="$load_metadata" CACHE_LOAD_METADATA_OPTION="$load_metadata"
echo "Load metadata option: on" echo "Load metadata option: on"
else
L_MAKE_PARTITIONS=1
fi fi
MAKE_PARTITIONS=${L_MAKE_PARTITIONS} MAKE_PARTITIONS=${L_MAKE_PARTITIONS}