29a9406e1b
The content of this branch was automatically imported from Fedora ELN with the following as its source: https://src.fedoraproject.org/rpms/python-blivet#eaa02fcd8d2f8cfe6784072049eee49855230f1a
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
#!/usr/bin/python3
|
|
|
|
import argparse
|
|
import sys
|
|
|
|
import blivet
|
|
|
|
|
|
POOL_NAME = "blivet_test"
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('-d', '--disks', default='')
|
|
args = parser.parse_args()
|
|
|
|
b = blivet.Blivet()
|
|
b.reset()
|
|
|
|
disks = list()
|
|
for disk_id in args.disks.split(','):
|
|
disk = b.devicetree.resolve_device(disk_id)
|
|
if not disk.is_disk:
|
|
sys.stderr.write("specified disk '%s' is not a disk\n" % disk_id)
|
|
sys.exit(1)
|
|
|
|
disks.append(disk)
|
|
b.initialize_disk(disk)
|
|
|
|
if len(disks) > 1:
|
|
container_raid_level = "raid1"
|
|
total_size = min(d.size for d in disks)
|
|
else:
|
|
container_raid_level = None
|
|
total_size = sum(d.size for d in disks)
|
|
|
|
lv1 = b.factory_device(size=total_size*0.8, disks=disks,
|
|
name="lv1", container_name=POOL_NAME,
|
|
fstype='xfs', device_type=blivet.devicefactory.DEVICE_TYPE_LVM)
|
|
lv2 = b.factory_device(disks=disks, name="lv2",
|
|
container_name=POOL_NAME, container_raid_level='raid1',
|
|
fstype='ext4', device_type=blivet.devicefactory.DEVICE_TYPE_LVM)
|
|
|
|
b.do_it()
|