[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Enable loopback disk image files on readonly nfs filesystem.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1194427351 0
# Node ID fbe7ed173314723f80f105e7e60fddd0bed77e5b
# Parent  11dcbf74edf23adc3baca6330408a1f85de8094d
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@xxxxxxxxxx>
---
 tools/examples/block |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -r 11dcbf74edf2 -r fbe7ed173314 tools/examples/block
--- a/tools/examples/block      Wed Nov 07 09:21:16 2007 +0000
+++ b/tools/examples/block      Wed Nov 07 09:22:31 2007 +0000
@@ -326,7 +326,10 @@ mount it read-write in a guest domain."
           fatal 'Failed to find an unused loop device'
         fi
 
-        do_or_die losetup "$loopdev" "$file"
+        status=$(losetup "$loopdev" "$file" || echo "failed")
+        if [ -n "$status" ]; then
+          do_or_die losetup -r "$loopdev" "$file"
+        fi
         xenstore_write "$XENBUS_PATH/node" "$loopdev"
         write_dev "$loopdev"
         release_lock "block"

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.