]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Ignore stmf target must be offline exception
authorVictor Rodionov <vito.ordaz@gmail.com>
Thu, 15 Aug 2013 23:07:32 +0000 (03:07 +0400)
committerVictor Rodionov <vito.ordaz@gmail.com>
Fri, 23 Aug 2013 21:16:38 +0000 (01:16 +0400)
Patch to ignore

"NexentaJSONException: : Unable to add member to targetgroup:
  stmfadm: STMF target must be offline"

This error happens when targetgroup is already configured and busy.

fixed bug 1209305

Change-Id: I2441118c0968a7a373b5990db6782129291c3051

cinder/volume/drivers/nexenta/volume.py

index a4200cadb20da276a5e93044d65fd1a0bc6acc1a..bff9754f6097748b438bc8604bbed42e55f33b9a 100644 (file)
@@ -237,8 +237,8 @@ class NexentaDriver(driver.ISCSIDriver):  # pylint: disable=R0921
         except nexenta.NexentaException as exc:
             if ensure and 'already configured' in exc.args[1]:
                 target_already_configured = True
-                LOG.info(_('Ignored target creation error "%s" while ensuring '
-                           'export'), exc)
+                LOG.exception(_('Ignored target creation error while ensuring '
+                                'export'))
             else:
                 raise
         try:
@@ -247,34 +247,36 @@ class NexentaDriver(driver.ISCSIDriver):  # pylint: disable=R0921
             if ((ensure and 'already exists' in exc.args[1]) or
                     (target_already_configured and
                      'target must be offline' in exc.args[1])):
-                LOG.info(_('Ignored target group creation error "%s"'
-                           ' while ensuring export'), exc)
+                LOG.exception(_('Ignored target group creation error while '
+                                'ensuring export'))
             else:
                 raise
         try:
             self.nms.stmf.add_targetgroup_member(target_group_name,
                                                  target_name)
         except nexenta.NexentaException as exc:
-            if not ensure or 'already exists' not in exc.args[1]:
+            if ensure and ('already exists' in exc.args[1] or
+                           'target must be offline' in exc.args[1]):
+                LOG.exception(_('Ignored target group member addition error '
+                                'while ensuring export'))
+            else:
                 raise
-            LOG.info(_('Ignored target group member addition error "%s" while '
-                       'ensuring export'), exc)
         try:
             self.nms.scsidisk.create_lu(zvol_name, {})
         except nexenta.NexentaException as exc:
             if not ensure or 'in use' not in exc.args[1]:
                 raise
-            LOG.info(_('Ignored LU creation error "%s"'
-                       ' while ensuring export'), exc)
+            LOG.exception(_('Ignored LU creation error while ensuring export'))
         try:
             self.nms.scsidisk.add_lun_mapping_entry(zvol_name, {
                 'target_group': target_group_name,
-                'lun': '0'})
+                'lun': '0'
+            })
         except nexenta.NexentaException as exc:
             if not ensure or 'view entry exists' not in exc.args[1]:
                 raise
-            LOG.info(_('Ignored LUN mapping entry addition error "%s"'
-                       ' while ensuring export'), exc)
+            LOG.exception(_('Ignored LUN mapping entry addition error while '
+                            'ensuring export'))
         return '%s:%s,1 %s 0' % (self.configuration.san_ip,
                                  self.configuration.iscsi_port, target_name)