[PATCH rhel5] (take II) Fix clearpart of PVs that are part of multidrive VGs (#545869).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Traceback occurs in this case:
* we have VG with PVs on 2 or more drives
* we are doing clearpart (e.g. via UI default partitioning) on only some of
  the drives (e.g. one of drives containing a PV of the VG is deselected
  in UI)

The fix removes requests depending on PV removed in clearpart, so that we
don't traceback later when processing depending VG request (the request
would be missing PV removed in clearpart -> traceback).

Traceback (most recent call first):
  File "/usr/lib/anaconda/partRequests.py", line 811, in getDevice
    if (r.size > 0) or (r.device is not None):
  File "/usr/lib/anaconda/partRequests.py", line 202, in toEntry
    device = self.getDevice(partitions)
  File "/usr/lib/anaconda/partitioning.py", line 124, in partitioningComplete
    entry = request.toEntry(anaconda.id.partitions)
  File "/usr/lib/anaconda/dispatch.py", line 201, in moveStep
    rc = stepFunc(self.anaconda)
  File "/usr/lib/anaconda/dispatch.py", line 124, in gotoNext
    self.moveStep()
  File "/usr/lib/anaconda/gui.py", line 1156, in nextClicked
    self.anaconda.dispatch.gotoNext()
AttributeError: 'NoneType' object has no attribute 'size'
---
 autopart.py   |    8 ++++----
 partitions.py |   12 ++++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/autopart.py b/autopart.py
index d827852..afb5ee8 100644
--- a/autopart.py
+++ b/autopart.py
@@ -1126,11 +1126,11 @@ def doClearPartAction(anaconda, partitions, diskset):
                 # and do not create dependent delete requests (VGs, LVs)
                 # because they would be processed (in doMetaDeletes) after
                 # lvm metadata had been removed and thus fail
-                if not old.fstype.getName() == "physical volume (LVM)": 
-                    partitions.deleteDependentRequests(old)
-                    clobber = False
-                else:
+                if old.fstype.getName() == "physical volume (LVM)": 
                     clobber = True
+                else:
+                    clobber = False
+                partitions.deleteDependentRequests(old, justRemove=clobber)
                 partitions.removeRequest(old)
 
                 drive = partedUtils.get_partition_drive(part)
diff --git a/partitions.py b/partitions.py
index e921716..9d654f1 100644
--- a/partitions.py
+++ b/partitions.py
@@ -1661,12 +1661,15 @@ class Partitions:
             if request.encryption.addPassphrase(self.encryptionPassphrase):
                 log.error("failed to add new passphrase to existing device %s" % (request.encryption.getDevice(encrypted=1),))
 
-    def deleteDependentRequests(self, request):
+    def deleteDependentRequests(self, request, justRemove = False):
         """Handle deletion of this request and all requests which depend on it.
 
         eg, delete all logical volumes from a volume group, all volume groups
         which depend on the raid device.
 
+        justRemove - only remove requests, do not create respective delete requests
+                     in self.deletes
+
         Side effects: removes all dependent requests from self.requests
                       adds needed dependent deletes to self.deletes
         """
@@ -1681,7 +1684,7 @@ class Partitions:
             elif isinstance(req, partRequests.VolumeGroupRequestSpec):
                 if id in req.physicalVolumes:
                     toRemove.append(req)
-                    if req.getPreExisting():
+                    if req.getPreExisting() and not justRemove:
                         delete = partRequests.DeleteVolumeGroupSpec(req.volumeGroupName)
                         self.addDelete(delete)
             elif isinstance(req, partRequests.LogicalVolumeRequestSpec):
@@ -1695,7 +1698,7 @@ class Partitions:
                     else:
                         vgname = tmp.volumeGroupName
 
-                    if req.getPreExisting():
+                    if req.getPreExisting() and not justRemove:
                         delete = partRequests.DeleteLogicalVolumeSpec(req.logicalVolumeName,
                                                                       vgname)
                         self.addDelete(delete)
@@ -1703,4 +1706,5 @@ class Partitions:
         for req in toRemove:
             self.deleteDependentRequests(req)
             self.removeRequest(req)
-        
+
+
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux