Comment 21 for bug 717129

Revision history for this message
Mattias Backman (mabac) wrote :

Hi all,

I've tried to understand this problem, let's see if I'm anywhere close.

So there are two places in create_partitions where device operations take an unknown amount of time to complete, still after the command has returned. One place is after running parted, which zyga indicates with the sleep there, the other is after the sfdisk call.

It seems to me that the proper way to handle this would be to wait for a signal that everything is done. I see that there have been a few suggestions for waiting for the device to settle or get a signal back but I guess they don't work since there's no consensus around any method? (udevadm settle was mentioned to not work in https://bugs.launchpad.net/linaro-image-tools/+bug/701678/comments/2)

Some of the failures happen when running udisks in get_boot_and_root_partitions_for_media so some way of checking that udisks have gotten notification about partition changes would help in that case. Still wouldn't help when the sfdisk call fails after parted though. So perhaps this can't be solved by a single neat fix.

A crude way around this would be to just retry the sfdisk command if it raises an Error and give up after MAX_RETRIES attempts. The same could be done for the calls to udisks methods. It's similar to the sleeps but at least won't wait longer than necessary.

Thanks,

Mattias