Bug 1148373

Summary: RAID error when attempting to add encryption to BTRFS volume using anaconda
Product: [Fedora] Fedora Reporter: Andreas Fleig <andreasfleig>
Component: python-blivetAssignee: David Lehman <dlehman>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: amulhern, anaconda-maint-list, bcl, dlehman, vpodzime
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: anaconda-21.48.10-1.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1148980 (view as bug list) Environment:
Last Closed: 2014-10-20 23:02:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1148980    

Description Andreas Fleig 2014-10-01 10:06:41 UTC
Description of problem:

Adding encryption to a BTRFS volume, by checking "encrypt" in the volume configuration dialog which also sets size policy and RAID level, fails with a RAID error: "you need at least 1 memberfor RAID level single".

Version-Release number of selected component (if applicable):
Fedora 21 Alpha Live CD

How reproducible:
Always

Steps to Reproduce:
1. Add a BTRFS volume
2. Open the volume configuration dialog, set size policy to maximum size, and check "encrypt"
3. Close the dialog and click "update"

Actual results:
RAID error is thrown: "you need at least 1 memberfor RAID level single"

Expected results:
Encryption should be added to BTRFS volume

Additional info:

Relevant code path starts at: blivet.devicefactory.PartitionSetFactory.configure, line 1024:
`if not member_encrypted and self.encrypted:`
* attempts to delete container parents and add encrypted container afterwards
* container.parents.remove() fails, error is thrown in blivet.devices.BTRFSVolumeDevice._removeParent: resulting number of devices would be too low for a "single" ersatz raid
* the parent that should be deleted in this case is a "non-existant BTRFS partition"

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1000031#c3

Comment 1 Vratislav Podzimek 2014-10-01 10:21:01 UTC
David, I think this is a result of the change that implementated the hooks for adding/removing devices. It seems like there are cases where we need to inhibit/skip some checks when doing changes (reparenting a device, in this particular case).

Comment 2 David Lehman 2014-10-01 16:27:17 UTC
That is correct. That check in BTRFSVolumeDevice._removeMember was meant to only apply to existing devices. This exposes the fact that blivet doesn't necessarily ensure that devices with RAID always have an appropriate number of members. That's separate from this, though.

Comment 3 David Lehman 2014-10-02 19:56:04 UTC
I decided I like us validating member count changes against the current raid level and also validating new raid levels against current member count, so I took a different approach to fixing this. Instead of changing any device classes, I changed the device factory to unset the raid level before configuring the container's member set, thus bypassing any raid-level-specific checks until after we have finished with the member devices.

Comment 4 Vratislav Podzimek 2014-10-02 20:10:54 UTC
(In reply to David Lehman from comment #3)
> I decided I like us validating member count changes against the current raid
> level and also validating new raid levels against current member count, so I
> took a different approach to fixing this. Instead of changing any device
> classes, I changed the device factory to unset the raid level before
> configuring the container's member set, thus bypassing any
> raid-level-specific checks until after we have finished with the member
> devices.
Sounds good to me.

Comment 5 Fedora Update System 2014-10-15 13:15:50 UTC
anaconda-21.48.10-1.fc21, pykickstart-1.99.63-2.fc21, python-blivet-0.61.5-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/pykickstart-1.99.63-2.fc21,python-blivet-0.61.5-1.fc21,anaconda-21.48.10-1.fc21

Comment 6 Fedora Update System 2014-10-16 17:18:49 UTC
Package anaconda-21.48.10-1.fc21, pykickstart-1.99.63-2.fc21, python-blivet-0.61.5-1.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing anaconda-21.48.10-1.fc21 pykickstart-1.99.63-2.fc21 python-blivet-0.61.5-1.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-12944/pykickstart-1.99.63-2.fc21,python-blivet-0.61.5-1.fc21,anaconda-21.48.10-1.fc21
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2014-10-20 23:02:15 UTC
anaconda-21.48.10-1.fc21, pykickstart-1.99.63-2.fc21, python-blivet-0.61.5-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.