Don't catch an exception that cannot be raised
authorBernardo Dal Seno <bdalseno@google.com>
Thu, 9 May 2013 17:07:34 +0000 (19:07 +0200)
committerBernardo Dal Seno <bdalseno@google.com>
Tue, 14 May 2013 16:03:15 +0000 (18:03 +0200)
Since 9b221ea4, _CreateBlockDev() doesn't raise OpExecError any more. Yet
some code was left in place to catch it. By removing that code we have two
advantages:
1. Dead code is removed.
2. If for whatever reason _CreateBlockDev() raises OpExecError, the
   exception is not silently dropped and we notice (so we can fix it).

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/cmdlib.py

index 53dafc1..f55d7ea 100644 (file)
@@ -9733,9 +9733,6 @@ def _CreateDisks(lu, instance, to_skip=None, target_node=None):
       try:
         _CreateBlockDev(lu, node, instance, device, f_create, info, f_create)
         disks_created.append((node, device))
-      except errors.OpExecError:
-        logging.warning("Creating disk %s for instance '%s' failed",
-                        idx, instance.name)
       except errors.DeviceCreationError, e:
         logging.warning("Creating disk %s for instance '%s' failed",
                         idx, instance.name)