def __init__(self, volume_driver=None, service_name=None, *args, **kwargs):
    'Load the driver from the one specified in args, or from flags.'
    super(VolumeManager, self).__init__(*args, service_name='volume', **kwargs)
    self.configuration = config.Configuration(volume_manager_opts, config_group=service_name)
    self.stats = {}
    if (not volume_driver):
        volume_driver = self.configuration.volume_driver
    if (volume_driver in MAPPING):
        LOG.warning(_LW('Driver path %s is deprecated, update your configuration to the new path.'), volume_driver)
        volume_driver = MAPPING[volume_driver]
    vol_db_empty = self._set_voldb_empty_at_startup_indicator(context.get_admin_context())
    LOG.debug('Cinder Volume DB check: vol_db_empty=%s', vol_db_empty)
    curr_active_backend_id = None
    svc_host = vol_utils.extract_host(self.host, 'backend')
    try:
        service = objects.Service.get_by_args(context.get_admin_context(), svc_host, 'cinder-volume')
    except exception.ServiceNotFound:
        LOG.info(_LI('Service not found for updating active_backend_id, assuming default for driver init.'))
    else:
        curr_active_backend_id = service.active_backend_id
    if self.configuration.suppress_requests_ssl_warnings:
        LOG.warning(_LW('Suppressing requests library SSL Warnings'))
        requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning)
        requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecurePlatformWarning)
    self.driver = importutils.import_object(volume_driver, configuration=self.configuration, db=self.db, host=self.host, is_vol_db_empty=vol_db_empty, active_backend_id=curr_active_backend_id)
    self.message_api = message_api.API()
    if (CONF.profiler.enabled and (profiler is not None)):
        self.driver = profiler.trace_cls('driver')(self.driver)
    try:
        self.extra_capabilities = jsonutils.loads(self.driver.configuration.extra_capabilities)
    except AttributeError:
        self.extra_capabilities = {}
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.error(_LE('Invalid JSON: %s'), self.driver.configuration.extra_capabilities)
    if self.driver.configuration.safe_get('image_volume_cache_enabled'):
        max_cache_size = self.driver.configuration.safe_get('image_volume_cache_max_size_gb')
        max_cache_entries = self.driver.configuration.safe_get('image_volume_cache_max_count')
        self.image_volume_cache = image_cache.ImageVolumeCache(self.db, cinder_volume.API(), max_cache_size, max_cache_entries)
        LOG.info(_LI('Image-volume cache enabled for host %(host)s.'), {'host': self.host})
    else:
        LOG.info(_LI('Image-volume cache disabled for host %(host)s.'), {'host': self.host})
        self.image_volume_cache = None
Load the driver from the one specified in args, or from flags.
def __init__(self, volume_driver=None, service_name=None, *args, **kwargs):
    
    super(VolumeManager, self).__init__(*args, service_name='volume', **kwargs)
    self.configuration = config.Configuration(volume_manager_opts, config_group=service_name)
    self.stats = {}
    if (not volume_driver):
        volume_driver = self.configuration.volume_driver
    if (volume_driver in MAPPING):
        LOG.warning(_LW('Driver path %s is deprecated, update your configuration to the new path.'), volume_driver)
        volume_driver = MAPPING[volume_driver]
    vol_db_empty = self._set_voldb_empty_at_startup_indicator(context.get_admin_context())
    LOG.debug('Cinder Volume DB check: vol_db_empty=%s', vol_db_empty)
    curr_active_backend_id = None
    svc_host = vol_utils.extract_host(self.host, 'backend')
    try:
        service = objects.Service.get_by_args(context.get_admin_context(), svc_host, 'cinder-volume')
    except exception.ServiceNotFound:
        LOG.info(_LI('Service not found for updating active_backend_id, assuming default for driver init.'))
    else:
        curr_active_backend_id = service.active_backend_id
    if self.configuration.suppress_requests_ssl_warnings:
        LOG.warning(_LW('Suppressing requests library SSL Warnings'))
        requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning)
        requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecurePlatformWarning)
    self.driver = importutils.import_object(volume_driver, configuration=self.configuration, db=self.db, host=self.host, is_vol_db_empty=vol_db_empty, active_backend_id=curr_active_backend_id)
    self.message_api = message_api.API()
    if (CONF.profiler.enabled and (profiler is not None)):
        self.driver = profiler.trace_cls('driver')(self.driver)
    try:
        self.extra_capabilities = jsonutils.loads(self.driver.configuration.extra_capabilities)
    except AttributeError:
        self.extra_capabilities = {}
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.error(_LE('Invalid JSON: %s'), self.driver.configuration.extra_capabilities)
    if self.driver.configuration.safe_get('image_volume_cache_enabled'):
        max_cache_size = self.driver.configuration.safe_get('image_volume_cache_max_size_gb')
        max_cache_entries = self.driver.configuration.safe_get('image_volume_cache_max_count')
        self.image_volume_cache = image_cache.ImageVolumeCache(self.db, cinder_volume.API(), max_cache_size, max_cache_entries)
        LOG.info(_LI('Image-volume cache enabled for host %(host)s.'), {'host': self.host})
    else:
        LOG.info(_LI('Image-volume cache disabled for host %(host)s.'), {'host': self.host})
        self.image_volume_cache = None