* storage/devicelibs/lvm.py (zeroLvmMetadata): zero out the LVM metadata
only. This basically means from 513 byte and on. This will also
ignore the firs 512 bytes if we are in a partition, but that does not
matter because LVM does not touch those bits anyways.
* storage/devicelibs/lvm.py (pv_complete): Complete here means that all
the related PVs for the containing VG are present in the system.
Returns the Completeness value and a list of known devices.
* storage/devicelibs/lvm.py (vg_complete): likewise but for VG.
* storage/devicelibs/lvm.py (vgreduce): introduces a new argument to the
function. rm means use the lvm --removemissing option.
* storage/devicetree.py (_handleSysCrapyness): New function intended to
catch all unwanted behavior from the system before continuing.
* storage/devicetree.py (questionReinitializeIVG): New function intended
to ask the user what to do in case we find inconsistent LVM metadata.
---
storage/devicelibs/lvm.py | 127 +++++++++++++++++++++++++++++++++++++++++++--
storage/devicetree.py | 104 ++++++++++++++++++++++++++++++++++++
2 files changed, 226 insertions(+), 5 deletions(-)
+def zeroLvmMetadata(device):
+ """ This dds from byte 513 to 200Mb+513 of the disk.
+
+ We assume that lvm has nothing to do with the first 512 bytes.
+ We assume that 200Mb is enough. My tests failed with 100Mb for
+ some unknown reason.
+ """
+ try:
+ fd = os.open(device, os.O_WRONLY)
+ os.lseek(fd, 513, os.SEEK_SET)
+ for i in range(200):
+ os.write(fd, "