当我运行它时,我得到了泄漏。我不确定发生了什么。我猜管道没有关闭或者可能发生了其他事情。
def deactivateMetadataDevice(input_dmd_lun_wwn):
#print('pvremove /dev/mapper/' + input_dmd_lun_wwn)
status_cmd = False
ps = subprocess.Popen('/sbin/pvremove /dev/mapper/' + input_dmd_lun_wwn, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in iter(ps.stdout.readline, ''):
print line
if re.search('wiped', line):
status_cmd = True
else:
# Cleaning metadata and removing from LVM if ok then return true
status_cmd = False
raise Warning('\t\t PV /dev/mapper/'+ input_dmd_lun_wwn +' belongs to Volume Group')
return status_cmd
当我运行上面的代码时遇到这个问题:
File descriptor 4 (pipe:[323948]) leaked on pvremove invocation. Parent PID 15380: python