Find more used devices when calculating unused devices (#1043763)

Related: rhbz#1043763

Original commit message (cherry-picked from commit
a3bff73119413fb1ea49febfc0d58bf318003ad8):

Newly formatted devices are used unless mountpoint is empty. (#966078)

The previous algorithm was only including filesystems with mountpoints
and swap devices, ignoring new prepboot, biosboot, &c.

Signed-off-by: mulhern <amulhern@redhat.com>
Make DeviceTree.hide() remove a larger set (#1043763)

Related: rhbz#1043763

If a device is hidden these things now happen:
1) All actions are canceled. Note that canceling a device create action will
cause the device to be removed. Note that it should be the case that no
existing device has a device create action associated with it.
Previously only a subset of actions were canceled.
2) The device being hidden is removed using _removeDevice. An additional
post-processing step adds the name of the device back into self.names.
Other steps associated with hiding the device remain the same.

Note: The device exists if and only if it has not been removed by the
cancellation of all actions. So, if it does not exist, then the method
is done after action cancelation. However, if the device does exist, it should
be removed, special hiding actions should be done, and its name should be
inserted back into self.names.

Signed-off-by: mulhern <amulhern@redhat.com>
Log action cancelation (#1043763)

Related: rbhz#1043763

Signed-off-by: mulhern <amulhern@redhat.com>
Set req_name to None at the top of initializer (#1043763)

Related: rhbz#1043763

To avoid a has no attribute req_name error.

Signed-off-by: mulhern <amulhern@redhat.com>
Extend the list of things to be omitted if moddisk is False (#1043763)

Related: rhbz#1043763

If moddisk is False then avoid removing partitions, but also avoid removing
logical volumes and subvolumes.

The idea is to leave information about what is on the device intact, but to
remove it from the list of devices.

Only the top few lines have actually changed, the rest is indentation only.

Signed-off-by: mulhern <amulhern@redhat.com>
Only set device for mountpoint if it is not None (#1043763)

Related: rhbz#1043763

Unless the else is there the block above never has any effect.

Signed-off-by: mulhern <amulhern@redhat.com>
Add hidden flag to devicetree.getDeviceByID (#1043763)

Related: rbhz#1043763

Similar to devicetree.getDeviceByLabel, etc.

Signed-off-by: mulhern <amulhern@redhat.com>
When copying a root, also copy hidden devices (#1043763)

Related: rhbz#1043763

Otherwise, even if the devices are unhidden the roots mounts or swaps will
remain empty.

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