Fix test that guards forcible removal of dm partition nodes.

Since the superclass _postDestroy method sets self.exists to False, and
self.status can only be True for devices that exist, we cannot rely on
self.status to see if the device node remains.
devicePathToName should default to returning a basename.

This is specifically for the case of DiskFile, which has an
arbitrary file path, but it looks like the entire method could be
replaced with the basename call.
Pass a path (not a name) to devicePathToName.

Also, we were unfairly asking parted to make guesses about
getDeviceNodeName for arbitrary files outside of /dev.
Temporarily disable a test that isn't working.

Related: rhbz#1162823
Don't run selinux context tests when selinux is disabled.
Eliminate TmpFS.minSize()

TmpFS inherits both _minSize and _minInstanceSize from FS, where they are
both 0. TmpFS has no method to update _minInstanceSize, so _minInstanceSize
will always remain 0. Therefore, it would make sense for minSize() method
to just return the value of _minSize, indicating the the minimum size
for this filesystem is based just on its type, not on any information about
the particular instance. However, this is exactly what
DeviceFormat.minSize() which TmpFS would inherit if it didn't override,
does, so might as well just get rid of the overriding method, and let it
inherit.

This is a bit problematic, since 0 is used to mean unknown, but here means
0. It is possible that a method to obtain the minimum size of an existing
TmpFS instance should be written, but in the meantime, this change
makes the situation more obvious than it was previously.

Signed-off-by: mulhern <amulhern@redhat.com>
Get rid of FS._getRandomUUID() method.

The method was introduced in anaconda commit
bd1123738d8a6ea671f472c663ed8e1c882f93a7 in 2011 Jan, but was not used in
that commit in anaconda or blivet and hasn't beeen used since.
It accompanied writeRandomUUID, which was removed in a previous commit.

If we really needed a random uuid method it should go in utils, but we do
not.

Signed-off-by: mulhern <amulhern@redhat.com>
Check the minimum member size for BtrfsVolumeDevices.

Update some devices tests to be more realistic by only having member devices
sufficiently large.

Also make failing test that relied on literal constant value that was
supposed to be minimum member size pass again and add a few tests to
bracket the minimum member size in case it changes again.

Signed-off-by: mulhern <amulhern@redhat.com>
Add more arguments to mpathconf (#1154347)

Setting find_multipaths to yes will keep multipath from creating a
multipath device unless one of the following conditions is met:

  - two non-blacklisted paths have the same wwid
  - a path has the same wwid as a previously created multipath device
  - the user forced the creation of a device

In other words, only create a multipath device if there is a device with
multiple paths. This would be helpful.
Remove BTRFS._resizeArgs()

Without a corresponding _resizefs it has no point in existing.
Resizing btrfs will probably requires "btrfs filesystem resize ..." command,
which doesn't expect those arguments.

Signed-off-by: mulhern <amulhern@redhat.com>
Remove pointless assignment to _formattable in Iso9660FS.

Let it inherit the assignment from DeviceFormat, like all the other
filesystems that are not formattable.

Signed-off-by: mulhern <amulhern@redhat.com>
Complete labelFormatOK() method docstring.

Signed-off-by: mulhern <amulhern@redhat.com>
Establish a separate directory for tasks.

Tasks are things that require running some kind of application to get
data, but don't write to data structures that represent storage.

Each task should encapsulate all its actions, as well as knowledge of
whether the underlying resources that it requires are available.

Signed-off-by: mulhern <amulhern@redhat.com>
Add an abstract Task class w/ a couple of necessary methods.

Signed-off-by: mulhern <amulhern@redhat.com>
Add some infrastructure for tracking availability of applications.

Signed-off-by: mulhern <amulhern@redhat.com>
Separate filesystem labeling classes into separate tasks.

fslabel.py is separated into fswritelabel.py and fsreadlabel.py because
reading and writing are separate tasks, albeit they use the same
applications. Get to lose the irritating reads attribute this way.

Separate fslabeling into fslabeling, which handles generic information
about labeling, i.e, label format requirements, and fscreate, which handles
the labeling portion of create. In future, fscreate should include all
the creation task, which is why this small file currently gets this
important seeming name.

Use these separate classes in fs.py.

Fix up tests appropriately.

Fix bugs:
* Fix regular expression for fsreadlabel.NTFSLabel

The regular expression had fallen into an incorrect state because it can
never really be tested since NTFS._formattable is False, so the format
can never be created.

* In a labeling test, make the bad format label a universally bad format.

NTFS is kind of permissive about labels, but this particular label has
to be a bad format for all tested filesystem formats. All the filesystems
we test require labels to be fewer than 129 characters, so we go with that.

Signed-off-by: mulhern <amulhern@redhat.com>
Abstract filesystem info gathering application into a separate class.

Use it in appropriate place in fs methods.

Add some tests.

Signed-off-by: mulhern <amulhern@redhat.com>
Make NTFS._formattable True so that it can be created for testing.

Add or modify tests as appropriate.

Signed-off-by: mulhern <amulhern@redhat.com>
Add a class hierarchy for extracting filesystem sizes.

Use the task in fs.py.

Rewrite _getExistingSize() into getSize(). Fix some bugs:
* If _existingSizeFields was [], the result would be 1 B. Now this can't
happen, due to the increased modularity. After refactoring, either there
is no size getting task for the fs, or there is, and if there is
it has the tags appropriate to extracting the information.
* Split the fields on whitespace, not ' '. JFS app uses tabs for formatting.
* For JFS, changed "Aggregate block size" to "Physical block size". Old
combination yielded much to large a value for the device, around 700 MiB.
New value yields 98 MiB for the size, which is about right given that the
device is 100 MiB, and JFS is a _journaling_ file system.

Add some tests.

Signed-off-by: mulhern <amulhern@redhat.com>
Add an fsck handling task.

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