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>
Add a create and format task.
Override formattable in FS.

Stop using redundant _formattable class attribute.

This makes TmpFS.formattable False where before it was True, but
on examining the uses of formattable that change looks pretty safe.

Signed-off-by: mulhern <amulhern@redhat.com>
Add an fssync class.

The use of this class is a bit ad-hoc, because only one filesystem, XFS
actually syncs at this time.
Add a dirty task.

This task extracts information about the state of the filesystem's data.

Since self.dirty and self.errors are only used to calculate whether the
filesystem needs fsck, can remove them from the filesystem's instance
attributes.

Signed-off-by: mulhern <amulhern@redhat.com>
Add some tests that check coherence of filesystem data after creation.

A filesystem should always be clean and free of errors immediately
after creation.

Check this indirectly with the needsFSCheck property.

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