]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/ceph-volume/ceph_volume/api/lvm.py
import ceph 15.2.14
[ceph.git] / ceph / src / ceph-volume / ceph_volume / api / lvm.py
index 30362f1bd2759737fc18562985540eb131715ce9..e4b932b80e2ebec1186289237e72a943788471a2 100644 (file)
@@ -1134,3 +1134,15 @@ def get_device_lvs(device, name_prefix=''):
     lvs = _output_parser(stdout, LV_FIELDS)
     return [Volume(**lv) for lv in lvs if lv['lv_name'] and
             lv['lv_name'].startswith(name_prefix)]
+
+def get_lv_by_fullname(full_name):
+    """
+    returns LV by the specified LV's full name (formatted as vg_name/lv_name)
+    """
+    try:
+        vg_name, lv_name = full_name.split('/')
+        res_lv = get_first_lv(filters={'lv_name': lv_name,
+                                       'vg_name': vg_name})
+    except ValueError:
+        res_lv = None
+    return res_lv