DRBD: Remove unneeded list length checks

Zero length lists in python are falsey, so no reason to check for both
not list and len(list) == 0

Change-Id: I6aee4904174d07392bf91bbfccd29ca4c0e166a2
This commit is contained in:
Hayley Swimelar 2017-09-14 08:22:09 -07:00
parent 853e76f423
commit def3cb7f04
1 changed files with 3 additions and 3 deletions

View File

@ -399,7 +399,7 @@ class DrbdManageBaseDriver(driver.VolumeDriver):
self.empty_dict)
self._check_result(res)
if (not rl) or (len(rl) == 0):
if not rl:
if empty_ok:
LOG.debug("No volume %s found.", v_uuid)
return None, None, None, None
@ -436,7 +436,7 @@ class DrbdManageBaseDriver(driver.VolumeDriver):
self.empty_dict)
self._check_result(res)
if (not rs) or (len(rs) == 0):
if not rs:
if empty_ok:
return None
else:
@ -597,7 +597,7 @@ class DrbdManageBaseDriver(driver.VolumeDriver):
raise exception.VolumeBackendAPIException(data=message)
# Delete resource, if empty
if (not rl) or (not rl[0]) or (len(rl[0][2]) == 0):
if (not rl) or (not rl[0]) or not rl[0][2]:
res = self.call_or_reconnect(self.odm.remove_resource,
d_res_name, False)
self._check_result(res, ignore=[dm_exc.DM_ENOENT])