Bug 1120979

Summary: Retaining existing Software RAID via AutoYast is broken: "can't find reusable device"
Product: [openSUSE] openSUSE Tumbleweed Reporter: Pieter Hollants <pieter>
Component: YaST2Assignee: YaST Team <yast-internal>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Major    
Priority: P5 - None CC: ancor, aschnell, igonzalezsosa
Version: Current   
Target Milestone: ---   
Hardware: x86-64   
OS: Other   
URL: https://trello.com/c/lZCZ7gmP/
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: AutoYast XML file for creating the setup
Screenshot showing correct setup creation
y2logs of correct setup creation
AutoYast XML file for reusing the RAID afterwards in another installation
Screenshot showing the error message shown trying to reuse the RAID
y2logs of failed RAID reuse
Debugging Y2Storage::AutoinstProfile::PartitioningSections
Debugging the actual bug

Description Pieter Hollants 2019-01-07 21:13:31 UTC
In order to retain an existing Software RAID an old mailing list by Thomas Fehr suggested [1]:

- set "initialize" to false for every disk
- set "create","format" to false for every partition belonging to a raid
- set "initialize" to false for /dev/md
- set "create" to false for every raid device in /dev/md to reuse
- set "format" for /dev/md as prefered (e.g. false for /home, true for /)
- set "<use>free</use>" for /dev/md entry in disks

This is broken in current (20181225) Tumbleweed. While creating partition plans the message is shown:

  drives[4] > partitions[1]:
    Reusable device not found

Find attached:
- the AutoYast profile used to create the setup (create = true everywhere)
- a screenshot of the Installation summary showing Yast does the right thing
- the Y2Logs for this successful creation
- the AutoYast profile used afterwards trying to reuse the RAID (create = false everywhere)
- a screenshot of the error message shown
- the Y2Logs for this unsuccessful reuse attempt up to the error message

[1]: https://opensuse-autoinstall.opensuse.narkive.com/bAxfdvct/retaining-software-raid-devices-during-automated-installation-with-autoyast
Comment 1 Pieter Hollants 2019-01-07 21:14:17 UTC
Created attachment 793798 [details]
AutoYast XML file for creating the setup
Comment 2 Pieter Hollants 2019-01-07 21:14:56 UTC
Created attachment 793799 [details]
Screenshot showing correct setup creation
Comment 3 Pieter Hollants 2019-01-07 21:15:15 UTC
Created attachment 793800 [details]
y2logs of correct setup creation
Comment 4 Pieter Hollants 2019-01-07 21:15:54 UTC
Created attachment 793801 [details]
AutoYast XML file for reusing the RAID afterwards in another installation
Comment 5 Pieter Hollants 2019-01-07 21:16:12 UTC
Created attachment 793802 [details]
Screenshot showing the error message shown trying to reuse the RAID
Comment 6 Pieter Hollants 2019-01-07 21:17:18 UTC
Created attachment 793803 [details]
y2logs of failed RAID reuse
Comment 7 Pieter Hollants 2019-01-08 00:31:39 UTC
Created attachment 793811 [details]
Debugging Y2Storage::AutoinstProfile::PartitioningSections

I saw in y2log a message that /dev/md0 could not be found and compared 01-probed.yml and 02-proposed.yml and thought that maybe the bug is that in the one case it's /dev/md0 and in the other case /dev/md/0, so I tried the new SLES15+ syntax for RAID setup, but that didn't help.

I then started actually debugged this issue a bit and it looks to me that for /dev/md* the <partition_nr> tag does not actually end up in Y2Storage::AutoinstProfile::PartitioningSection, causing y2storage/proposal/autoinst_drive_planner.rb's find_partition_to_reuse() to indeed not find /dev/md0.
Comment 8 Pieter Hollants 2019-01-08 00:56:12 UTC
Sorry, wrong debugging info (apparantly one can't delete attachments).
Comment 9 Pieter Hollants 2019-01-08 01:16:29 UTC
Created attachment 793812 [details]
Debugging the actual bug

Turns out I wasn't so wrong, this shows the actual culprit: In add_md_reuse() we do

  md_to_reuse = devicegraph.md_raids.find { |m| m.name == md.name }

but in the device graph m.name is "/dev/md/0" whereas we're looking for a "md.name" of "/dev/md0" (because following the instructions in [1] I did not specify a <raid_name> in /dev/md's <partition> block).

So this check should be something like 

  md_to_reuse = devicegraph.md_raids.find { |m| m.name == md.name or m.sysfs_name == md.name[5, md.name.length] }

[1]: https://doc.opensuse.org/projects/autoyast/#ay.partition_sw_raid
Comment 10 Pieter Hollants 2019-01-08 01:40:18 UTC
Patch under way at https://github.com/yast/yast-storage-ng/pull/819
Comment 11 Pieter Hollants 2019-01-12 19:02:30 UTC
Changing component to Yast2 because this is actually a y2storage bug, not an Autoyast bug.
Comment 15 Steffen Winterfeldt 2019-01-23 15:25:19 UTC
Is bug 1121720 related, then?
Comment 16 Ancor Gonzalez Sosa 2019-01-24 14:48:53 UTC
(In reply to Ancor Gonzalez Sosa from comment #14)
> (In reply to Steffen Winterfeldt from comment #12)
> 
> Imo (added to CC) will take a look and provide the proper patch.

Imo already tried the patch proposed in the pull request comments and he verified it fixes this problem.

He will verify if it also fixes bug#1121720. I have created a Trello card for both bugs together, so they are tracked together in our following sprint (maybe even before).
Comment 18 Ancor Gonzalez Sosa 2019-02-11 12:12:10 UTC
The fix to this (together with some other improvements about handling MD names in AutoYaST) has been submitted as:

- Maintenance update to SLE-15 / Leap 15.0 https://build.suse.de/request/show/183959
- Submit request to SLE-15-SP1 / Leap 15.1 https://build.suse.de/request/show/184086
- Submit request to Tumbleweed will be sent by the continuous integration as soon as the problems with the switch to Ruby 2.6 are ironed up there.
Comment 23 Swamp Workflow Management 2019-06-14 16:14:32 UTC
SUSE-RU-2019:1498-1: An update that has 6 recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1104899,1120979,1121720,1122660,1130256,1134330
CVE References: 
Sources used:
SUSE Linux Enterprise Module for Open Buildservice Development Tools 15 (src):    libstorage-ng-3.3.318-3.25.5
SUSE Linux Enterprise Module for Basesystem 15 (src):    autoyast2-4.0.69-3.17.10, libstorage-ng-3.3.318-3.25.5, yast2-storage-ng-4.0.221-3.43.1
SUSE Linux Enterprise Installer 15 (src):    autoyast2-4.0.69-3.17.10, libstorage-ng-3.3.318-3.25.5, yast2-storage-ng-4.0.221-3.43.1

NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Comment 24 Swamp Workflow Management 2019-06-24 13:35:09 UTC
openSUSE-RU-2019:1609-1: An update that has 6 recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1104899,1120979,1121720,1122660,1130256,1134330
CVE References: 
Sources used:
openSUSE Leap 15.0 (src):    autoyast2-4.0.69-lp150.2.19.1, libstorage-ng-3.3.318-lp150.2.19.1, yast2-storage-ng-4.0.221-lp150.2.28.1