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

Re: Cannot add a partition after devicetree.processActions()



On 03/26/2012 06:10 PM, David Lehman wrote:
> On Mon, 2012-03-26 at 17:30 +0200, Jan Safranek wrote:
>> Consider following code snippet ('disk' is /dev/sda without any partitions):
>>     part1 = storage.newPartition(disks=[disk], size=10)
>>     storage.createDevice(part1)
>>     pyanaconda.storage.partitioning.doPartitioning(storage=storage)
>>     storage.devicetree.processActions(dryRun=False)
>>
>>     part2 = storage.newPartition(disks=[disk])
>>     storage.createDevice(part2)
>>     pyanaconda.storage.partitioning.doPartitioning(storage=storage)
>>     storage.devicetree.processActions(dryRun=False)
>>
>> The second processActions() fails with DeviceError('device has already
>> been created', 'sda1'). sda1 has been indeed create during the first
>> processActions(). Why the devicetree tries to create it again? How can I
>> clean it up?
>>
>> Is the above code valid or really only one processActions() is allowed?
> 
> It is not designed specifically to allow multiple calls to
> processActions. However, it should require little more than a single
> line of code to clear the action list before creating the second set of
> devices. For now we can't clear the action list automatically because it
> is used later to aid in writing anaconda-ks.cfg. This will probably
> change in F18.
> 
> Try adding the following right after each processActions call:
> 
> storage.devicetree._actions = []

2nd storage.devicetree.processActions(dryRun=False):
DeviceCreateError: ("Can't have overlapping partitions.", 'sda2')

Weird, pyanaconda.storage.partitioning.doPartitioning() allocates part2
correctly, it does not overlap anything:

part1.partedPartition.geometry: start: 2048  end: 22527
part2.partedPartition.geometry: start: 22528 end: 1046527

storage.devicetree._actions = [] is not enough.

Jan


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