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,9 +95,9 @@ class RetryDecorator(object):
|
|||||||
result = f(*args, **kwargs)
|
result = f(*args, **kwargs)
|
||||||
except self._exceptions:
|
except self._exceptions:
|
||||||
with excutils.save_and_reraise_exception() as ctxt:
|
with excutils.save_and_reraise_exception() as ctxt:
|
||||||
LOG.warn(_LW("Exception which is in the suggested list of "
|
LOG.warning(_LW("Exception which is in the suggested list "
|
||||||
"exceptions occurred while invoking function:"
|
"of exceptions occurred while invoking "
|
||||||
" %s."),
|
"function: %s."),
|
||||||
func_name,
|
func_name,
|
||||||
exc_info=True)
|
exc_info=True)
|
||||||
if (self._max_retry_count != -1 and
|
if (self._max_retry_count != -1 and
|
||||||
@ -494,7 +494,7 @@ class VMwareAPISession(object):
|
|||||||
lease,
|
lease,
|
||||||
'error')
|
'error')
|
||||||
except exceptions.VimException:
|
except exceptions.VimException:
|
||||||
LOG.warn(_LW("Error occurred while reading error message for "
|
LOG.warning(_LW("Error occurred while reading error message for "
|
||||||
"lease: %s."),
|
"lease: %s."),
|
||||||
lease,
|
lease,
|
||||||
exc_info=True)
|
exc_info=True)
|
||||||
|
@ -79,7 +79,8 @@ class FixedIntervalLoopingCall(LoopingCallBase):
|
|||||||
break
|
break
|
||||||
delay = interval - timeutils.delta_seconds(start, end)
|
delay = interval - timeutils.delta_seconds(start, end)
|
||||||
if delay <= 0:
|
if delay <= 0:
|
||||||
LOG.warn(_LW('task run outlasted interval by %s sec'),
|
LOG.warning(_LW('task run outlasted interval '
|
||||||
|
'by %s sec'),
|
||||||
-delay)
|
-delay)
|
||||||
greenthread.sleep(delay if delay > 0 else 0)
|
greenthread.sleep(delay if delay > 0 else 0)
|
||||||
except LoopingCallDone as e:
|
except LoopingCallDone as e:
|
||||||
|
@ -168,7 +168,7 @@ class ImageTransferException(VMwareDriverException):
|
|||||||
|
|
||||||
|
|
||||||
def _print_deprecation_warning(clazz):
|
def _print_deprecation_warning(clazz):
|
||||||
LOG.warn(_LW("Exception %s is deprecated, it will be removed in the "
|
LOG.warning(_LW("Exception %s is deprecated, it will be removed in the "
|
||||||
"next release."), clazz.__name__)
|
"next release."), clazz.__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ def get_pbm_wsdl_location(vc_version):
|
|||||||
pbm_service_wsdl = os.path.join(curr_dir, 'wsdl', major_minor,
|
pbm_service_wsdl = os.path.join(curr_dir, 'wsdl', major_minor,
|
||||||
'pbmService.wsdl')
|
'pbmService.wsdl')
|
||||||
if not os.path.exists(pbm_service_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
|
return
|
||||||
pbm_wsdl = urlparse.urljoin('file:', urllib.pathname2url(pbm_service_wsdl))
|
pbm_wsdl = urlparse.urljoin('file:', urllib.pathname2url(pbm_service_wsdl))
|
||||||
LOG.debug("Using PBM WSDL location: %s.", pbm_wsdl)
|
LOG.debug("Using PBM WSDL location: %s.", pbm_wsdl)
|
||||||
|
@ -152,7 +152,7 @@ class FileHandle(object):
|
|||||||
try:
|
try:
|
||||||
self._file_handle.close()
|
self._file_handle.close()
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.warn(_LW("Error occurred while closing the file handle"),
|
LOG.warning(_LW("Error occurred while closing the file handle"),
|
||||||
exc_info=True)
|
exc_info=True)
|
||||||
|
|
||||||
def _build_vim_cookie_header(self, vim_cookies):
|
def _build_vim_cookie_header(self, vim_cookies):
|
||||||
@ -300,7 +300,7 @@ class FileWriteHandle(FileHandle):
|
|||||||
try:
|
try:
|
||||||
self._conn.getresponse()
|
self._conn.getresponse()
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.warn(_LW("Error occurred while reading the HTTP response."),
|
LOG.warning(_LW("Error occurred while reading the HTTP response."),
|
||||||
exc_info=True)
|
exc_info=True)
|
||||||
super(FileWriteHandle, self).close()
|
super(FileWriteHandle, self).close()
|
||||||
|
|
||||||
@ -473,7 +473,8 @@ class VmdkWriteHandle(FileHandle):
|
|||||||
{'url': self._url,
|
{'url': self._url,
|
||||||
'state': state})
|
'state': state})
|
||||||
except exceptions.VimException:
|
except exceptions.VimException:
|
||||||
LOG.warn(_LW("Error occurred while releasing the lease for %s."),
|
LOG.warning(_LW("Error occurred while releasing the lease "
|
||||||
|
"for %s."),
|
||||||
self._url,
|
self._url,
|
||||||
exc_info=True)
|
exc_info=True)
|
||||||
super(VmdkWriteHandle, self).close()
|
super(VmdkWriteHandle, self).close()
|
||||||
@ -611,7 +612,8 @@ class VmdkReadHandle(FileHandle):
|
|||||||
{'url': self._url,
|
{'url': self._url,
|
||||||
'state': state})
|
'state': state})
|
||||||
except exceptions.VimException:
|
except exceptions.VimException:
|
||||||
LOG.warn(_LW("Error occurred while releasing the lease for %s."),
|
LOG.warning(_LW("Error occurred while releasing the lease "
|
||||||
|
"for %s."),
|
||||||
self._url,
|
self._url,
|
||||||
exc_info=True)
|
exc_info=True)
|
||||||
raise
|
raise
|
||||||
|
Loading…
x
Reference in New Issue
Block a user