Add debug logs to cinder store

When debugging issues related to glance cinder store, there are
several calls to cinder and it becomes hard to determine which step
we are currently executing without going through cinder logs.
This patch adds some useful debug logs for the new attachment's code
to understand which stage of attachment we are on.

Change-Id: I491b7292a511c47c1d6148dab69ae04269e50c85
This commit is contained in:
whoami-rajat 2021-11-22 03:49:13 -05:00
parent 73ebb70542
commit 6851cab51a
2 changed files with 12 additions and 1 deletions

View File

@ -30,6 +30,7 @@ from keystoneauth1 import session as ksa_session
from keystoneauth1 import token_endpoint as ksa_token_endpoint
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_utils import strutils
from oslo_utils import units
from glance_store import capabilities
@ -747,9 +748,16 @@ class Store(glance_store.driver.Store):
else:
attachment = self.volume_api.attachment_create(client, volume_id,
mode=attach_mode)
LOG.debug('Attachment %(attachment_id)s created successfully.',
{'attachment_id': attachment['id']})
attachment = self.volume_api.attachment_update(
client, attachment['id'], connector_prop,
mountpoint='glance_store')
LOG.debug('Attachment %(attachment_id)s updated successfully with '
'connection info %(conn_info)s',
{'attachment_id': attachment.id,
'conn_info': strutils.mask_dict_password(
attachment.connection_info)})
volume = volume.manager.get(volume_id)
connection_info = attachment.connection_info
@ -794,6 +802,8 @@ class Store(glance_store.driver.Store):
# Complete the attachment (marking the volume "in-use") after
# the connection with os-brick is complete
self.volume_api.attachment_complete(client, attachment.id)
LOG.debug('Attachment %(attachment_id)s completed successfully.',
{'attachment_id': attachment.id})
if (connection_info['driver_volume_type'] == 'rbd' and
not conn.do_local_attach):
yield device['path']

View File

@ -277,7 +277,8 @@ class TestCinderStoreBase(object):
mock.patch.object(socket,
'gethostname') as mock_get_host, \
mock.patch.object(socket,
'getaddrinfo') as mock_get_host_ip:
'getaddrinfo') as mock_get_host_ip, \
mock.patch.object(cinder.strutils, 'mask_dict_password'):
fake_host = 'fake_host'
fake_addr_info = [[0, 1, 2, 3, ['127.0.0.1']]]