Comment 1 for bug 1531171

Scott Moser (smoser) wrote :

for justification, the maas build process basically does this:

qemu-img create -f qcow2 -b pristine-readonly.img trash.img
qemu-nbd --connect /dev/nbd0 trash.img
mount /dev/nbd0 /mnt
chroot /mnt apt-get install ....
cp /mnt/boot/vmlinuz .
umount /mnt
rm -f trash.img

we dont *need* it, but using qemu-nbd there is faster at least initially then copying 'pristine-readonly.img' which may be large. If loading nbd was non-trivial for security or some other reason then i'd be fine to work around that.

note, selection of a /dev/nbd0 is done by mount-image-callback, which attempts to find an unused device and clean up after.