Merge ~leniwcowaty/curtin:lvm-stripes-handler into ~curtin-dev/curtin:master

Proposed by Leniwcowaty
Status: Needs review
Proposed branch: ~leniwcowaty/curtin:lvm-stripes-handler
Merge into: ~curtin-dev/curtin:master
Diff against target: 34 lines (+5/-0)
2 files modified
curtin/block/schemas.py (+1/-0)
curtin/commands/block_meta.py (+4/-0)
Reviewer Review Type Date Requested Status
curtin developers code Pending
Review via email: mp+499514@code.launchpad.net

Commit message

This fix enables setting up LVM striped volumes using curtin installer

Description of the change

This fix adds "stripes" key to validated schemas for LVM_PARTITION of type "integer".
It also adds handling of this key to the function lvm_partition_handler for block_meta to extend the command creating LVM volume with -i (--stripes) whenever stripes number is provided, is greater or equal to 2 and the number of stripes is even (a basic data sanitization).

To post a comment you must log in.

Unmerged commits

97abeb7... by Leniwcowaty

Added handling for LVM striped volumes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/curtin/block/schemas.py b/curtin/block/schemas.py
2index 63a0bfa..018bb4b 100644
3--- a/curtin/block/schemas.py
4+++ b/curtin/block/schemas.py
5@@ -217,6 +217,7 @@ LVM_PARTITION = {
6 'type': {'const': 'lvm_partition'},
7 'volgroup': {'$ref': '#/definitions/ref_id'},
8 'path': {'type': 'string', 'pattern': _path_dev},
9+ 'stripes': {'type': 'integer'},
10 },
11 }
12 LVM_VOLGROUP = {
13diff --git a/curtin/commands/block_meta.py b/curtin/commands/block_meta.py
14index 8dad729..fa99969 100644
15--- a/curtin/commands/block_meta.py
16+++ b/curtin/commands/block_meta.py
17@@ -1572,6 +1572,7 @@ def lvm_partition_verify(lv_name, vg_name, info):
18 def lvm_partition_handler(info, storage_config, context):
19 volgroup = storage_config[info['volgroup']]['name']
20 name = info['name']
21+ stripes = info['stripes']
22 if not volgroup:
23 raise ValueError("lvm volgroup for lvm partition must be specified")
24 if not name:
25@@ -1601,6 +1602,9 @@ def lvm_partition_handler(info, storage_config, context):
26 else:
27 cmd.extend(["--extents", "100%FREE"])
28
29+ if stripes is not None and stripes >= 2 and stripes % 2 == 0:
30+ cmd.extend(["--stripes", stripes, "--stripesize", "64k"])
31+
32 util.subp(cmd)
33
34 # refresh lvmetad

Subscribers

People subscribed via source and target branches