[Openstack] File injection support

Scott Moser smoser at ubuntu.com
Fri Jun 8 15:48:58 UTC 2012


On Fri, 8 Jun 2012, Scott Moser wrote:

> On Fri, 8 Jun 2012, Pádraig Brady wrote:
>
> > On 06/08/2012 09:20 AM, Fredric Morenius wrote:
> > > Hello All,
> > >
> > > An update on the use of the qemu-nbd/kpartx based solution to inject files into VM images:
> > >
> > > After some more testing it has turned out that injection into the UEC version of CirrOS (this: https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-uec.tar.gz) works fine, but injection into the qcow2 version of the image produces the error given in the previous mail, so there seems to be robustness problems with these tools.
> >
> > Yes it's seems that qemu-nbd has issues with this image?
> >
> > # rpm -qf $(which qemu-nbd)
> > qemu-common-1.0-17.fc17.x86_64
> > # qemu-img info cirros-0.3.0-x86_64-disk.img
> > image: cirros-0.3.0-x86_64-disk.img
> > file format: qcow2
> > virtual size: 39M (41126400 bytes)
> > disk size: 9.3M
> > cluster_size: 65536
> > # qemu-nbd -c /dev/nbd15 $PWD/cirros-0.3.0-x86_64-disk.img
> > # ls -la /sys/block/nbd15/pid
> > -r--r--r--. 1 root root 4096 Jun  8 10:19 /sys/block/nbd15/pid
> > # kpartx -a /dev/nbd15
> > device-mapper: resume ioctl on nbd15p1 failed: Invalid argument
> > create/reload failed on nbd15p1
> >
> > If I convert to raw with qemu-img, I can mount loopback fine.
>
> Well, interesting. It does seem to work here:
> $ dpkg-query --show qemu-utils
> qemu-utils  1.0+noroms-0ubuntu13
> $ cd /tmp
> $ wget -q https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
> $ md5sum cirros-0.3.0-x86_64-disk.img
> 6654705afc4b74fda3e1f4330559d066  cirros-0.3.0-x86_64-disk.img

Whoops. I had a local image that was different (must have been laying
around from long ago, the wget saved to .1).  It does still work though.

$ md5sum cirros-0.3.0-x86_64-disk.img
50bdc35edb03a38d91b1b071afb20a3c  cirros-0.3.0-x86_64-disk.img

$ qemu-img info cirros-0.3.0-x86_64-disk.img
image: cirros-0.3.0-x86_64-disk.img
file format: qcow2
virtual size: 39M (41126400 bytes)
disk size: 9.3M
cluster_size: 65536

The same nbd -c... mount work as shown.


More information about the Openstack mailing list