]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Merge "Improve error handling in refactored Tgt driver"
authorJenkins <jenkins@review.openstack.org>
Tue, 10 Mar 2015 15:51:48 +0000 (15:51 +0000)
committerGerrit Code Review <review@openstack.org>
Tue, 10 Mar 2015 15:51:48 +0000 (15:51 +0000)
1  2 
cinder/tests/targets/test_tgt_driver.py
cinder/volume/targets/tgt.py

index 4aca33f3cf7bce0511be9e7bd7cc62e1f73113f4,876b86ce33f5c86b1b9e9cab4d713a71a6849a61..9208c5a9be0165936670c6c455cf7cb9a5e97d32
@@@ -301,16 -309,13 +309,16 @@@ class TgtAdm(iscsi.ISCSITarget)
                            iqn,
                            run_as_root=True)
          except putils.ProcessExecutionError as e:
 -            if "can't find the target" in e.stderr:
 -                LOG.warning(_LW("Failed target removal because target "
 -                                "couldn't be found for iqn: %s."), iqn)
 +            non_fatal_errors = ("can't find the target",
 +                                "access control rule does not exist")
 +
 +            if any(error in e.stderr for error in non_fatal_errors):
 +                LOG.warning(_LW("Failed target removal because target or "
 +                                "ACL's couldn't be found for iqn: %s."), iqn)
              else:
-                 LOG.error(_LE("Failed to remove iscsi target for volume "
+                 LOG.error(_LE("Failed to remove iscsi target for Volume "
                                "ID: %(vol_id)s: %(e)s"),
-                           {'vol_id': vol_id, 'e': six.text_type(e)})
+                           {'vol_id': vol_id, 'e': e})
                  raise exception.ISCSITargetRemoveFailed(volume_id=vol_id)
          # NOTE(jdg): There's a bug in some versions of tgt that
          # will sometimes fail silently when using the force flag