Re: [PATCH] Remove LVM metadata when doing clearpart (#426615)

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

 



thanks for review,

@@ -1118,12 +1122,20 @@ def doClearPartAction(anaconda, partitions, diskset):
                     part = disk.next_partition(part)
                     continue
- partitions.deleteDependentRequests(old)
+                # for PV, set a flag to remove lvm metadata in deletePart
+                # 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:
+                    clobber = True

Don't we depend on the delete requests also so that we can not have the
old volume requests still around in the UI?

We don't, the old volume requests are removed in doAutoPartitioning:1467-1496, where existence of their pv requests (removed in doClearPartAction) is checked.

+    # remove metadata from partitions
+    try:
+        disk = parted.PedDisk.new(dev)
+    except parted.error, msg:
+        log.debug("parted error: %s" % (msg,))
+ else: + part = disk.next_partition()
+        while part:
+            if (not part.is_active() or (part.type == parted.PARTITION_EXTENDED) or
+               (part.disk.type.name == "mac" and part.num == 1 and part.get_name() == "Apple")):
+                part = disk.next_partition(part)
+                continue

For this iterator, you can just use get_all_partitions()

I just used the same condition as in clearpart here for initlabel.
get_all_partitions() filters out parts which are not part.is_active().
Regarding other two conditions -- extended partition should be ok,
but about Apple on disk with "mac" type I'm not sure -- it seems
safer to me to use the original conditions.

Radek

_______________________________________________
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