avoid the use of kpartx in file injection
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Invalid
|
Medium
|
Pádraig Brady |
Bug Description
kpartx has various problems...
1. The git repo on kernel.org is no longer available.
2. kpartx -l had side effects:
$ kpartx -l /bin/ls
$ ls
text file busy
To fix you need to run losetup -a to find the assigned loopback device
and then losetup -d /dev/loop...
3. On an unconnected loop device we get warnings, but an EXIT_SUCCESS ?
# kpartx -a /dev/loop1 && echo EXIT_SUCCESS
read error, sector 0
llseek error
llseek error
llseek error
EXIT_SUCCESS
4. Also for a loop device that is connected,
I get a "failed" warning, but the EXIT_SUCCESS
is appropriate in that case as the mapped device
is present and usable
# kpartx -a /dev/loop0
/dev/mapper/
5. There are issues with qcow2 encoded cirros images
# qemu-img info cirros-
image: cirros-
file format: qcow2
virtual size: 39M (41126400 bytes)
disk size: 9.3M
cluster_size: 65536
# qemu-nbd -c /dev/nbd15 $PWD/cirros-
# ls -la /sys/block/
-r--r--r--. 1 root root 4096 Jun 8 10:19 /sys/block/
# kpartx -a /dev/nbd15
device-mapper: resume ioctl on nbd15p1 failed: Invalid argument
create/reload failed on nbd15p1
6. There was a report that `kpartx -[ad]` were not synchronous
with the creation/deletion of /dev/mapper/nbdXXpX
requiring sleep calls to avoid failures.
The best way to avoid the need for kpartx is to use the
newer kernel auto partition mapping feature available since kernel 3.2
and only fallback to kpartx if not exists ...
'%sp%s' % (self.device, self.partition)
Note the nbd module must be mounted with param max_part=16 etc.
so that would need documentation.
Also we would need to test the same applies for raw loopback images
as well as nbd
Changed in nova: | |
milestone: | folsom-rc1 → none |
I just noticed a mail to say in kernel Loop device partition scanning is unreliable /lkml.org/ lkml/2012/ 7/19/264
https:/
Something to keep an eye on