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>