mirror of
https://github.com/ceph/ceph
synced 2024-12-30 07:23:11 +00:00
Merge pull request #20460 from colletj/v1_image_creation_disallow
librbd: disallow creation of v1 image format Reviewed-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
commit
3b08c0609c
@ -16,6 +16,9 @@ from teuthology.task.common_fs_utils import generic_mkfs
|
|||||||
from teuthology.task.common_fs_utils import generic_mount
|
from teuthology.task.common_fs_utils import generic_mount
|
||||||
from teuthology.task.common_fs_utils import default_image_name
|
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__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh -ex
|
#!/bin/sh -ex
|
||||||
|
|
||||||
|
export RBD_FORCE_ALLOW_V1=1
|
||||||
|
|
||||||
# make sure rbd pool is EMPTY.. this is a test script!!
|
# 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
|
rbd ls | wc -l | grep -v '^0$' && echo "nonempty rbd pool, aborting! run this script on an empty test cluster only." && exit 1
|
||||||
|
|
||||||
|
@ -54,6 +54,8 @@ DEFAULT_OBJECT_ORDER=22
|
|||||||
MIN_OBJECT_ORDER=12 # technically 9, but the rbd CLI enforces 12
|
MIN_OBJECT_ORDER=12 # technically 9, but the rbd CLI enforces 12
|
||||||
MAX_OBJECT_ORDER=32
|
MAX_OBJECT_ORDER=32
|
||||||
|
|
||||||
|
RBD_FORCE_ALLOW_V1=1
|
||||||
|
|
||||||
PROGNAME=$(basename $0)
|
PROGNAME=$(basename $0)
|
||||||
|
|
||||||
ORIGINAL=original-$$
|
ORIGINAL=original-$$
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#!/bin/sh -ex
|
#!/bin/sh -ex
|
||||||
|
|
||||||
|
# V1 image unsupported but required for testing purposes
|
||||||
|
export RBD_FORCE_ALLOW_V1=1
|
||||||
|
|
||||||
# returns data pool for a given image
|
# returns data pool for a given image
|
||||||
get_image_data_pool () {
|
get_image_data_pool () {
|
||||||
image=$1
|
image=$1
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
export RBD_FORCE_ALLOW_V1=1
|
||||||
|
|
||||||
function fill_image() {
|
function fill_image() {
|
||||||
local spec=$1
|
local spec=$1
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
export RBD_FORCE_ALLOW_V1=1
|
||||||
|
|
||||||
pool=rbd
|
pool=rbd
|
||||||
gen=$pool/gen
|
gen=$pool/gen
|
||||||
out=$pool/out
|
out=$pool/out
|
||||||
|
@ -873,6 +873,11 @@ bool compare_by_name(const child_info_t& c1, const child_info_t& c2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (old_format) {
|
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);
|
r = create_v1(io_ctx, image_name.c_str(), size, order);
|
||||||
} else {
|
} else {
|
||||||
ThreadPool *thread_pool;
|
ThreadPool *thread_pool;
|
||||||
|
@ -12,11 +12,11 @@ ls on empty pool never containing images
|
|||||||
|
|
||||||
create
|
create
|
||||||
=======
|
=======
|
||||||
$ rbd create -s 1024 --image-format 1 foo
|
$ RBD_FORCE_ALLOW_V1=1 rbd create -s 1024 --image-format 1 foo --log-to-stderr=false
|
||||||
rbd: image format 1 is deprecated
|
rbd: image format 1 is deprecated
|
||||||
$ rbd create -s 512 --image-format 2 bar
|
$ rbd create -s 512 --image-format 2 bar
|
||||||
$ rbd create -s 2048 --image-format 2 --image-feature layering baz
|
$ 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 --log-to-stderr=false
|
||||||
rbd: image format 1 is deprecated
|
rbd: image format 1 is deprecated
|
||||||
$ rbd create -s 1G --image-format 2 quuy
|
$ rbd create -s 1G --image-format 2 quuy
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ extern void register_test_operations();
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
setenv("RBD_FORCE_ALLOW_V1","1",1);
|
||||||
|
|
||||||
register_test_librbd();
|
register_test_librbd();
|
||||||
#ifdef TEST_LIBRBD_INTERNALS
|
#ifdef TEST_LIBRBD_INTERNALS
|
||||||
register_test_deep_copy();
|
register_test_deep_copy();
|
||||||
|
@ -37,6 +37,8 @@ pool_name = None
|
|||||||
IMG_SIZE = 8 << 20 # 8 MiB
|
IMG_SIZE = 8 << 20 # 8 MiB
|
||||||
IMG_ORDER = 22 # 4 MiB objects
|
IMG_ORDER = 22 # 4 MiB objects
|
||||||
|
|
||||||
|
os.environ["RBD_FORCE_ALLOW_V1"] = "1"
|
||||||
|
|
||||||
def setup_module():
|
def setup_module():
|
||||||
global rados
|
global rados
|
||||||
rados = Rados(conffile='')
|
rados = Rados(conffile='')
|
||||||
|
Loading…
Reference in New Issue
Block a user