|
|
@ -32,7 +32,9 @@ options:
|
|
|
|
- The module will take care of running pvcreate if needed.
|
|
|
|
- The module will take care of running pvcreate if needed.
|
|
|
|
pesize:
|
|
|
|
pesize:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- The size of the physical extent in megabytes. Must be a power of 2.
|
|
|
|
- The size of the physical extent. pesize must be a power of 2, or
|
|
|
|
|
|
|
|
multiple of 128KiB. Since version 2.6, pesize can be optionally suffixed
|
|
|
|
|
|
|
|
by a UNIT (k/K/m/M/g/G), default unit is megabyte.
|
|
|
|
default: 4
|
|
|
|
default: 4
|
|
|
|
pv_options:
|
|
|
|
pv_options:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -63,6 +65,12 @@ EXAMPLES = '''
|
|
|
|
pvs: /dev/sda1
|
|
|
|
pvs: /dev/sda1
|
|
|
|
pesize: 32
|
|
|
|
pesize: 32
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create a volume group on top of /dev/sdb with physical extent size = 128KiB
|
|
|
|
|
|
|
|
lvg:
|
|
|
|
|
|
|
|
vg: vg.services
|
|
|
|
|
|
|
|
pvs: /dev/sdb
|
|
|
|
|
|
|
|
pesize: 128K
|
|
|
|
|
|
|
|
|
|
|
|
# If, for example, we already have VG vg.services on top of /dev/sdb1,
|
|
|
|
# If, for example, we already have VG vg.services on top of /dev/sdb1,
|
|
|
|
# this VG will be extended by /dev/sdc5. Or if vg.services was created on
|
|
|
|
# this VG will be extended by /dev/sdc5. Or if vg.services was created on
|
|
|
|
# top of /dev/sda5, we first extend it with /dev/sdb1 and /dev/sdc5,
|
|
|
|
# top of /dev/sda5, we first extend it with /dev/sdb1 and /dev/sdc5,
|
|
|
@ -124,7 +132,7 @@ def main():
|
|
|
|
argument_spec=dict(
|
|
|
|
argument_spec=dict(
|
|
|
|
vg=dict(type='str', required=True),
|
|
|
|
vg=dict(type='str', required=True),
|
|
|
|
pvs=dict(type='list'),
|
|
|
|
pvs=dict(type='list'),
|
|
|
|
pesize=dict(type='int', default=4),
|
|
|
|
pesize=dict(type='str', default=4),
|
|
|
|
pv_options=dict(type='str', default=''),
|
|
|
|
pv_options=dict(type='str', default=''),
|
|
|
|
vg_options=dict(type='str', default=''),
|
|
|
|
vg_options=dict(type='str', default=''),
|
|
|
|
state=dict(type='str', default='present', choices=['absent', 'present']),
|
|
|
|
state=dict(type='str', default='present', choices=['absent', 'present']),
|
|
|
@ -205,7 +213,7 @@ def main():
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
module.fail_json(msg="Creating physical volume '%s' failed" % current_dev, rc=rc, err=err)
|
|
|
|
module.fail_json(msg="Creating physical volume '%s' failed" % current_dev, rc=rc, err=err)
|
|
|
|
vgcreate_cmd = module.get_bin_path('vgcreate')
|
|
|
|
vgcreate_cmd = module.get_bin_path('vgcreate')
|
|
|
|
rc, _, err = module.run_command([vgcreate_cmd] + vgoptions + ['-s', str(pesize), vg] + dev_list)
|
|
|
|
rc, _, err = module.run_command([vgcreate_cmd] + vgoptions + ['-s', pesize, vg] + dev_list)
|
|
|
|
if rc == 0:
|
|
|
|
if rc == 0:
|
|
|
|
changed = True
|
|
|
|
changed = True
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|