From: Ann Kamyshnikova Date: Mon, 26 Aug 2013 13:13:06 +0000 (+0400) Subject: Pass db into driver as constructor's parameter X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=6afa0088c4ac91820ffddb409b4605be33f1537d;p=openstack-build%2Fcinder-build.git Pass db into driver as constructor's parameter This will be required when code specific for target admin moves to brick. Change-Id: Ia48ea927f2efb2c551c359f7e7f98bf586919ab3 --- diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index 9dbf3778e..1925cbe61 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -102,7 +102,7 @@ class VolumeDriver(object): def __init__(self, execute=utils.execute, *args, **kwargs): # NOTE(vish): db is set by Manager - self.db = None + self.db = kwargs.get('db') self.configuration = kwargs.get('configuration', None) if self.configuration: self.configuration.append_config_values(volume_opts) diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index feb78a021..a3728597e 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -135,6 +135,9 @@ class VolumeManager(manager.SchedulerDependentManager): def __init__(self, volume_driver=None, service_name=None, *args, **kwargs): """Load the driver from the one specified in args, or from flags.""" + # update_service_capabilities needs service_name to be volume + super(VolumeManager, self).__init__(service_name='volume', + *args, **kwargs) self.configuration = Configuration(volume_manager_opts, config_group=service_name) if not volume_driver: @@ -147,13 +150,8 @@ class VolumeManager(manager.SchedulerDependentManager): volume_driver = MAPPING[volume_driver] self.driver = importutils.import_object( volume_driver, - configuration=self.configuration) - # update_service_capabilities needs service_name to be volume - super(VolumeManager, self).__init__(service_name='volume', - *args, **kwargs) - # NOTE(vish): Implementation specific db handling is done - # by the driver. - self.driver.db = self.db + configuration=self.configuration, + db=self.db) def init_host(self): """Do any initialization that needs to be run if this is a