提交 745f950f 编写于 作者: P Plamen Dimitrov 提交者: Cleber Rosa

Improve robustness on LV matching to include thin pools

Thin pools don't have LVPath field which we originally used to
detect logical volume. A far better approach to identify the
existance of a logical volume is to restrict the large output
to logical volumes wihin the group and then match on the more
universal Name field.
Signed-off-by: NPlamen Dimitrov <pdimitrov@pevogam.com>
上级 dd9e6ae3
......@@ -309,10 +309,10 @@ def lv_check(vg_name, lv_name):
:param vg_name: Name of the volume group
:param lv_name: Name of the logical volume
"""
cmd = "lvdisplay"
cmd = "lvdisplay %s" % vg_name
result = process.run(cmd, ignore_status=True, sudo=True)
lvpattern = r"LV Path\s+/dev/%s/%s\s+" % (vg_name, lv_name)
lvpattern = r"LV Name\s+%s\s+" % lv_name
match = re.search(lvpattern, result.stdout_text.rstrip())
if match:
LOGGER.debug("Provided Logical volume %s exists in %s",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册