]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Log iSCSI target output on error.
authorAvishay Traeger <avishay@il.ibm.com>
Tue, 4 Jun 2013 08:46:20 +0000 (11:46 +0300)
committerAvishay Traeger <avishay@il.ibm.com>
Tue, 4 Jun 2013 08:46:20 +0000 (11:46 +0300)
Add the command output on error to aid in debugging.

Change-Id: Ib505eaeba7f1ca0e54e99dec8ebbbf71df3e5a51
Fixes: bug 1186991
cinder/brick/iscsi/iscsi.py

index 5748697075b016b8c65522093b823b3a9f414401..d09ae7ab56f8d71347d4f1398313433729743a36 100644 (file)
@@ -167,9 +167,10 @@ class TgtAdm(TargetAdmin):
                                        '--update',
                                        name,
                                        run_as_root=True)
-        except exception.ProcessExecutionError, e:
+        except exception.ProcessExecutionError as e:
             LOG.error(_("Failed to create iscsi target for volume "
-                        "id:%(vol_id)s.") % locals())
+                        "id:%(vol_id)s: %(e)s")
+                      % {'vol_id': vol_id, 'e': str(e)})
 
             #Don't forget to remove the persistent file we created
             os.unlink(volume_path)
@@ -205,9 +206,10 @@ class TgtAdm(TargetAdmin):
                           '--delete',
                           iqn,
                           run_as_root=True)
-        except exception.ProcessExecutionError, e:
+        except exception.ProcessExecutionError as e:
             LOG.error(_("Failed to remove iscsi target for volume "
-                        "id:%(vol_id)s.") % locals())
+                        "id:%(vol_id)s: %(e)s")
+                      % {'vol_id': vol_id, 'e': str(e)})
             raise exception.ISCSITargetRemoveFailed(volume_id=vol_id)
 
         os.unlink(volume_path)
@@ -259,10 +261,11 @@ class IetAdm(TargetAdmin):
                     f = open(conf_file, 'a+')
                     f.write(volume_conf)
                     f.close()
-            except exception.ProcessExecutionError, e:
+            except exception.ProcessExecutionError as e:
                 vol_id = name.split(':')[1]
                 LOG.error(_("Failed to create iscsi target for volume "
-                            "id:%(vol_id)s.") % locals())
+                            "id:%(vol_id)s: %(e)s")
+                          % {'vol_id': vol_id, 'e': str(e)})
                 raise exception.ISCSITargetCreateFailed(volume_id=vol_id)
         return tid