提交 e7365311 编写于 作者: Y Yumei Huang

numa.numa_stress: Add -p option for mkdir to avoid error if directory exists

Signed-off-by: NYumei Huang <yuhuang@redhat.com>
上级 eb0de797
......@@ -41,7 +41,7 @@ def get_tmpfs_write_speed():
Get the tmpfs write speed of the host
return: The write speed of tmpfs, the unit is kb/s.
"""
utils.run("mkdir /tmp/test_speed && mount -t tmpfs none /tmp/test_speed")
utils.run("mkdir -p /tmp/test_speed && mount -t tmpfs none /tmp/test_speed")
output = utils.run("dd if=/dev/urandom of=/tmp/test_speed/test bs=1k count=1024")
try:
speed = re.search("\s([\w\s\.]+)/s", output.stderr, re.I).group(1)
......@@ -49,8 +49,8 @@ def get_tmpfs_write_speed():
except Exception:
return 3072
finally:
os.remove("/tmp/test_speed/test")
utils.run("umount /tmp/test_speed")
os.removedirs("/tmp/test_speed")
@error.context_aware
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册