Skip to content

Commit

Permalink
Merge pull request #250 from yast/Code-11-SP4_bnc_996839
Browse files Browse the repository at this point in the history
correct names in device_order for Raids
  • Loading branch information
schubi2 committed Sep 20, 2016
2 parents 50e0d80 + 0db3dce commit 79996f1
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.17.79
2.17.80
11 changes: 11 additions & 0 deletions package/autoyast2.changes
@@ -1,3 +1,14 @@
-------------------------------------------------------------------
Tue Sep 20 10:14:43 CEST 2016 - schubi@suse.de

- Software raids on multipath:
The device names in the device order are mapped to e.g.
/dev/dm-4. This is wrong for multipath devices which still need
mapped devices like /dev/mapper/<number>_part2.
So, we are switching back in order to write the correct
AutoYaST settings. (bnc#996839)
- version 2.17.80

-------------------------------------------------------------------
Wed Sep 9 13:10:11 CEST 2015 - schubi@suse.de

Expand Down
62 changes: 61 additions & 1 deletion src/modules/AutoinstPartPlan.ycp
Expand Up @@ -45,6 +45,11 @@
*/
define AutoinstPartPlanT AutoPartPlan = [];

/*
* Probed disk raids
*/
define list<map> DiskRaids = [];

/* default value of settings modified */
define boolean modified = false;

Expand Down Expand Up @@ -349,6 +354,61 @@
}



/**
* Software raids on multipath.
* The device names in the device order are mapped to e.g.
* /dev/dm-4. This is wrong for multipath devices which still need
* mapped devices like /dev/mapper/<number>_part2.
* So, we are switching back in order to write the correct
* AutoYaST settings. (bnc#996839)
*/

define list map_device_order(list<string> devices)
{
list<string> mapped_devices = [];
foreach( string device, devices,
``{
if( search( device, "/dev/dm-" ) == 0 )
{
// probe.disk_raid could be expensive. So we are
// only probing if there is a dm device.
if( size(DiskRaids) == 0 )
{
DiskRaids = (list<map>) SCR::Read(.probe.disk_raid);
y2milestone("probed disk raids: %1", DiskRaids);
}
// Searching dev_names for /dev/dm-? device
list<string> dev_names = [];
foreach( map dm_device, DiskRaids,
``{
if( dm_device["dev_name"]:"" == device )
{
dev_names = dm_device["dev_names"]:[];
break;
}
});
// Searching /dev/mapper/<number>
foreach( string dev_name, dev_names,
``{
if( search( dev_name, "/dev/mapper/" ) == 0 )
{
mapped_devices = add( mapped_devices, dev_name );
break;
}
});
}
});
if( size(mapped_devices) > 0 )
{
y2milestone("mapped devices: %1 -> %2", devices, mapped_devices);
return( mapped_devices );
}
return( devices );
}



/**
* Create a partition plan for the calling client
* @return list partition plan
Expand Down Expand Up @@ -515,7 +575,7 @@
raid_options["persistent_superblock"] =
pe["persistent_superblock"]:false;
raid_options["raid_type"] = pe["raid_type"]:"raid0";
raid_options["device_order"] = pe["devices"]:[];
raid_options["device_order"] = map_device_order(pe["devices"]:[]);
new_pe["raid_options"] = raid_options;
}

Expand Down

0 comments on commit 79996f1

Please sign in to comment.