get_volume_stats is called twice during volume driver initialization
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cinder |
New
|
Undecided
|
Unassigned |
Bug Description
During cinder-volume service initialization there are 2 calls for get_volume_stats with refresh=True, which impacts performance.
During the service initialization init_host_with_rpc, it checks the driver capability for replication_status from get_volume_stats and updates the service replication status.
First call during init_host_with_rpc, this call is just made to fetch the replication capability of the volume driver and set the service.
stats = self.driver.
try:
service = self._get_service()
except exception.
with excutils.
if service.
if stats and stats.get(
else:
Second call is under periodic call _report_
We can avoid the First call of get_volume_stats call in the init_host_
if instead of using get_volume_stats, we can have replication_enabled as a driver property which returns if driver is capable enough to perform replication. As its a static property during driver initialization. And can still use get_volume_stats for updating the current replication status.
Would like to know the thoughts of the core on the same.
Hi chhavi, thanks for filing this. There's a catch with that check actually, in particular with replication. The problem is we didn't want to do the replication checks until *after* we were certain that all services were up and had reported their capabilities (including replication). Note this also ties in the cluster replication/HA initialization as well IIRC.
I don't really consider this a performance hit, get_stats is a pretty easy call. That being said, if you see a way to improve this while maintaining HA and volume replication functionality that'd be great. I think it's more of an enhancement than a bug though.