Python 3 deprecated the logger.warn method in favor of warning
According to https://docs.python.org/3/library/logging.html#logging.warning, We prefer to use warning to avoid DeprecationWarning. Change-Id: I29e960b3ba179e0701a57aee84cff6bdf4105db5
This commit is contained in:
parent
342b0913b4
commit
a89ac06029
@ -95,11 +95,11 @@ class RetryDecorator(object):
|
||||
result = f(*args, **kwargs)
|
||||
except self._exceptions:
|
||||
with excutils.save_and_reraise_exception() as ctxt:
|
||||
LOG.warn(_LW("Exception which is in the suggested list of "
|
||||
"exceptions occurred while invoking function:"
|
||||
" %s."),
|
||||
func_name,
|
||||
exc_info=True)
|
||||
LOG.warning(_LW("Exception which is in the suggested list "
|
||||
"of exceptions occurred while invoking "
|
||||
"function: %s."),
|
||||
func_name,
|
||||
exc_info=True)
|
||||
if (self._max_retry_count != -1 and
|
||||
self._retry_count >= self._max_retry_count):
|
||||
LOG.error(_LE("Cannot retry upon suggested exception "
|
||||
@ -494,8 +494,8 @@ class VMwareAPISession(object):
|
||||
lease,
|
||||
'error')
|
||||
except exceptions.VimException:
|
||||
LOG.warn(_LW("Error occurred while reading error message for "
|
||||
"lease: %s."),
|
||||
lease,
|
||||
exc_info=True)
|
||||
LOG.warning(_LW("Error occurred while reading error message for "
|
||||
"lease: %s."),
|
||||
lease,
|
||||
exc_info=True)
|
||||
return "Unknown"
|
||||
|
@ -79,8 +79,9 @@ class FixedIntervalLoopingCall(LoopingCallBase):
|
||||
break
|
||||
delay = interval - timeutils.delta_seconds(start, end)
|
||||
if delay <= 0:
|
||||
LOG.warn(_LW('task run outlasted interval by %s sec'),
|
||||
-delay)
|
||||
LOG.warning(_LW('task run outlasted interval '
|
||||
'by %s sec'),
|
||||
-delay)
|
||||
greenthread.sleep(delay if delay > 0 else 0)
|
||||
except LoopingCallDone as e:
|
||||
self.stop()
|
||||
|
@ -168,8 +168,8 @@ class ImageTransferException(VMwareDriverException):
|
||||
|
||||
|
||||
def _print_deprecation_warning(clazz):
|
||||
LOG.warn(_LW("Exception %s is deprecated, it will be removed in the "
|
||||
"next release."), clazz.__name__)
|
||||
LOG.warning(_LW("Exception %s is deprecated, it will be removed in the "
|
||||
"next release."), clazz.__name__)
|
||||
|
||||
|
||||
class VMwareDriverConfigurationException(VMwareDriverException):
|
||||
|
@ -196,7 +196,7 @@ def get_pbm_wsdl_location(vc_version):
|
||||
pbm_service_wsdl = os.path.join(curr_dir, 'wsdl', major_minor,
|
||||
'pbmService.wsdl')
|
||||
if not os.path.exists(pbm_service_wsdl):
|
||||
LOG.warn(_LW("PBM WSDL file %s not found."), pbm_service_wsdl)
|
||||
LOG.warning(_LW("PBM WSDL file %s not found."), pbm_service_wsdl)
|
||||
return
|
||||
pbm_wsdl = urlparse.urljoin('file:', urllib.pathname2url(pbm_service_wsdl))
|
||||
LOG.debug("Using PBM WSDL location: %s.", pbm_wsdl)
|
||||
|
@ -152,8 +152,8 @@ class FileHandle(object):
|
||||
try:
|
||||
self._file_handle.close()
|
||||
except Exception:
|
||||
LOG.warn(_LW("Error occurred while closing the file handle"),
|
||||
exc_info=True)
|
||||
LOG.warning(_LW("Error occurred while closing the file handle"),
|
||||
exc_info=True)
|
||||
|
||||
def _build_vim_cookie_header(self, vim_cookies):
|
||||
"""Build ESX host session cookie header."""
|
||||
@ -300,8 +300,8 @@ class FileWriteHandle(FileHandle):
|
||||
try:
|
||||
self._conn.getresponse()
|
||||
except Exception:
|
||||
LOG.warn(_LW("Error occurred while reading the HTTP response."),
|
||||
exc_info=True)
|
||||
LOG.warning(_LW("Error occurred while reading the HTTP response."),
|
||||
exc_info=True)
|
||||
super(FileWriteHandle, self).close()
|
||||
|
||||
def __str__(self):
|
||||
@ -473,9 +473,10 @@ class VmdkWriteHandle(FileHandle):
|
||||
{'url': self._url,
|
||||
'state': state})
|
||||
except exceptions.VimException:
|
||||
LOG.warn(_LW("Error occurred while releasing the lease for %s."),
|
||||
self._url,
|
||||
exc_info=True)
|
||||
LOG.warning(_LW("Error occurred while releasing the lease "
|
||||
"for %s."),
|
||||
self._url,
|
||||
exc_info=True)
|
||||
super(VmdkWriteHandle, self).close()
|
||||
LOG.debug("Closed VMDK write handle for %s.", self._url)
|
||||
|
||||
@ -611,9 +612,10 @@ class VmdkReadHandle(FileHandle):
|
||||
{'url': self._url,
|
||||
'state': state})
|
||||
except exceptions.VimException:
|
||||
LOG.warn(_LW("Error occurred while releasing the lease for %s."),
|
||||
self._url,
|
||||
exc_info=True)
|
||||
LOG.warning(_LW("Error occurred while releasing the lease "
|
||||
"for %s."),
|
||||
self._url,
|
||||
exc_info=True)
|
||||
raise
|
||||
super(VmdkReadHandle, self).close()
|
||||
LOG.debug("Closed VMDK read handle for %s.", self._url)
|
||||
|
Loading…
Reference in New Issue
Block a user