summaryrefslogtreecommitdiffstats
path: root/storage/devicetree.py
diff options
context:
space:
mode:
authorJoel Granados Moreno <jgranado@redhat.com>2009-04-15 13:03:40 +0200
committerJoel Granados Moreno <jgranado@redhat.com>2009-04-17 13:21:14 +0200
commita15a75019fa2370896a0434701486bcba16e8f3d (patch)
treee26e872371ca800aa56c6f2fa558327ad969bf21 /storage/devicetree.py
parent74763af9bb2ad7948ef95fba82061c974c92b722 (diff)
downloadanaconda-a15a75019fa2370896a0434701486bcba16e8f3d.tar.gz
anaconda-a15a75019fa2370896a0434701486bcba16e8f3d.tar.xz
anaconda-a15a75019fa2370896a0434701486bcba16e8f3d.zip
Re-implement the inconsistency functionality.
Diffstat (limited to 'storage/devicetree.py')
-rw-r--r--storage/devicetree.py118
1 files changed, 61 insertions, 57 deletions
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 5ce5d84f2..506a6c908 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1481,7 +1481,7 @@ class DeviceTree(object):
elif device.format.type == "lvmpv":
self.handleUdevLVMPVFormat(info, device)
- def _handleInconsistencies(self, device):
+ def _handleInconsistencies(self):
def reinitializeVG(vg):
# First we remove VG data
try:
@@ -1503,65 +1503,70 @@ class DeviceTree(object):
"exists": parent.exists}
parent.format = formats.getFormat(*[""], **kwargs)
- if device.type == "lvmvg":
- paths = []
- for parent in device.parents:
- paths.append(parent.path)
-
- # when zeroMbr is true he wont ask.
- if not device.complete and (self.zeroMbr or \
- questionReinitILVM(intf=self.intf, \
- vg_name=device.name, pv_names=paths)):
- reinitializeVG(device)
-
- elif not device.complete:
- # The user chose not to reinitialize.
- # hopefully this will ignore the vg components too.
- self._removeDevice(device)
- lvm.lvm_cc_addFilterRejectRegexp(device.name)
- lvm.blacklistVG(device.name)
+ def leafInconsistencies(device):
+ if device.type == "lvmvg":
+ paths = []
for parent in device.parents:
- self._removeDevice(parent, moddisk=False)
- lvm.lvm_cc_addFilterRejectRegexp(parent.name)
-
- return
+ paths.append(parent.path)
+
+ # when zeroMbr is true he wont ask.
+ if not device.complete and (self.zeroMbr or \
+ questionReinitILVM(intf=self.intf, \
+ vg_name=device.name, pv_names=paths)):
+ reinitializeVG(device)
+
+ elif not device.complete:
+ # The user chose not to reinitialize.
+ # hopefully this will ignore the vg components too.
+ self._removeDevice(device)
+ lvm.lvm_cc_addFilterRejectRegexp(device.name)
+ lvm.blacklistVG(device.name)
+ for parent in device.parents:
+ self._removeDevice(parent, moddisk=False)
+ lvm.lvm_cc_addFilterRejectRegexp(parent.name)
- elif device.type == "lvmlv":
- # we might have already fixed this.
- if device not in self._devices or \
- device.name in self._ignoredDisks:
return
- paths = []
- for parent in device.vg.parents:
- paths.append(parent.path)
-
- if not device.complete and (self.zeroMbr or \
- questionReinitILVM(intf=self.intf, \
- lv_name=device.name, pv_names=paths)):
-
- # destroy all lvs.
- for lv in device.vg.lvs:
- lv.destroy()
- device.vg._removeLogVol(lv)
- self._removeDevice(lv)
-
- reinitializeVG(device.vg)
-
- elif not device.complete:
- # ignore all the lvs.
- for lv in device.vg.lvs:
- self._removeDevice(lv)
- lvm.lvm_cc_addFilterRejectRegexp(lv.name)
- # ignore the vg
- self._removeDevice(device.vg)
- lvm.lvm_cc_addFilterRejectRegexp(device.vg.name)
- lvm.blacklistVG(device.vg.name)
- # ignore all the pvs
+ elif device.type == "lvmlv":
+ # we might have already fixed this.
+ if device not in self._devices or \
+ device.name in self._ignoredDisks:
+ return
+
+ paths = []
for parent in device.vg.parents:
- self._removeDevice(parent, moddisk=False)
- lvm.lvm_cc_addFilterRejectRegexp(parent.name)
- return
+ paths.append(parent.path)
+
+ if not device.complete and (self.zeroMbr or \
+ questionReinitILVM(intf=self.intf, \
+ lv_name=device.name, pv_names=paths)):
+
+ # destroy all lvs.
+ for lv in device.vg.lvs:
+ lv.destroy()
+ device.vg._removeLogVol(lv)
+ self._removeDevice(lv)
+
+ reinitializeVG(device.vg)
+
+ elif not device.complete:
+ # ignore all the lvs.
+ for lv in device.vg.lvs:
+ self._removeDevice(lv)
+ lvm.lvm_cc_addFilterRejectRegexp(lv.name)
+ # ignore the vg
+ self._removeDevice(device.vg)
+ lvm.lvm_cc_addFilterRejectRegexp(device.vg.name)
+ lvm.blacklistVG(device.vg.name)
+ # ignore all the pvs
+ for parent in device.vg.parents:
+ self._removeDevice(parent, moddisk=False)
+ lvm.lvm_cc_addFilterRejectRegexp(parent.name)
+ return
+
+ # Address the inconsistencies present in the tree leaves.
+ for leaf in self.leaves:
+ leafInconsistencies(leaf)
def populate(self):
""" Locate all storage devices. """
@@ -1594,8 +1599,7 @@ class DeviceTree(object):
# After having the complete tree we make sure that the system
# inconsistencies are ignored or resolved.
- for leaf in self.leaves:
- self._handleInconsistencies(leaf)
+ self._handleInconsistencies()
self.teardownAll()
try: