Merge "Move replication_status update to init_with_rpc"
This commit is contained in:
commit
6b86441015
@ -489,6 +489,8 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
self.driver.set_throttle()
|
self.driver.set_throttle()
|
||||||
|
|
||||||
# at this point the driver is considered initialized.
|
# at this point the driver is considered initialized.
|
||||||
|
# NOTE(jdg): Careful though because that doesn't mean
|
||||||
|
# that an entry exists in the service table
|
||||||
self.driver.set_initialized()
|
self.driver.set_initialized()
|
||||||
|
|
||||||
for volume in volumes:
|
for volume in volumes:
|
||||||
@ -507,39 +509,38 @@ class VolumeManager(manager.SchedulerDependentManager):
|
|||||||
|
|
||||||
# collect and publish service capabilities
|
# collect and publish service capabilities
|
||||||
self.publish_service_capabilities(ctxt)
|
self.publish_service_capabilities(ctxt)
|
||||||
|
LOG.info(_LI("Driver initialization completed successfully."),
|
||||||
|
resource={'type': 'driver',
|
||||||
|
'id': self.driver.__class__.__name__})
|
||||||
|
|
||||||
|
def init_host_with_rpc(self):
|
||||||
|
LOG.info(_LI("Initializing RPC dependent components of volume "
|
||||||
|
"driver %(driver_name)s (%(version)s)"),
|
||||||
|
{'driver_name': self.driver.__class__.__name__,
|
||||||
|
'version': self.driver.get_version()})
|
||||||
|
|
||||||
stats = self.driver.get_volume_stats(refresh=True)
|
stats = self.driver.get_volume_stats(refresh=True)
|
||||||
if stats and stats.get('replication', False):
|
|
||||||
|
|
||||||
@periodic_task.periodic_task
|
|
||||||
def run_replication_task(self, ctxt):
|
|
||||||
self._update_replication_relationship_status(ctxt)
|
|
||||||
|
|
||||||
self.add_periodic_task(run_replication_task)
|
|
||||||
|
|
||||||
svc_host = vol_utils.extract_host(self.host, 'backend')
|
svc_host = vol_utils.extract_host(self.host, 'backend')
|
||||||
try:
|
try:
|
||||||
# NOTE(jdg): may be some things to think about here in failover
|
service = objects.Service.get_by_host_and_topic(
|
||||||
# scenarios
|
context.get_admin_context(), svc_host,
|
||||||
service = objects.Service.get_by_args(
|
CONF.volume_topic)
|
||||||
context.get_admin_context(),
|
|
||||||
svc_host,
|
|
||||||
'cinder-volume')
|
|
||||||
except exception.ServiceNotFound:
|
except exception.ServiceNotFound:
|
||||||
# FIXME(jdg): no idea what we'd do if we hit this case
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.info(_LI("Service not found for updating "
|
LOG.error(_LE("Service not found for updating "
|
||||||
"replication_status."))
|
"replication_status."))
|
||||||
else:
|
|
||||||
|
if stats and stats.get('replication', False):
|
||||||
if service.replication_status == (
|
if service.replication_status == (
|
||||||
fields.ReplicationStatus.FAILED_OVER):
|
fields.ReplicationStatus.FAILED_OVER):
|
||||||
pass
|
pass
|
||||||
elif stats and stats.get('replication_enabled', False):
|
elif stats and stats.get('replication_enabled', False):
|
||||||
service.replication_status = fields.ReplicationStatus.ENABLED
|
service.replication_status = fields.ReplicationStatus.ENABLED
|
||||||
else:
|
else:
|
||||||
service.replication_status = fields.ReplicationStatus.DISABLED
|
service.replication_status = fields.ReplicationStatus.DISABLED
|
||||||
service.save()
|
|
||||||
|
|
||||||
LOG.info(_LI("Driver initialization completed successfully."),
|
service.save()
|
||||||
|
LOG.info(_LI("Driver post RPC initialization completed successfully."),
|
||||||
resource={'type': 'driver',
|
resource={'type': 'driver',
|
||||||
'id': self.driver.__class__.__name__})
|
'id': self.driver.__class__.__name__})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user