Bug #43754
open
lvm create accepts /dev/vg_name/lv_name as a valid device
Added by Jan Fajerski over 4 years ago.
Updated over 4 years ago.
Description
Technically this should be rejected since it is an LV, that is passed as a block device.
This seems to work (osds are created) but I'm not yet sure why. Maybe this can become a valid usage but I'd like to find the bug first.
Also batch does not accept a device like this.
class ValidDevice(object):
def __init__(self, as_string=False, gpt_ok=False):
self.as_string = as_string
self.gpt_ok = gpt_ok
def __call__(self, string):
device = Device(string)
error = None
if not device.exists:
error = "Unable to proceed with non-existing device: %s" % string
# FIXME this is not a nice API, this validator was meant to catch any
# non-existing devices upfront, not check for gpt headers. Now this
# needs to optionally skip checking gpt headers which is beyond
# verifying if the device exists. The better solution would be to
# configure this with a list of checks that can be excluded/included on
# __init__
elif device.has_gpt_headers and not self.gpt_ok:
error = "GPT headers found, they must be removed on: %s" % string
if error:
raise argparse.ArgumentError(None, error)
if self.as_string:
if device.is_lv:
# all codepaths expect an lv path to be returned in this format
return "{}/{}".format(device.vg_name, device.lv_name)
return string
return device
The arg validator silently transforms this to the expected vg_name/lv_name format. I wonder why that shouldn't work for /dev/dm-0 device
Also available in: Atom
PDF