summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhoami-rajat <rajatdhasmana@gmail.com>2021-11-22 03:49:13 -0500
committerwhoami-rajat <rajatdhasmana@gmail.com>2022-07-20 13:48:40 +0530
commit6851cab51a3d5dbf018f755efee8e0e640ac12ab (patch)
tree5ae8ca47c936b0b9f3adac12ce39bd966af66f82
parent73ebb705425047f781dccc13508ba82bb1434db7 (diff)
downloadglance_store-6851cab51a3d5dbf018f755efee8e0e640ac12ab.tar.gz
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
-rw-r--r--glance_store/_drivers/cinder.py10
-rw-r--r--glance_store/tests/unit/test_cinder_base.py3
2 files changed, 12 insertions, 1 deletions
diff --git a/glance_store/_drivers/cinder.py b/glance_store/_drivers/cinder.py
index 8a50862..3509348 100644
--- a/glance_store/_drivers/cinder.py
+++ b/glance_store/_drivers/cinder.py
@@ -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']
diff --git a/glance_store/tests/unit/test_cinder_base.py b/glance_store/tests/unit/test_cinder_base.py
index d9e6c2d..d7fca2f 100644
--- a/glance_store/tests/unit/test_cinder_base.py
+++ b/glance_store/tests/unit/test_cinder_base.py
@@ -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']]]