Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

librbd: disallow creation of v1 image format #20460

Merged
merged 4 commits into from Apr 3, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions 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

Expand Down
2 changes: 2 additions & 0 deletions qa/workunits/rbd/image_read.sh
Expand Up @@ -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-$$
Expand Down
2 changes: 2 additions & 0 deletions qa/workunits/rbd/krbd_data_pool.sh
Expand Up @@ -2,6 +2,8 @@

set -ex

export RBD_FORCE_ALLOW_V1=1

function fill_image() {
local spec=$1

Expand Down
2 changes: 2 additions & 0 deletions 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
Expand Down
5 changes: 5 additions & 0 deletions src/librbd/internal.cc
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/test/librbd/test_main.cc
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/test/pybind/test_rbd.py
Expand Up @@ -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='')
Expand Down