From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
src/kimchi/i18n.py | 2 ++
src/kimchi/utils.py | 18 ++++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
index e4e1a89..63f57d4 100644
--- a/src/kimchi/i18n.py
+++ b/src/kimchi/i18n.py
@@ -49,6 +49,8 @@ messages = {
"KCHDISKS0001E": _("Error while getting block devices. Details:
%(err)s"),
"KCHDISKS0002E": _("Error while getting block device information for
%(device)s."),
+ "KCHLVM0001E": _("Error while getting lvm information
%(err)s."),
+
"KCHDL0001E": _("Unable to find distro file: %(filename)s"),
"KCHDL0002E": _("Unable to parse distro file: %(filename)s. Make sure,
it is a JSON file."),
diff --git a/src/kimchi/utils.py b/src/kimchi/utils.py
index d71338a..0b11fcb 100644
--- a/src/kimchi/utils.py
+++ b/src/kimchi/utils.py
@@ -245,6 +245,24 @@ def parse_cmd_output(output, output_items):
return res
+def find_vgs():
+ cmd = ["vgs", "--noheadings", "-o", "vg_name,
vg_size"]
+ try:
+ out, error, ret = run_command(cmd, 5)
+ except TimeoutExpired:
+ kimchi_log.warning("volume group query timeout")
+ return list()
+
+ if error:
+ raise OperationFailed("KCHLVM0001E", {'err': error})
+
+ vgs = parse_cmd_output(out, ['name', 'size'])
+ for vg in vgs:
+ vg['path'] = os.path.join('/dev/', vg['name'])
+ vg['pool'] = ''
+ return vgs
+
+
def patch_find_nfs_target(nfs_server):
cmd = ["showmount", "--no-headers", "--exports",
nfs_server]
try:
--
2.1.0