]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume util.arg_validators allow to pass a group as --data for lvm
authorAlfredo Deza <adeza@redhat.com>
Thu, 12 Oct 2017 20:08:52 +0000 (16:08 -0400)
committerAlfredo Deza <adeza@redhat.com>
Fri, 27 Oct 2017 14:44:15 +0000 (10:44 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 211c38f591945dee53196068533784c385bae102)

src/ceph-volume/ceph_volume/util/arg_validators.py

index feb4707165a5d864ba46112dbbd8bad2d1c7f32e..75ba5579e0befad5bd72e9a30c377cc0d84b4157 100644 (file)
@@ -1,4 +1,5 @@
 import argparse
+import os
 
 
 class LVPath(object):
@@ -7,12 +8,20 @@ class LVPath(object):
 
         <vg name>/<lv name>
 
+    Or a full path to a device, like ``/dev/sda``
+
     Because for LVM it is better to be specific on what group does an lv
     belongs to.
     """
 
     def __call__(self, string):
         error = None
+        if string.startswith('/'):
+            if not os.path.exists(string):
+                error = "Argument (device) does not exist: %s" % string
+                raise argparse.ArgumentError(None, error)
+            else:
+                return string
         try:
             vg, lv = string.split('/')
         except ValueError: