Make default exists value a boolean in DeviceFormat.__init__.

Signed-off-by: mulhern <amulhern@redhat.com>
Check resizable when assigning a new target size.

Signed-off-by: mulhern <amulhern@redhat.com>
Simplify _getSize() and currentSize().

In _getSize():
Remove pointless boolean expression. Only returning self.targetSize if it
does not equal self._size is kind of pointless, because if they are equal
then it is just as good to return the value of one as the other.

Make currentSize() look more like _getSize() so they're easier to compare.

Signed-off-by: mulhern <amulhern@redhat.com>
Split output from infofs program for size on whitespace.

Splitting on ' ' only is not good enough for jfs_tune.

Signed-off-by: mulhern <amulhern@redhat.com>
Change "Aggregate block size:" to "Physical block size:" for JFS.

Previous tags gave a size of 700+ MiB on a 100 MiB device which seemed wrong.
New tag choice yields 98 MiB which seems correct for that size device.

Signed-off-by: mulhern <amulhern@redhat.com>
Make an early exit if self._existingSizeFields is []

If so, there is no way to obtain size information and the value used
for other variants of that situation is 0, so return 0.

Signed-off-by: mulhern <amulhern@redhat.com>
Simplify FS.free().

The 'exists' check is not necessary because currentSize itself checks 'exists'.
We believe that minSize will always be a Size during execution, so there's
no reason to make sure that it is with a guard.

Signed-off-by: mulhern <amulhern@redhat.com>
Add another check for resizable in FS.doResize()

It can change in the middle of the method.

Signed-off-by: mulhern <amulhern@redhat.com>
Get rid of long() related code.

In Python 2.7 int() will return a long if the value is too long to be
represented by an int. No need to cast to long explicitly, and so no need
for long() related Python 3 compatibility stuff either.
Also, ints are pretty long, long enough to represent 1024**6 without any
trouble.

Signed-off-by: mulhern <amulhern@redhat.com>
Add a bunch of simple tests for filesystem formats.

Signed-off-by: mulhern <amulhern@redhat.com>
New version: 0.72
Check the status of the format being mounted.

Previous code checked the status of the format attribute. It seems
to make more sense to wait and check the status of the format selected
to be actually mounted, which may be the originalFormat attribute.

Signed-off-by: mulhern <amulhern@redhat.com>
Don't make overridden values actual properties.

When extending an abstract class which defines an abstract property it
is not necessary to make the overriding values properties, it's fine
just to make them regular class attributes. The abstract class checking
mechanism accepts these, and will have an error if they are not defined
at all.

The imaginary requirement to make them properties is something that seems
to follow naturally if you're thinking of a statically checked language.

It didn't cause any harm to make these fields properties, it was just
annoyingly verbose.

Signed-off-by: mulhern <amulhern@redhat.com>
Change the generic badly formatted label to one that's bad for all.

At least for all filesystems that are tested with this infrastructure.

Signed-off-by: mulhern <amulhern@redhat.com>
Make unnecessarily verbose properties into simple class attributes.

Signed-off-by: mulhern <amulhern@redhat.com>
Make it possible for NTFS to recognize the label it reads.

The regular expression was incorrect because NTFS really wasn't being
tested, because no NTFS filesystem could be created.

Signed-off-by: mulhern <amulhern@redhat.com>
Factor out MDRaidArrayDevice w/ type in ("mdcontainer", "mdbiosraidarray")

This patch factors out functionality associated w/ type
"mdcontainer" or "mdbiosraidarray" into separate subclasses.

It is also able to revert commit c197d2d39104cdef234daecf5c44098bc345b506
entirely, since the refactoring into MDBiosRaidArrayDevice w/
formatClassName None, handles all that functionality.

Leave some checks in MDRaidArrayDevice.__init__ to prevent using this class
instead of its subclass.

I tried to make the transformation as semantics preserving as possible.
It is kind of nice that the only changes needed to be made to
devices tests were to change the names of constructors.

Signed-off-by: mulhern <amulhern@redhat.com>
Change MDRaidArrayDevice to MDBiosRaidArrayDevice.

To conform with newly established MDRaidArrayDevice sub-hierarchy.

Signed-off-by: mulhern <amulhern@redhat.com>
Change _matchNames so that it is less restrictive

Also, omit transient parameter, it's not clear that it really helps much.

Signed-off-by: mulhern <amulhern@redhat.com>
Substitute simple value for single element array.

When you encounter an array, you kind of assume that there is some situation
under which it could contain other than exactly one value. If there is
no such situation, as is the case here, might as well not make it an
array. So, use format_designator instead of args.

Also, use format_designator in the error message. The error message is
about failure to look up a proper format, and it seems more reasonable
to include the format type with which the format was actually looked up,
which differs slightly from format_type.

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