#
################################
+PV_FIELDS = 'pv_name,pv_tags,pv_uuid,vg_name,lv_uuid'
def get_api_pvs():
"""
/dev/sdv;;07A4F654-4162-4600-8EB3-88D1E42F368D
"""
- fields = 'pv_name,pv_tags,pv_uuid,vg_name,lv_uuid'
-
stdout, stderr, returncode = process.call(
- ['pvs', '--no-heading', '--readonly', '--separator=";"', '-o', fields],
+ ['pvs', '--no-heading', '--readonly', '--separator=";"', '-o',
+ PV_FIELDS],
verbose_on_failure=False
)
- return _output_parser(stdout, fields)
+ return _output_parser(stdout, PV_FIELDS)
class PVolume(object):
#
#############################
+#TODO add vg_extent_size here to have that available in VolumeGroup class
+VG_FIELDS = 'vg_name,pv_count,lv_count,snap_count,vg_attr,vg_size,vg_free,vg_free_count'
+
def get_api_vgs():
"""
To normalize sizing, the units are forced in 'g' which is equivalent to
gigabytes, which uses multiples of 1024 (as opposed to 1000)
"""
- #TODO add vg_extent_size here to have that available in VolumeGroup class
- fields = 'vg_name,pv_count,lv_count,snap_count,vg_attr,vg_size,vg_free,vg_free_count'
stdout, stderr, returncode = process.call(
- ['vgs', '--noheadings', '--readonly', '--units=g', '--separator=";"', '-o', fields],
+ ['vgs', '--noheadings', '--readonly', '--units=g', '--separator=";"',
+ '-o', VG_FIELDS],
verbose_on_failure=False
)
- return _output_parser(stdout, fields)
+ return _output_parser(stdout, VG_FIELDS)
class VolumeGroup(object):
def get_device_vgs(device, name_prefix=''):
- fields = 'vg_name,pv_count,lv_count,snap_count,vg_attr,vg_size,vg_free,vg_free_count'
stdout, stderr, returncode = process.call(
['pvs', '--noheadings', '--readonly', '--units=g', '--separator=";"',
- '-o', fields, device],
+ '-o', VG_FIELDS, device],
verbose_on_failure=False
)
- vgs = _output_parser(stdout, fields)
+ vgs = _output_parser(stdout, VG_FIELDS)
return [VolumeGroup(**vg) for vg in vgs]
#
###############################
+LV_FIELDS = 'lv_tags,lv_path,lv_name,vg_name,lv_uuid,lv_size'
def get_api_lvs():
"""
;/dev/ubuntubox-vg/swap_1;swap_1;ubuntubox-vg
"""
- fields = 'lv_tags,lv_path,lv_name,vg_name,lv_uuid,lv_size'
stdout, stderr, returncode = process.call(
- ['lvs', '--noheadings', '--readonly', '--separator=";"', '-a', '-o', fields],
+ ['lvs', '--noheadings', '--readonly', '--separator=";"', '-a', '-o',
+ LV_FIELDS],
verbose_on_failure=False
)
- return _output_parser(stdout, fields)
+ return _output_parser(stdout, LV_FIELDS)
class Volume(object):