def parse_raid(rule):
    parser = argparse.ArgumentParser()
    rules = shlex.split(rule)
    rules.pop(0)

    partitions = []
    newrules = []
    for count in range(0, len(rules)):
        if count == 0:
            newrules.append(rules[count])
            continue
        elif rules[count].startswith('--'):
            newrules.append(rules[count])
            continue
        else:
            partitions.append(rules[count])
    rules = newrules

    parser.add_argument('mntpoint')
    parser.add_argument('--level', dest='level', action='store')
    parser.add_argument('--device', dest='device', action='store')
    parser.add_argument('--spares', dest='spares', action='store')
    parser.add_argument('--fstype', dest='fstype', action='store')
    parser.add_argument('--fsoptions', dest='fsoptions', action='store')
    parser.add_argument('--label', dest='label', action='store')
    parser.add_argument('--noformat', dest='noformat', action='store_true')
    parser.add_argument('--useexisting', dest='useexisting',
                        action='store_true')
    parser.add_argument('--encrypted', dest='encrypted', action='store_true')
    parser.add_argument('--passphrase', dest='passphrase', action='store')
    parser.add_argument('--escrowcert', dest='escrowcert', action='store')
    parser.add_argument('--backuppassphrase', dest='backuppassphrase',
                        action='store')

    args = clean_args(vars(parser.parse_args(rules)))
    if partitions:
        args['partitions'] = partitions
    parser = None
    return args
Assumes VMs stu have PV kernels.
dataset/ETHPy150Open saltstack/salt/salt/utils/kickstart.py/parse_raid--crossover with--dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/virt/xenapi/stubs.py/stubout_determine_is_pv_objectstore