mirror of
https://github.com/nix-community/disko.git
synced 2024-11-04 05:44:29 +03:00
Merge pull request #552 from ivan770/lv-priority
lvm_vg: add priority option
This commit is contained in:
commit
1f76b318aa
@ -19,6 +19,11 @@
|
|||||||
default = name;
|
default = name;
|
||||||
description = "Name of the logical volume";
|
description = "Name of the logical volume";
|
||||||
};
|
};
|
||||||
|
priority = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = if (lib.hasInfix "100%" lv.config.size) then 9001 else 1000;
|
||||||
|
description = "Priority of the logical volume, smaller values are created first";
|
||||||
|
};
|
||||||
size = lib.mkOption {
|
size = lib.mkOption {
|
||||||
type = lib.types.str; # TODO lvm size type
|
type = lib.types.str; # TODO lvm size type
|
||||||
description = "Size of the logical volume";
|
description = "Size of the logical volume";
|
||||||
@ -56,7 +61,7 @@
|
|||||||
inherit config options;
|
inherit config options;
|
||||||
default =
|
default =
|
||||||
let
|
let
|
||||||
sortedLvs = lib.sort (a: _: !lib.hasInfix "100%" a.size) (lib.attrValues config.lvs);
|
sortedLvs = lib.sort (a: b: a.priority < b.priority) (lib.attrValues config.lvs);
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
readarray -t lvm_devices < <(cat "$disko_devices_dir"/lvm_${config.name})
|
readarray -t lvm_devices < <(cat "$disko_devices_dir"/lvm_${config.name})
|
||||||
|
Loading…
Reference in New Issue
Block a user