From fb1e70c8d9b1ee8323a0a856a70d0528f37cbd0e Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Tue, 20 Jan 2015 16:50:19 -0600 Subject: [PATCH] Improve debug logging of Dell Storage Center driver Adding debug message and expanding some existing log statements to make debugging and auditing easier. Some interesting calls were not being logged while others had logging that was missing some relevant arguments. Change-Id: Iad5ceb9305aa5b03f429a8f624eb7f51d0ca6814 --- .../drivers/dell/dell_storagecenter_api.py | 4 ++- .../drivers/dell/dell_storagecenter_common.py | 34 ++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/cinder/volume/drivers/dell/dell_storagecenter_api.py b/cinder/volume/drivers/dell/dell_storagecenter_api.py index 7e0060f20..5c9d146af 100644 --- a/cinder/volume/drivers/dell/dell_storagecenter_api.py +++ b/cinder/volume/drivers/dell/dell_storagecenter_api.py @@ -176,6 +176,7 @@ class StorageCenterApi(object): LOG.debug('Unable to find result where %(attr)s is %(val)s', {'attr': attribute, 'val': value}) + LOG.debug('Blob was %(blob)s', {'blob': blob}) return rsp def _get_json(self, blob): @@ -346,7 +347,7 @@ class StorageCenterApi(object): # Sort through the servers looking for one with connectivity. for scserver in scservers: if scserver.get('status', '').lower() != 'down': - # map to actually create the volume + # Map to actually create the volume self.map_volume(scvolume, scserver) self.unmap_volume(scvolume, @@ -939,6 +940,7 @@ class StorageCenterApi(object): once marked for expiration we do not return the replay as a snapshot. ''' + LOG.debug('Expiring replay %s', replayid) replay = self.find_replay(scvolume, replayid) if replay is not None: diff --git a/cinder/volume/drivers/dell/dell_storagecenter_common.py b/cinder/volume/drivers/dell/dell_storagecenter_common.py index 55c690f34..bfd181cda 100644 --- a/cinder/volume/drivers/dell/dell_storagecenter_common.py +++ b/cinder/volume/drivers/dell/dell_storagecenter_common.py @@ -86,19 +86,20 @@ class DellCommonDriver(san.SanDriver): def create_volume(self, volume): '''Create a volume.''' - LOG.debug('create_volume') + volume_name = volume.get('id') + volume_size = volume.get('size') + LOG.debug('Creating volume %(name)s of size %(size)s', + {'name': volume_name, 'size': volume_size}) scvolume = None with self._client.open_connection() as api: try: # we use id as our name as it s unique - volume_name = volume['id'] - volume_size = volume['size'] volume_folder = self.configuration.dell_sc_volume_folder ssn = api.find_sc(self.configuration.dell_sc_ssn) - LOG.debug('cv: %(name)s : %(size)s : %(ssn)s', + LOG.debug('create_volume: %(name)s on %(ssn)s in %(vf)s', {'name': volume_name, - 'size': volume_size, - 'ssn': ssn}) + 'ssn': ssn, + 'vf': volume_folder}) if ssn is not None: scvolume = api.create_volume(volume_name, volume_size, @@ -110,12 +111,13 @@ class DellCommonDriver(san.SanDriver): volume['name']) if scvolume is None: raise exception.VolumeBackendAPIException( - _('unable to create volume')) + _('Unable to create volume')) def delete_volume(self, volume): deleted = False # we use id as our name as it s unique volume_name = volume.get('id') + LOG.debug('Deleting volume %s', volume_name) with self._client.open_connection() as api: try: ssn = api.find_sc(self.configuration.dell_sc_ssn) @@ -138,6 +140,8 @@ class DellCommonDriver(san.SanDriver): # our volume name is the volume id volume_name = snapshot.get('volume_id') snapshot_id = snapshot.get('id') + LOG.debug('Creating snapshot %(snap)s on volume %(vol)s', + {'snap': snapshot_id, 'vol': volume_name}) with self._client.open_connection() as api: ssn = api.find_sc(self.configuration.dell_sc_ssn) if ssn is not None: @@ -164,6 +168,12 @@ class DellCommonDriver(san.SanDriver): src_volume_name = snapshot.get('volume_id') snapshot_id = snapshot.get('id') volume_name = volume.get('id') + LOG.debug( + 'Creating new volume %(vol)s from snapshot %(snap)s ' + 'from vol %(src)s', + {'vol': volume_name, + 'snap': snapshot_id, + 'src': src_volume_name}) with self._client.open_connection() as api: try: volume_folder = self.configuration.dell_sc_volume_folder @@ -192,10 +202,12 @@ class DellCommonDriver(san.SanDriver): def create_cloned_volume(self, volume, src_vref): '''Creates a clone of the specified volume.''' - LOG.debug('create_cloned_volume') scvolume = None src_volume_name = src_vref.get('id') volume_name = volume.get('id') + LOG.debug('Creating cloned volume %(clone)s from volume %(vol)s', + {'clone': volume_name, + 'vol': src_volume_name}) with self._client.open_connection() as api: try: volume_folder = self.configuration.dell_sc_volume_folder @@ -222,6 +234,9 @@ class DellCommonDriver(san.SanDriver): '''delete_snapshot''' volume_name = snapshot.get('volume_id') snapshot_id = snapshot.get('id') + LOG.debug('Deleting snapshot %(snap)s from volume %(vol)s', + {'snap': snapshot_id, + 'vol': volume_name}) with self._client.open_connection() as api: ssn = api.find_sc(self.configuration.dell_sc_ssn) if ssn is not None: @@ -252,6 +267,7 @@ class DellCommonDriver(san.SanDriver): ''' scvolume = None volume_name = volume.get('id') + LOG.debug('Checking existence of volume %s', volume_name) with self._client.open_connection() as api: try: ssn = api.find_sc(self.configuration.dell_sc_ssn) @@ -277,6 +293,8 @@ class DellCommonDriver(san.SanDriver): def extend_volume(self, volume, new_size): '''Extend the size of the volume.''' volume_name = volume.get('id') + LOG.debug('Extending volume %(vol)s to %(size)s', + {'vol': volume_name, 'size': new_size}) if volume is not None: with self._client.open_connection() as api: ssn = api.find_sc(self.configuration.dell_sc_ssn) -- 2.45.2