]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
core: add LVM RAID1 support
authorAndrei Borzenkov <arvidjaar@gmail.com>
Thu, 19 Mar 2015 18:30:27 +0000 (21:30 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Thu, 19 Mar 2015 18:30:27 +0000 (21:30 +0300)
Closes 44534.

grub-core/disk/lvm.c

index 1e7f197f0706d42863f8be7c677779ea7a56af83..9b97004d89b88ae8a609cb432f72bf3194072742 100644 (file)
@@ -577,13 +577,17 @@ grub_lvm_detect (grub_disk_t disk,
                      if (is_pvmove)
                        seg->node_count = 1;
                    }
-                 else if (grub_memcmp (p, "raid", sizeof ("raid") - 1)
-                          == 0 && (p[sizeof ("raid") - 1] >= '4'
-                                   && p[sizeof ("raid") - 1] <= '6')
+                 else if (grub_memcmp (p, "raid", sizeof ("raid") - 1) == 0
+                          && ((p[sizeof ("raid") - 1] >= '4'
+                               && p[sizeof ("raid") - 1] <= '6')
+                              || p[sizeof ("raid") - 1] == '1')
                           && p[sizeof ("raidX") - 1] == '"')
                    {
                      switch (p[sizeof ("raid") - 1])
                        {
+                       case '1':
+                         seg->type = GRUB_DISKFILTER_MIRROR;
+                         break;
                        case '4':
                          seg->type = GRUB_DISKFILTER_RAID4;
                          seg->layout = GRUB_RAID_LAYOUT_LEFT_ASYMMETRIC;
@@ -608,16 +612,18 @@ grub_lvm_detect (grub_disk_t disk,
                          goto lvs_segment_fail;
                        }
 
-                     seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
-                     if (p == NULL)
+                     if (seg->type != GRUB_DISKFILTER_MIRROR)
                        {
+                         seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
+                         if (p == NULL)
+                           {
 #ifdef GRUB_UTIL
-                         grub_util_info ("unknown stripe_size\n");
+                             grub_util_info ("unknown stripe_size\n");
 #endif
-                         goto lvs_segment_fail;
+                             goto lvs_segment_fail;
+                           }
                        }
 
-
                      seg->nodes = grub_zalloc (sizeof (seg->nodes[0])
                                                * seg->node_count);
 
@@ -625,7 +631,7 @@ grub_lvm_detect (grub_disk_t disk,
                      if (p == NULL)
                        {
 #ifdef GRUB_UTIL
-                         grub_util_info ("unknown mirrors\n");
+                         grub_util_info ("unknown raids\n");
 #endif
                          goto lvs_segment_fail2;
                        }