def cinder_from_configuration(region, cluster_id, **config):
 def lazy_cinder_loader():
  '\n        Build the v1 or v2 ``ICinderVolumeManager`` wrapped for compatibility\n        with the v1 API and wrapped to provide logging of API calls.\n        This will be invoked by ``LazyLoadingProxy`` the first time an\n        ``ICinderVolumeManager`` attribute is accessed.\n        The reason for the lazy loading of the volume manager is so that the\n        the cinder API version detection can delayed until the\n        ``flocker-dataset-agent`` loop has started. And the reason for that is\n        so that exceptions (e.g. keystone connection errors) that occur during\n        the cinder API version detection, do not occur when the\n        ``CinderBlockDeviceAPI`` is initialized and crash the process. This way\n        errors will be caught by the loop and the cinder API version detection\n        will be retried until it succeeds.\n\n        :returns: The ``ICinderVolumeManager`` wrapper.\n        '
  session = get_keystone_session(**config)
  session.get_token()
  cinder_client = get_cinder_client(session=session, region=region)
  wrapped_cinder_volume_manager = _LoggingCinderVolumeManager(cinder_client.volumes)
  cinder_client_version = get_api_version(cinder_client.version)
  adapted_cinder_volume_manager = CINDER_V1_ADAPTERS[cinder_client_version.ver_major](wrapped_cinder_volume_manager)
  return adapted_cinder_volume_manager
 lazy_cinder_volume_manager_proxy = lazy_loading_proxy_for_interface(interface=ICinderVolumeManager, loader=lazy_cinder_loader)
 nova_client = get_nova_v2_client(session=get_keystone_session(**config), region=region)
 logging_nova_volume_manager = _LoggingNovaVolumeManager(_nova_volumes=nova_client.volumes)
 logging_nova_server_manager = _LoggingNovaServerManager(_nova_servers=nova_client.servers)
 return CinderBlockDeviceAPI(cinder_volume_manager=lazy_cinder_volume_manager_proxy, nova_volume_manager=logging_nova_volume_manager, nova_server_manager=logging_nova_server_manager, cluster_id=cluster_id)

def cinder_from_configuration ( region , cluster_id , ** config ) : def lazy_cinder_loader ( ) : session = get_keystone_session ( ** config ) session . get_token ( ) cinder_client = get_cinder_client ( session = session , region = region ) wrapped_cinder_volume_manager = _LoggingCinderVolumeManager ( cinder_client . volumes ) cinder_client_version = get_api_version ( cinder_client . version ) adapted_cinder_volume_manager = CINDER_V1_ADAPTERS [ cinder_client_version . ver_major ] ( wrapped_cinder_volume_manager ) return adapted_cinder_volume_manager lazy_cinder_volume_manager_proxy = lazy_loading_proxy_for_interface ( interface = ICinderVolumeManager , loader = lazy_cinder_loader ) nova_client = get_nova_v2_client ( session = get_keystone_session ( ** config ) , region = region ) logging_nova_volume_manager = _LoggingNovaVolumeManager ( _nova_volumes = nova_client . volumes ) logging_nova_server_manager = _LoggingNovaServerManager ( _nova_servers = nova_client . servers ) return CinderBlockDeviceAPI ( cinder_volume_manager = lazy_cinder_volume_manager_proxy , nova_volume_manager = logging_nova_volume_manager , nova_server_manager = logging_nova_server_manager , cluster_id = cluster_id )
build a cinderblockdeviceapi using configuration and credentials in config .