[Openstack] File injection support

Pádraig Brady P at draigBrady.com
Fri Jun 8 16:03:25 UTC 2012


On 06/08/2012 04:35 PM, 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

I downloaded again and get 50bdc35edb03a38d91b1b071afb20a3c
I presume the above md5sum is for a mounted/modified image?

> $ 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: 11M
> cluster_size: 65536
> $ sudo qemu-nbd -c /dev/nbd15 $PWD/cirros-0.3.0-x86_64-disk.img
> $ ls -l /dev/nbd15*
> brw-rw---- 1 root disk 43, 240 Jun  8 11:32 /dev/nbd15
> brw-rw---- 1 root disk 43, 241 Jun  8 11:32 /dev/nbd15p1

Very interesting. I don't get the ...p1 device here
on a 3.3.7.fc17.x86_64 kernel

cheers,
Pádraig.




More information about the Openstack mailing list