Can’t Block-attach A File On A Read Only Volume?

Home » CentOS-Virt » Can’t Block-attach A File On A Read Only Volume?
CentOS-Virt 4 Comments

Hi All,

One more weird issue, this works on old xen but fails on 4.4:

xendev01 ~ # mkdir /mnt/test

xendev01 ~ # mount -t tmpfs – /mnt/test

xendev01 ~ # dd if=/dev/null of=/mnt/test/disk seek=100M bs=1

0+0 records in

0+0 records out

0 bytes (0 B) copied, 0.000201809 s, 0.0 kB/s

xendev01 ~ # /usr/sbin/xl block-attach nathannx “file:/mnt/test/disk” “xvdd4”

DEBUG libxl__blktap_devpath 37 aio:/mnt/test/disk

DEBUG libxl__blktap_devpath 40 /dev/xen/blktap-2/tapdev20

xendev01 ~ # xl block-detach nathannx 51764

DEBUG libxl__device_destroy_tapdisk 66 type=aio:/mnt/test/disk disk=:/mnt/test/disk

xendev01 ~ # mount -o remount,ro /mnt/test

xendev01 ~ # /usr/sbin/xl block-attach nathannx “file:/mnt/test/disk” “xvdd4”

DEBUG libxl__blktap_devpath 37 aio:/mnt/test/disk

libxl: error: libxl.c:2149:device_disk_add: failed to get blktap devpath for 0xd3abd0

libxl: error: libxl.c:1727:device_addrm_aocomplete: unable to (null) device

libxl_device_disk_add failed.

I’m not sure why xen would care if the disk is writable? Would be nice to be able to mount these since many NFS storage arrays provide read only access to snapshots.

– Nathan

4 thoughts on - Can’t Block-attach A File On A Read Only Volume?

  • So by default, block-attach will set the access to a disk as read-write. If disk access is marked as read-write, the backend (in this case tapdisk) will attempt to open the file read-write; if this fails (as it will on read-only storage), the whole disk creation will fail. (This is true either of block-attach or domain creation.)

    Normally you could fix this by adding “,ro” to your disk spec. But in the case of blktap, this option is ignored at the moment. :-/

    I have, however, just taught xl to pay attention to this for blktap. I’ve got fixes to both this issue and the extra-tapdisk-process issue from the other thread in this local koji build:

    http://cbs.CentOS.org/kojifiles/work/tasks/8801/8801/

    If you could test those and let me know if it fixes your problem, I’d appreciate it. :-)

    As an aside, you’re using the old disk format; the new disk format looks more like this:

    “vdev=hdc,format=raw,access=rw,target=/mnt/test/disk”

    More info here:

    /usr/share/doc/xen-doc-4.4.1/misc/xl-disk-configuration.txt

    Thanks,
    -George

  • Confirmed, both issues are fixed. Thanks! Any plans to push those packages to main mirrors?

    – Nathan

  • Yep. :-) I’ve done a normal build so that it appears on the CBS in virt6-testing. I’ll leave it there for a couple of weeks for people to test, then push it to the main mirror.

    -George

  • FYI there will be an update coming out in the public repos around 31
    March with XSAs 125-127 (http://xenbits.xen.org/xsa/). That update will include this fix in it as well (unless we find a bug in the mean time of course).

    -George