core: add LVM RAID1 support

Closes 44534.
This commit is contained in:
Andrei Borzenkov 2015-03-19 21:30:27 +03:00
parent 7c9309e50a
commit 527eeeeee6
1 changed files with 15 additions and 9 deletions

View 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;
}