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

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



> 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's really set up to where you add all your actions, then you process
them.  If you want to do things in multiple passes (why?) you will need
to tear down the devicetree and rebuild it in order to clear out the
actions list.

- Chris


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