From: Ilya Dryomov Date: Sun, 31 Jan 2021 13:27:52 +0000 (+0100) Subject: qa/tasks/rbd: dev_create() expects a properties dict X-Git-Tag: v17.1.0~3087^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0357c0215b2fbbf7fa801331df1f92b101ad9d5e;p=ceph.git qa/tasks/rbd: dev_create() expects a properties dict In order to add encryption_format property, commit 3754c665a11e (":qa/tasks/rbd: test qemu on top of rbd encryption") changed the dev_create() contract. It now expects a properties dict, but the main task routine wasn't updated and still passes role_images. On top of that, role_images itself got broken. It is supposed to be a mapping from role to a corresponding image name, not to a dict with an image_name key. This affected generic_mount(). Signed-off-by: Ilya Dryomov --- diff --git a/qa/tasks/rbd.py b/qa/tasks/rbd.py index 46c55c6ad2b2f..1a854da86a7a3 100644 --- a/qa/tasks/rbd.py +++ b/qa/tasks/rbd.py @@ -265,9 +265,9 @@ def dev_create(ctx, config): "task dev_create only supports a list or dictionary for configuration" if isinstance(config, dict): - role_images = config.items() + images = config.items() else: - role_images = [(role, None) for role in config] + images = [(role, None) for role in config] log.info('Creating rbd block devices...') @@ -275,7 +275,7 @@ def dev_create(ctx, config): passphrase_file = '{tdir}/passphrase'.format(tdir=testdir) device_path = {} - for role, properties in role_images: + for role, properties in images: if properties is None: properties = {} name = properties.get('image_name', default_image_name(role)) @@ -329,7 +329,7 @@ def dev_create(ctx, config): finally: log.info('Unmapping rbd devices...') remote.run(args=['rm', '-f', passphrase_file]) - for role, properties in role_images: + for role, properties in images: if not device_path.get(role): continue @@ -683,7 +683,7 @@ def task(ctx, config): for role, properties in norm_config.items(): if properties is None: properties = {} - role_images[role] = {'image_name': properties.get('image_name')} + role_images[role] = properties.get('image_name') else: role_images = norm_config @@ -692,7 +692,7 @@ def task(ctx, config): with contextutil.nested( lambda: create_image(ctx=ctx, config=norm_config), lambda: modprobe(ctx=ctx, config=norm_config), - lambda: dev_create(ctx=ctx, config=role_images), + lambda: dev_create(ctx=ctx, config=norm_config), lambda: generic_mkfs(ctx=ctx, config=norm_config, devname_rtn=rbd_devname_rtn), lambda: generic_mount(ctx=ctx, config=role_images,