WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH]Enable loopback disk image files on readonly nfs file

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH]Enable loopback disk image files on readonly nfs filesystem
From: Zhignag Wang <zhigang.x.wang@xxxxxxxxxx>
Date: Tue, 06 Nov 2007 20:08:41 -0800
Delivery-date: Tue, 06 Nov 2007 20:11:04 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.6 (X11/20070728)
Hi all,

This small patch enables you to loopback disk image files on readonly nfs filesystem on some system.

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>

regards,

zhigang
--- xen-unstable/tools/examples/block.orig      2007-11-06 20:01:53.000000000 
-0800
+++ xen-unstable/tools/examples/block   2007-11-06 20:03:14.000000000 -0800
@@ -326,7 +326,10 @@
           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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH]Enable loopback disk image files on readonly nfs filesystem, Zhignag Wang <=