diff --git a/qa/tasks/rbd.py b/qa/tasks/rbd.py index e6701aff94c50..193ab1c3961a0 100644 --- a/qa/tasks/rbd.py +++ b/qa/tasks/rbd.py @@ -16,6 +16,9 @@ from teuthology.task.common_fs_utils import generic_mount from teuthology.task.common_fs_utils import default_image_name +#V1 image unsupported but required for testing purposes +os.environ["RBD_FORCE_ALLOW_V1"] = "1" + log = logging.getLogger(__name__) @contextlib.contextmanager diff --git a/qa/workunits/rbd/cli_generic.sh b/qa/workunits/rbd/cli_generic.sh index 3a4bdb39ebbd7..11d6b73d832f5 100755 --- a/qa/workunits/rbd/cli_generic.sh +++ b/qa/workunits/rbd/cli_generic.sh @@ -1,5 +1,7 @@ #!/bin/sh -ex +export RBD_FORCE_ALLOW_V1=1 + # make sure rbd pool is EMPTY.. this is a test script!! rbd ls | wc -l | grep -v '^0$' && echo "nonempty rbd pool, aborting! run this script on an empty test cluster only." && exit 1 diff --git a/qa/workunits/rbd/image_read.sh b/qa/workunits/rbd/image_read.sh index 779e315fec4f0..ddca8356ef6b7 100755 --- a/qa/workunits/rbd/image_read.sh +++ b/qa/workunits/rbd/image_read.sh @@ -54,6 +54,8 @@ DEFAULT_OBJECT_ORDER=22 MIN_OBJECT_ORDER=12 # technically 9, but the rbd CLI enforces 12 MAX_OBJECT_ORDER=32 +RBD_FORCE_ALLOW_V1=1 + PROGNAME=$(basename $0) ORIGINAL=original-$$ diff --git a/qa/workunits/rbd/import_export.sh b/qa/workunits/rbd/import_export.sh index deb28051413bc..57e0595343a17 100755 --- a/qa/workunits/rbd/import_export.sh +++ b/qa/workunits/rbd/import_export.sh @@ -1,5 +1,8 @@ #!/bin/sh -ex +# V1 image unsupported but required for testing purposes +export RBD_FORCE_ALLOW_V1=1 + # returns data pool for a given image get_image_data_pool () { image=$1 diff --git a/qa/workunits/rbd/krbd_data_pool.sh b/qa/workunits/rbd/krbd_data_pool.sh index 7ecdf03d6b121..23dc3806015fe 100755 --- a/qa/workunits/rbd/krbd_data_pool.sh +++ b/qa/workunits/rbd/krbd_data_pool.sh @@ -2,6 +2,8 @@ set -ex +export RBD_FORCE_ALLOW_V1=1 + function fill_image() { local spec=$1 diff --git a/qa/workunits/rbd/merge_diff.sh b/qa/workunits/rbd/merge_diff.sh index d0f26072eeeb6..eb8597304d0b1 100755 --- a/qa/workunits/rbd/merge_diff.sh +++ b/qa/workunits/rbd/merge_diff.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -ex +export RBD_FORCE_ALLOW_V1=1 + pool=rbd gen=$pool/gen out=$pool/out diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 6141f6e2b6034..bedabe4397795 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -869,6 +869,11 @@ bool compare_by_name(const child_info_t& c1, const child_info_t& c2) } if (old_format) { + if ( !getenv("RBD_FORCE_ALLOW_V1") ) { + lderr(cct) << "Format 1 image creation unsupported. " << dendl; + return -EINVAL; + } + lderr(cct) << "Forced V1 image creation. " << dendl; r = create_v1(io_ctx, image_name.c_str(), size, order); } else { ThreadPool *thread_pool; diff --git a/src/test/cli-integration/rbd/formatted-output.t b/src/test/cli-integration/rbd/formatted-output.t index eae9d4ea01fb8..6859ff965b830 100644 --- a/src/test/cli-integration/rbd/formatted-output.t +++ b/src/test/cli-integration/rbd/formatted-output.t @@ -12,11 +12,11 @@ ls on empty pool never containing images create ======= - $ rbd create -s 1024 --image-format 1 foo + $ RBD_FORCE_ALLOW_V1=1 rbd create -s 1024 --image-format 1 foo rbd: image format 1 is deprecated $ rbd create -s 512 --image-format 2 bar $ rbd create -s 2048 --image-format 2 --image-feature layering baz - $ rbd create -s 1 --image-format 1 quux + $ RBD_FORCE_ALLOW_V1=1 rbd create -s 1 --image-format 1 quux rbd: image format 1 is deprecated $ rbd create -s 1G --image-format 2 quuy diff --git a/src/test/librbd/test_main.cc b/src/test/librbd/test_main.cc index 654c8912d6f7e..932163147c4fb 100644 --- a/src/test/librbd/test_main.cc +++ b/src/test/librbd/test_main.cc @@ -24,6 +24,8 @@ extern void register_test_operations(); int main(int argc, char **argv) { + setenv("RBD_FORCE_ALLOW_V1","1",1); + register_test_librbd(); #ifdef TEST_LIBRBD_INTERNALS register_test_deep_copy(); diff --git a/src/test/pybind/test_rbd.py b/src/test/pybind/test_rbd.py index 6ce6c32c9d5cc..a6d308ee13710 100644 --- a/src/test/pybind/test_rbd.py +++ b/src/test/pybind/test_rbd.py @@ -37,6 +37,8 @@ IMG_SIZE = 8 << 20 # 8 MiB IMG_ORDER = 22 # 4 MiB objects +os.environ["RBD_FORCE_ALLOW_V1"] = "1" + def setup_module(): global rados rados = Rados(conffile='')