Currently, it will rase and error when '/dev/sdaa' match the pattern
of the blacklist. This should not be happen as we just want sda sda1
and so on to be in the blacklist.

add one more check to avoid this error.

Signed-off-by: Mike Qiu<[email protected]>
---
 virttest/storage.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/virttest/storage.py b/virttest/storage.py
index 8fe560b..35958e6 100644
--- a/virttest/storage.py
+++ b/virttest/storage.py
@@ -85,7 +85,12 @@ def get_image_filename(params, root_dir):
                                         (re_name, matching_images,
                                          indirect_image_select))
         for protected in params.get('indirect_image_blacklist', '').split(' '):
-            if re.match(protected, image_name):
+            match_image = re.match(protected, image_name)
+            if match_image and match_image.group(0) == image_name:
+                """
+                We just need raise an error if it is totally match, such as
+                sda sda1 and so on, but sdaa should not raise an error.
+                """
                 raise virt_vm.VMDeviceError("Matching disk is in blacklist. "
                                             "name = '%s', matching = '%s' and "
                                             "selector = '%s'" %
-- 
1.7.11.7

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to