def _connect_device(self, conn):
    use_multipath = self.configuration.use_multipath_for_image_xfer
    device_scan_attempts = self.configuration.num_volume_device_scan_tries
    protocol = conn['driver_volume_type']
    connector = utils.brick_get_connector(protocol, use_multipath=use_multipath, device_scan_attempts=device_scan_attempts, conn=conn)
    vol_handle = connector.connect_volume(conn['data'])
    root_access = True
    if (not connector.check_valid_device(vol_handle['path'], root_access)):
        if isinstance(vol_handle['path'], six.string_types):
            raise exception.DeviceUnavailable(path=vol_handle['path'], reason=(_('Unable to access the backend storage via the path %(path)s.') % {'path': vol_handle['path']}))
        else:
            raise exception.DeviceUnavailable(path=None, reason=_('Unable to access the backend storage via file handle.'))
    return {'conn': conn, 'device': vol_handle, 'connector': connector}
def _connect_device(self, conn):
    use_multipath = self.configuration.use_multipath_for_image_xfer
    device_scan_attempts = self.configuration.num_volume_device_scan_tries
    protocol = conn['driver_volume_type']
    connector = utils.brick_get_connector(protocol, use_multipath=use_multipath, device_scan_attempts=device_scan_attempts, conn=conn)
    vol_handle = connector.connect_volume(conn['data'])
    root_access = True
    if (not connector.check_valid_device(vol_handle['path'], root_access)):
        if isinstance(vol_handle['path'], six.string_types):
            raise exception.DeviceUnavailable(path=vol_handle['path'], reason=(_('Unable to access the backend storage via the path %(path)s.') % {'path': vol_handle['path']}))
        else:
            raise exception.DeviceUnavailable(path=None, reason=_('Unable to access the backend storage via file handle.'))
    return {'conn': conn, 'device': vol_handle, 'connector': connector}