image_to_vm: Retry scanning for partitions if it didn't work the first time.

It seems to be that scanning for partitions doesn't always work, and at least
some versions of the kernel ignore those failures. We can detect if partitions
we expect to be there are there, and if they aren't then manually trigger a
rescan.

This CL also gets rid of some debug output which was added earlier, and
changes the -P option to --partscan since there seems to be another version of
losetup where -P means something different.

BUG=chromium:411693
TEST=Ran a butterfly-paladin tryjob which didn't activate the retry
loop. Ran in a way that defeated the partition scanning so that it would
go into the retry loop, fixed the source file, and then let the retry
run. Verified that the partitions were discovered.

Change-Id: I336470ad873b0393e44526e78646d6d107c1f552
Reviewed-on: https://chromium-review.googlesource.com/218620
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
1 file changed