]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/rbd: dev_create() expects a properties dict
authorIlya Dryomov <idryomov@gmail.com>
Sun, 31 Jan 2021 13:27:52 +0000 (14:27 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 1 Feb 2021 16:05:47 +0000 (17:05 +0100)
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 <idryomov@gmail.com>
qa/tasks/rbd.py

index 46c55c6ad2b2f9adb0b4dd03d92bcc13f33a5450..1a854da86a7a3f39604b7743775a7be7f9d6a6d9 100644 (file)
@@ -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,