From: Jenkins <jenkins@review.openstack.org>
Date: Sat, 22 Nov 2014 20:00:34 +0000 (+0000)
Subject: Merge "Fixup regressions in PureISCSIDriver log statements."
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b0215eac3ac96760a940c296077f3d0d95d6296b;p=openstack-build%2Fcinder-build.git

Merge "Fixup regressions in PureISCSIDriver log statements."
---

b0215eac3ac96760a940c296077f3d0d95d6296b
diff --cc cinder/volume/drivers/pure.py
index dd53a48be,0e9b2e9ed..46d6f3678
--- a/cinder/volume/drivers/pure.py
+++ b/cinder/volume/drivers/pure.py
@@@ -258,31 -254,27 +260,31 @@@ class PureISCSIDriver(san.SanISCSIDrive
          host = self._get_host(connector)
          if host:
              host_name = host["name"]
 -            try:
 -                self._array.disconnect_host(host_name, vol_name)
 -            except exception.PureAPIException as err:
 -                with excutils.save_and_reraise_exception() as ctxt:
 -                    if err.kwargs["code"] == 400:
 -                        # Happens if the host and volume are not connected.
 -                        ctxt.reraise = False
 -                        LOG.error(_LE("Disconnection failed "
 -                                      "with message: {msg}."
 -                                      ).format(msg=err.msg))
 -            if (GENERATED_NAME.match(host_name) and not host["hgroup"] and
 -                not self._array.list_host_connections(host_name,
 -                                                      private=True)):
 -                LOG.info(_LI("Deleting unneeded host %(host_name)r.") %
 -                         {"host_name": host_name})
 -                self._array.delete_host(host_name)
 +            self._disconnect_host(host_name, vol_name)
          else:
              LOG.error(_LE("Unable to find host object in Purity with IQN: "
-                           "{iqn}.").format(iqn=connector["initiator"]))
+                           "%(iqn)s.") % {"iqn": connector["initiator"]})
          LOG.debug("Leave PureISCSIDriver.terminate_connection.")
  
 +    def _disconnect_host(self, host_name, vol_name):
 +        LOG.debug("Enter PureISCSIDriver._disconnect_host.")
 +        try:
 +            self._array.disconnect_host(host_name, vol_name)
 +        except exception.PureAPIException as err:
 +            with excutils.save_and_reraise_exception() as ctxt:
 +                if err.kwargs["code"] == 400:
 +                    # Happens if the host and volume are not connected.
 +                    ctxt.reraise = False
 +                    LOG.error(_LE("Disconnection failed with message: "
 +                                  "%(msg)s.") % {"msg": err.msg})
 +        if (GENERATED_NAME.match(host_name) and
 +            not self._array.list_host_connections(host_name,
 +                                                  private=True)):
 +            LOG.info(_LI("Deleting unneeded host %(host_name)r.") %
 +                     {"host_name": host_name})
 +            self._array.delete_host(host_name)
 +        LOG.debug("Leave PureISCSIDriver._disconnect_host.")
 +
      def get_volume_stats(self, refresh=False):
          """Return the current state of the volume service.