Use the value of the Anaconda ibft flag to set the Blivet ibft flag

Previously the Anaconda ibft flag has been ignored by Blivet,
now it is respected, which makes it possible to for example disable
ibft by passing the noibft option to Anaconda during the installation.
Use the value of the Anaconda dmraid flag to set the Blivet dmraid flag
Do not try to activate dmraid sets if the dmraid usage flag is false
Add method to set the default disklabel (#1078537)

platform.setDefaultDiskLabel(label) will move the disklabel to the front
of the list if it is supported on the current platform and return True.
If it isn't supported it will return False and leave the list as is.
Remove some extra imports.

Signed-off-by: mulhern <amulhern@redhat.com>
Update BTRFS initializer comments for level type.

Signed-off-by: mulhern <amulhern@redhat.com>
Explicitly accept a string as well as a RAIDLevel object.

This aligns this choice with the equivalent for mdraid.mdcreate.

Signed-off-by: mulhern <amulhern@redhat.com>
Move skipUnless decorator to the top level class of skipped classes.

Simpler than to distribute the decorator uses all over the base classes.

Signed-off-by: mulhern <amulhern@redhat.com>
Add num_blocks parameter to makeLoopDev().

Signed-off-by: mulhern <amulhern@redhat.com>
Use correct parameters in __init__() in subclasses of unittest.TestCase.

Can get away with using *args, **kwargs, but it is not helpful.

Signed-off-by: mulhern <amulhern@redhat.com>
Make DevicelibsTestCase devices configurable.

Allow choosing size of backing file. Do not use the path of the backing
file in all subclasses in previous strange way, since it is irrelevant
to all the subclasses, and only relevant to DevicelibsTestCase which has
to do the necessary cleanup. Use a new attribute, loopDevices, to store
the actual loopDevices, which are what is required by the subclasses.
Fix up the subclasses to use this attribute appropriately. Change directory
of backing file to /var/tmp instead of /tmp.

Signed-off-by: mulhern <amulhern@redhat.com>
New version: 0.57
Add a test for a btrfs error associated with small devices (#1109195)

Related: fed#1109195

Signed-off-by: mulhern <amulhern@redhat.com>
Accept None for btrfs raid levels (#1109195)

Resolves: fed#1109195

None means None was assigned, so accept any default that, e.g., mkfs.btrfs
decides on. This default is hard to predict, as it may vary with the size of
the backing device as well as other factors.

Signed-off-by: mulhern <amulhern@redhat.com>
Move DevicelibsTestCase up to the top level of the testing directory.

It is used by formats_test tests as well as tests in devicelibs_test.
Change all uses appropriately.

Signed-off-by: mulhern <amulhern@redhat.com>
Move down or remove assignment to device in add* methods.

The assignment at the top of the method is distracting, because it looks
like the value is relevant throughout the method when it is only relevant
at the end. In some cases, the assignment value is never used.

Signed-off-by: mulhern <amulhern@redhat.com>
Remove unused 'slaves' variable.

It is initialized and modified, but never actually used.

Signed-off-by: mulhern <amulhern@redhat.com>
Omit special check for md devices in addUdevDevice().

If the device appears to be an md device, just call addUdevMDDevice directly.

Use udev_device_get_md_uuid() to get the mduuid of the array, but catch
a key error. This has the same effect as the previous code, but is a bit
more proper, even if more wordy.

Signed-off-by: mulhern <amulhern@redhat.com>
Factor out commonalities among getDevice[s|]By* methods.

Log each and every method call and return.
Make all getDevice[s|]By* methods respect incomplete and hidden parameters.
Add checks for the existance of the value to match by in some methods
where none such existed.

Signed-off-by: mulhern <amulhern@redhat.com>
Remove preferLeaves parameter from getDeviceByPath()

The only use of this parameter was removed in anaconda commit
8eb4f8f82ace112e7f216b6e70633a3549949187 (Wed Aug 8 09:58:51 2012).
It was added in anaconda commit 718622ed2b54979b09712c10bc94fd86f6ea81e8
(Mon Nov 21 09:50:25 2011 -0600).

This is a semantic change, the new version returns the first match it finds,
whereas the old version prefers a non-leaf match by default.
However, the list of devices is searched in order, and the list is generally
ordered with leaves at the end of the list, so a non-leaf device will generally
be found first.

Signed-off-by: mulhern <amulhern@redhat.com>