Fix DeviceUnavailable exception
We were accessing the wrong module (cinderlib) to find the DeviceUnavailable exception, now we access it in the right place (cinder.exception).
This commit is contained in:
		@@ -27,6 +27,7 @@ History
 | 
			
		||||
  - Fix name & description inconsistency
 | 
			
		||||
  - Set created_at field on creation
 | 
			
		||||
  - Connection fields not being set
 | 
			
		||||
  - DeviceUnavailable exception
 | 
			
		||||
 | 
			
		||||
0.1.0 (2017-11-03)
 | 
			
		||||
------------------
 | 
			
		||||
 
 | 
			
		||||
@@ -346,7 +346,8 @@ class RBDConnector(connectors.rbd.RBDConnector):
 | 
			
		||||
        """Verify an existing RBD handle is connected and valid."""
 | 
			
		||||
        try:
 | 
			
		||||
            self._execute('dd', 'if=' + path, 'of=/dev/null', 'bs=4096',
 | 
			
		||||
                          'count=1', run_as_root=True)
 | 
			
		||||
                          'count=1', root_helper=self._root_helper,
 | 
			
		||||
                          run_as_root=True)
 | 
			
		||||
        except putils.ProcessExecutionError:
 | 
			
		||||
            return False
 | 
			
		||||
        return True
 | 
			
		||||
 
 | 
			
		||||
@@ -22,6 +22,7 @@ from cinder import context
 | 
			
		||||
# having all the other imports as they could change.
 | 
			
		||||
from cinder.cmd import volume as volume_cmd
 | 
			
		||||
from cinder import objects as cinder_objs
 | 
			
		||||
from cinder import exception as cinder_exception
 | 
			
		||||
from cinder.objects import base as cinder_base_ovo
 | 
			
		||||
from os_brick import exception as brick_exception
 | 
			
		||||
from os_brick import initiator as brick_initiator
 | 
			
		||||
@@ -681,7 +682,7 @@ class Connection(Object):
 | 
			
		||||
            LOG.exception('Could not validate device %s', self.path)
 | 
			
		||||
 | 
			
		||||
        if unavailable:
 | 
			
		||||
            raise exception.DeviceUnavailable(
 | 
			
		||||
            raise cinder_exception.DeviceUnavailable(
 | 
			
		||||
                path=self.path, attach_info=self._ovo.connection_information,
 | 
			
		||||
                reason=('Unable to access the backend storage via path '
 | 
			
		||||
                        '%s.') % self.path)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user