ia64/xen-unstable

changeset 16343:fbe7ed173314

Enable loopback disk image files on readonly nfs filesystem.

When we losetup a file on readonly nfs filesystem, it fails with:
# losetup /dev/loop7 /data/vm/xen_el5_i386_para/system.raw
/data/vm/xen_el5_i386_para/system.raw: Permission denied

New version of losetup has add a "-r" option for readonly loop, which
Linux kernel has supported for a long time. Some distribution (EL5
update, Fedora 8, etc.) have shipped it. This patch benefit this
option while doesn't break the old versions of losetup.

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
author Keir Fraser <keir@xensource.com>
date Wed Nov 07 09:22:31 2007 +0000 (2007-11-07)
parents 11dcbf74edf2
children ff2edb1fd9f2
files tools/examples/block
line diff
     1.1 --- a/tools/examples/block	Wed Nov 07 09:21:16 2007 +0000
     1.2 +++ b/tools/examples/block	Wed Nov 07 09:22:31 2007 +0000
     1.3 @@ -326,7 +326,10 @@ mount it read-write in a guest domain."
     1.4            fatal 'Failed to find an unused loop device'
     1.5          fi
     1.6  
     1.7 -        do_or_die losetup "$loopdev" "$file"
     1.8 +        status=$(losetup "$loopdev" "$file" || echo "failed")
     1.9 +        if [ -n "$status" ]; then
    1.10 +          do_or_die losetup -r "$loopdev" "$file"
    1.11 +        fi
    1.12          xenstore_write "$XENBUS_PATH/node" "$loopdev"
    1.13          write_dev "$loopdev"
    1.14          release_lock "block"