fix: deadlock storcli inventory
When there is a lot of data return by storcli due to a lot of disk, the inventory was in deadlock Its a known problem, see: https://docs.python.org/3/library/subprocess.html#subprocess.Popen.wait
This commit is contained in:
parent
5b0df6ca05
commit
bf65da0c58
1 changed files with 6 additions and 3 deletions
|
@ -21,14 +21,17 @@ def storecli(sub_command):
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT
|
stderr=subprocess.STDOUT
|
||||||
)
|
)
|
||||||
p.wait()
|
|
||||||
stdout = p.stdout.read().decode("utf-8")
|
stdout, stderr = p.communicate()
|
||||||
if p.returncode != 0:
|
if stderr:
|
||||||
mesg = "Failed to execute command '{}':\n{}".format(
|
mesg = "Failed to execute command '{}':\n{}".format(
|
||||||
" ".join(command), stdout
|
" ".join(command), stdout
|
||||||
)
|
)
|
||||||
raise StorcliControllerError(mesg)
|
raise StorcliControllerError(mesg)
|
||||||
|
|
||||||
|
stdout = stdout.decode("utf-8")
|
||||||
data = json.loads(stdout)
|
data = json.loads(stdout)
|
||||||
|
|
||||||
controllers = dict([
|
controllers = dict([
|
||||||
(
|
(
|
||||||
c['Command Status']['Controller'],
|
c['Command Status']['Controller'],
|
||||||
|
|
Loading…
Reference in a new issue