[DRBD-user] BUG REPORT: linstordrv.py misses default_uri in _get_volume_stats

Volodymyr Litovka doka.ua at gmx.com
Wed Apr 22 13:19:35 CEST 2020


Dear colleagues,

for some reasons, linstordrv.py misses passing URI in
_get_volume_stats() which lead to the following problem in cinder-volume
- it was trying to connect to default linstor://localhost
(Resource.__init__(self, name, uri='linstor://localhost') ) instead of
configured linstor://controller :

2020-04-22 13:32:45.142 43621 INFO cinder.volume.manager [req-7efcc8eb-eff3-4136-bb21-ff8472512260 - - - - -] Starting volume driver LinstorDrbdDriver (1.1.0)
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service [req-7efcc8eb-eff3-4136-bb21-ff8472512260 - - - - -] Error starting thread.: linstor.errors.LinstorNetworkError: Error: Unable to connect to any of the given controller hosts: ['linstor://localhost']
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service Traceback (most recent call last):
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service   File "/usr/lib/python3/dist-packages/oslo_service/service.py", line 810, in run_service
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service     service.start()
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service   File "/usr/lib/python3/dist-packages/cinder/service.py", line 229, in start
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service     service_id=Service.service_id)
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service   File "/usr/lib/python3/dist-packages/cinder/volume/manager.py", line 444, in init_host
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service     self._init_host(added_to_cluster, **kwargs)
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service   File "/usr/lib/python3/dist-packages/cinder/volume/manager.py", line 478, in _init_host
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service     self.driver.init_capabilities()
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service   File "/usr/lib/python3/dist-packages/cinder/volume/driver.py", line 748, in init_capabilities
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service     stats = self.get_volume_stats(True)
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service   File "/usr/lib/python3/dist-packages/cinder/volume/drivers/linstordrv.py", line 1102, in get_volume_stats
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service     data = self._get_volume_stats()
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service   File "/usr/lib/python3/dist-packages/cinder/volume/drivers/linstordrv.py", line 535, in _get_volume_stats
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service     rsc = linstor.Resource(str(rsc_name), uri=self.default_uri)
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service   File "/usr/lib/python3.6/dist-packages/linstor/resource.py", line 246, in __init__
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service     with linstor.MultiLinstor(self.client.uri_list, self.client.timeout, self.client.keep_alive) as lin:
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service   File "/usr/lib/python3.6/dist-packages/linstor/linstorapi.py", line 170, in __enter__
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service     self.connect()  # raises exception if error
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service   File "/usr/lib/python3.6/dist-packages/linstor/linstorapi.py", line 2808, in connect
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service     conn_errors)
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service linstor.errors.LinstorNetworkError: Error: Unable to connect to any of the given controller hosts: ['linstor://localhost']
2020-04-22 13:32:45.384 43621 ERROR oslo_service.service

After applying this patch to linstrodrv.py:

--- linstordrv.py.lb	2020-04-22 14:11:31.114443903 +0300
+++ linstordrv.py	2020-04-22 13:40:15.530942930 +0300
@@ -532,7 +532,7 @@
                      local_resources.append(rsc["name"])

              for rsc_name in local_resources:
-                rsc = linstor.Resource(str(rsc_name))
+                rsc = linstor.Resource(str(rsc_name), uri=self.default_uri)
                  if not rsc.is_diskless(self.host_name):
                      sp_allocated_size_gb += round(
                          int(rsc.volumes[0].size) / units.Gi, 2)

problem had gone.

Thank you.

--
Volodymyr Litovka
   "Vision without Execution is Hallucination." -- Thomas Edison

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linbit.com/pipermail/drbd-user/attachments/20200422/bfc2f703/attachment.htm>


More information about the drbd-user mailing list