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

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



On Thursday, May 14 2009, Radek Vykydal said:
> LVM metadata are removed 1) when labeling a disk (covers clearpart --initlabel
> cases) or 2) when deleting a partition upon a delete request if the request was
> created in clearpart.  Also we don't create dependent meta delete requests in
> this case as they would conflict with metadata removing in partition delete.
> If the delete request comes from UI, LVM metadata are removed as before by meta
> delete (VG) requests created in UI in previous steps.

Mostly looks okay... just one question that I don't remember as its been
too long since I dealt with this code a lot

> @@ -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?

> +    # 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() 

Jeremy


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