]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Merge "Fixup regressions in PureISCSIDriver log statements."
authorJenkins <jenkins@review.openstack.org>
Sat, 22 Nov 2014 20:00:34 +0000 (20:00 +0000)
committerGerrit Code Review <review@openstack.org>
Sat, 22 Nov 2014 20:00:34 +0000 (20:00 +0000)
1  2 
cinder/volume/drivers/pure.py

index dd53a48be09bbf7c1b5b7451294bb2ab9f7c0281,0e9b2e9edee71e6bdeb4a916aa78be49031a6b93..46d6f3678897dedd5b1fb3910c81c6413f665aa6
@@@ -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.