Bug#842299: autopkgtest-virt-qemu: attaching base image makes btrfs very confused

Christian Seiler christian at iwakd.de
Mon Oct 31 16:35:43 UTC 2016


On 10/30/2016 09:45 PM, Christian Seiler wrote:
> On 10/30/2016 09:40 PM, Martin Pitt wrote:
>> Christian Seiler [2016-10-30 21:12 +0100]:
>>> Well, it's not actually SYSTEMD_READY, the "btrfs ready" builtin is
>>> actually the culprit.
>>
>>> So one needs to make sure the btrfs ready builtin is never executed
>>> for the corresponding devices. Which is why I did the LABEL/goto
>>> logic in my example.
>>
>> So to generalize that a bit: blkid is called in
>> 60-persistent-storage.rules, so we could add a rule to the already
>> existing /run/udev/rules.d/61-baseimage.rules:
>>
>>      KERNEL=="vd*", ENV{ID_SERIAL}=="BASEIMAGE", ENV{ID_FS_TYPE}="", ENV{ID_FS_USAGE}="", ENV{ID_FS_UUID}=""
>>
>> This should short-circuit 64-btrfs.rules and any similar rules. This
>> at least works in a VM with ext4.
> 
> Yes, that looks very reasonable and future-proof. Let's test if
> that actually works with btrfs.

Hmm, this doesn't work for me consistently with a btrfs image. If I
do udevadm test on the device later though, the rules are interpreted
correctly.

I believe there might be a race condition here: autopkgtest-virt-qemu
sends udevadm control --reload to the container, but doesn't wait for
the prompt to reappear, before attaching the device itself. Adding
VirtSubproc.expect(term, b'#', 10)
after the udevadm control --reload line helps here. Martin, since you
maintain udev: does udevadm control --reload wait until reload is
complete or not? Reading over the source and strace()ing udevd and
udevadm seem to indicate that, but I'd like to be sure.

In any case, patch against autopkgtest-virt-qemu is attached that
appears to work for me. (And it's definitely better than before.)
I've taken the liberty of using := instead of =, to make sure no
later rule overwrites the file system type again.

Regards,
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: autopkgtest.patch
Type: text/x-patch
Size: 1493 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/autopkgtest-devel/attachments/20161031/02490c10/attachment.bin>


More information about the autopkgtest-devel mailing list