quattor / template-library-standard

Apache License 2.0
2 stars 20 forks source link

way to set lvm raid type when vol type = lvm #150

Closed aka7 closed 1 year ago

aka7 commented 2 years ago

I can’t seem to find a way to set raid type for when vol type is lvm. I like be to able to set raid type for lvm vol so I can see something like this appear in profile.

/system/blockdevices/logical_volumes/data1/type = raid1

and get following appear in ks, (the --type raid1)

<snip>
lvm lvcreate -W y --yes -n data1 \
        --type raid1 \
        vg1 \
        -l 99%FREE \
</snip>

Noticed there is lvs_add function, which sets the size, but can’t see a way to set type for lv, therefore I think we need a way to set type similar to way size is being set for vol type lvm. I see md/ approach when type=raid but nothing to set raid type when vol type is lvm.

I think we need something like this to be added to, variable DISK_LV_BY_VG = {

   foreach (l; sz; lv) {
     SELF[l]["volume_group"] = vg;
-    if (sz != -1) {
-        SELF[l]["size"] = sz;
+    if (is_defined(sz['size']) && sz['size'] != -1) {
+        SELF[l]["size"] = sz['size'];
+    };
+    if (is_defined(sz['raid_type'])) {
+       

And lvs_add function modified to accept list of vol groups with options as dict. i.e modfy lvs_add as

function lvs_add = {
   function_name = 'lvs_add';
@@ -47,8 +47,11 @@ function lvs_add = {

   foreach (l; sz; lv) {
     SELF[l]["volume_group"] = vg;
-    if (sz != -1) {
-        SELF[l]["size"] = sz;
+    if (is_defined(sz['size']) && sz['size'] != -1) {
+        SELF[l]["size"] = sz['size'];
+    };
+    if (is_defined(sz['raid_type'])) {
+        SELF[l]["type"] = sz['raid_type'];

Or have I not looked at the right place?