From 37a1564a41ba8ae6a89eb0903f0fdf6b463d90f0 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 12 Oct 2017 16:08:52 -0400 Subject: [PATCH] ceph-volume util.arg_validators allow to pass a group as --data for lvm Signed-off-by: Alfredo Deza (cherry picked from commit 211c38f591945dee53196068533784c385bae102) --- src/ceph-volume/ceph_volume/util/arg_validators.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ceph-volume/ceph_volume/util/arg_validators.py b/src/ceph-volume/ceph_volume/util/arg_validators.py index feb4707165a5d..75ba5579e0bef 100644 --- a/src/ceph-volume/ceph_volume/util/arg_validators.py +++ b/src/ceph-volume/ceph_volume/util/arg_validators.py @@ -1,4 +1,5 @@ import argparse +import os class LVPath(object): @@ -7,12 +8,20 @@ class LVPath(object): / + 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: -- 2.39.5