Bug#800845: autopkgtest: Add support for nested VMs

Christian Seiler christian at iwakd.de
Sun Mar 6 17:18:19 UTC 2016


Hi Martin,

On 03/06/2016 04:29 PM, Christian Seiler wrote:
> What you _could_ do is create a flag file in /run and update the reboot
> script to update the initramfs before rebooting if that flag file is
> set - that way only if a reboot is needed will the initramfs be updated
> and hence you optimize for the common case where that's not needed.

So this took me longer than I hoped, because a kernel update on my host
screwed up QEMU's support for rebooting VMs in general - and it was a
real pain to figure that out.

Now that that works again:

I've implemented this in the following way:

 - touch /run/autopkgtest-update-initramfs-at-reboot in setup_baseimage()
 - /sbin/autopkgtest-reboot{,-prepare}:
      - if /run/autopkgtest-update-initramfs-at-reboot exists AND 
           update-initramfs is present, update the initramfs
 - /usr/share/initramfs-tools/hooks/autopkgtest (created in
   setup_baseimage()):
      - unconditionally remove /run/autopkgtest-update-initramfs-at-reboot
        Because a initramfs-tools hook will only be called if an initramfs
        is generated - but if it's generated anyway, we might as well
        remove the flag file, because then we can save ourselves a lot of
        work.

So basically, IF a reboot is requested AND no initramfs was generated
since, THEN and ONLY THEN will update-initramfs be called. So we minimize
how often it's required to actually generate it.

Tested it against my update open-iscsi package tests (see my RFC mail),
and it works without a hitch.

Patch is attached.

Hopefully that satisfies your performance requirements?

Regards,
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-adt-virt-qemu-regenerate-initramfs-only-on-reboots.patch
Type: text/x-diff
Size: 3500 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/autopkgtest-devel/attachments/20160306/3e3e1149/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/autopkgtest-devel/attachments/20160306/3e3e1149/attachment.sig>


More information about the autopkgtest-devel mailing list